Add --strict-timing as a commandline option
@@ -41,6 +41,10 @@ static void usage(void) {
" Set MIDI to be sent via OSC formatted for Plogue Bidule.\n"
" The path argument is the path of the Plogue OSC MIDI device.\n"
" Example: /OSC_MIDI_0/MIDI\n"
+ "\n"
+ " --strict-timing\n"
+ " Reduce the timing jitter of outgoing MIDI and OSC messages.\n"
+ " Uses more CPU time.\n"
);
// clang-format on
}
@@ -1705,6 +1709,7 @@ enum {
Argopt_osc_server,
Argopt_osc_port,
Argopt_osc_midi_bidule,
+ Argopt_strict_timing,
};
int main(int argc, char** argv) {
@@ -1714,11 +1719,13 @@ int main(int argc, char** argv) {
{"osc-server", required_argument, 0, Argopt_osc_server},
{"osc-port", required_argument, 0, Argopt_osc_port},
{"osc-midi-bidule", required_argument, 0, Argopt_osc_midi_bidule},
+ {"strict-timing", no_argument, 0, Argopt_strict_timing},
{NULL, 0, NULL, 0}};
char* input_file = NULL;
int margin_thickness = 2;
char const* osc_hostname = NULL;
char const* osc_port = NULL;
+ bool strict_timing = false;
Midi_mode midi_mode;
midi_mode_init(&midi_mode);
for (;;) {
@@ -1748,6 +1755,9 @@ int main(int argc, char** argv) {
case Argopt_osc_midi_bidule: {
midi_mode_set_osc_bidule(&midi_mode, optarg);
} break;
+ case Argopt_strict_timing: {
+ strict_timing = true;
+ } break;
case '?':
usage();
return 1;
@@ -1905,7 +1915,7 @@ int main(int argc, char** argv) {
doupdate();
double secs_to_d = ged_secs_to_deadline(&ged_state);
int new_timeout;
-#if 1
+ if (strict_timing) {
if (secs_to_d < ms_to_sec(0.5)) {
new_timeout = 0;
} else if (secs_to_d < ms_to_sec(1.5)) {
@@ -1933,7 +1943,7 @@ int main(int argc, char** argv) {
} else {
new_timeout = 50;
}
-#else
+ } else {
if (secs_to_d < ms_to_sec(0.5)) {
new_timeout = 0;
} else if (secs_to_d < ms_to_sec(1.0)) {
@@ -1953,7 +1963,7 @@ int main(int argc, char** argv) {
} else {
new_timeout = 50;
}
-#endif
+ }
if (new_timeout != cur_timeout) {
wtimeout(stdscr, new_timeout);
cur_timeout = new_timeout;
