diff options
Diffstat (limited to '3rdparty/portmidi/pm_test/midiclock.c')
-rw-r--r-- | 3rdparty/portmidi/pm_test/midiclock.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/3rdparty/portmidi/pm_test/midiclock.c b/3rdparty/portmidi/pm_test/midiclock.c index 60fcf7a9aad..f0a68974a1c 100644 --- a/3rdparty/portmidi/pm_test/midiclock.c +++ b/3rdparty/portmidi/pm_test/midiclock.c @@ -24,7 +24,7 @@ typedef int boolean; #define OUTPUT_BUFFER_SIZE 0 #define DRIVER_INFO NULL -#define TIME_PROC ((int32_t (*)(void *)) Pt_Time) +#define TIME_PROC ((PmTimeProcPtr) Pt_Time) #define TIME_INFO NULL #define LATENCY 0 #define TIME_START Pt_Start(1, 0, 0) /* timer started w/millisecond accuracy */ @@ -163,15 +163,13 @@ void timer_poll(PtTimestamp timestamp, void *userData) /* read a number from console */ /**/ -int get_number(char *prompt) +int get_number(const char *prompt) { - char line[STRING_MAX]; int n = 0, i; - printf(prompt); + fputs(prompt, stdout); while (n != 1) { n = scanf("%d", &i); - fgets(line, STRING_MAX, stdin); - + while (getchar() != '\n') ; } return i; } @@ -236,7 +234,6 @@ private void doascii(char c) */ int main(int argc, char **argv) { - char s[STRING_MAX]; /* console input */ int outp; PmError err; int i; @@ -256,22 +253,20 @@ int main(int argc, char **argv) err = Pm_OpenOutput(&midi, outp, DRIVER_INFO, OUTPUT_BUFFER_SIZE, TIME_PROC, TIME_INFO, LATENCY); if (err) { - printf(Pm_GetErrorText(err)); + puts(Pm_GetErrorText(err)); goto error_exit_no_device; } active = true; - printf("Type RETURN to start MIDI CLOCK:\n"); - if (!fgets(s, STRING_MAX, stdin)) goto error_exit; + printf("Type ENTER to start MIDI CLOCK:\n"); + while (getchar() != '\n') ; send_start_stop = true; /* send START and then CLOCKs */ while (!done) { - if (fgets(s, STRING_MAX, stdin)) { - doascii(s[0]); - } + doascii(getchar()); + while (getchar() != '\n') ; } - error_exit: active = false; Pt_Sleep(2); /* this is to allow callback to complete -- it's real time, so it's either ok and it runs on |