Browse Source

Add --strict-timing as a commandline option

master
cancel 6 years ago
parent
commit
86e8a52ab3
  1. 16
      tui_main.c

16
tui_main.c

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

Loading…
Cancel
Save