Skip to content

Commit

Permalink
Use C++ long long for time variables
Browse files Browse the repository at this point in the history
The values being sent are Java `long` values, which apparently are
called `long long` in C++. This fixes parse errors people were
encountering.
  • Loading branch information
brunchboy committed Apr 24, 2019
1 parent b65be36 commit 2c497a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,13 @@ This change log follows the conventions of

## [Unreleased][unreleased]

### Fixed

- It turns out that C++ integer types are half the size of Java

This comment has been minimized.

Copy link
@brunchboy

brunchboy Apr 27, 2019

Author Member

It turns out that it is only in Windows, of all 64-bit operating systems, that this is an issue. https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models

integer types, so the Java `long` values that are sent by Beat Link
Trigger as time stamps need to be declared as `long long` values in
C++. This change fixes parse errors people were running into.

### Added

- More detailed error information is printed in the window in which
Expand Down
8 changes: 4 additions & 4 deletions carabiner.cpp
Expand Up @@ -120,7 +120,7 @@ static void handleBpm(std::stringstream &args, struct mg_connection *nc) {

// Process a request to query the SessionState to find out what beat occurs at a particular time
static void handleBeatAtTime(std::stringstream &args, struct mg_connection *nc) {
long when;
long long when;
double quantum;

args >> when;
Expand All @@ -146,7 +146,7 @@ static void handleBeatAtTime(std::stringstream &args, struct mg_connection *nc)

// Process a request to query the current SessionState phase
static void handlePhaseAtTime(std::stringstream &args, struct mg_connection *nc) {
long when;
long long when;
double quantum;

args >> when;
Expand Down Expand Up @@ -200,7 +200,7 @@ static void handleTimeAtBeat(std::stringstream &args, struct mg_connection *nc)
// Process a request to gracefully or forcibly realign the SessionState
static void handleAdjustBeatAtTime(std::stringstream &args, struct mg_connection *nc, bool force) {
double beat;
long when;
long long when;
double quantum;

args >> beat;
Expand Down Expand Up @@ -240,7 +240,7 @@ static void handleEnableStartStopSync(bool enable, std::stringstream &args, stru

// Process a request to start or stop the shared transport state
static void handleSetIsPlaying(bool playing, std::stringstream &args, struct mg_connection *nc) {
long when;
long long when;

args >> when;
if (args.fail()) {
Expand Down

0 comments on commit 2c497a1

Please sign in to comment.