diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-10-07 19:30:56 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-10-07 19:30:56 +0200 |
| commit | 40a899bd6ee536eae093337bf2d0dcc8db4e46f1 (patch) | |
| tree | 485ace3e6fd28b91f394efd277732651e10824d8 /portmidi/pm_test/pmlist.c | |
| parent | 6fc4bddfdf8e056469f316c1a0fe488efbb4253a (diff) | |
| download | ttdaw-40a899bd6ee536eae093337bf2d0dcc8db4e46f1.tar.gz | |
Moved example code examples folder
Diffstat (limited to 'portmidi/pm_test/pmlist.c')
| -rw-r--r-- | portmidi/pm_test/pmlist.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/portmidi/pm_test/pmlist.c b/portmidi/pm_test/pmlist.c deleted file mode 100644 index 5e3d1db..0000000 --- a/portmidi/pm_test/pmlist.c +++ /dev/null @@ -1,63 +0,0 @@ -/* pmlist.c -- list portmidi devices and numbers - * - * This program lists devices. When you type return, it - * restarts portmidi and lists devices again. It is mainly - * a test for shutting down and restarting. - * - * Roger B. Dannenberg, Feb 2022 - */ - -#include "portmidi.h" -#include "porttime.h" -#include "stdlib.h" -#include "stdio.h" -#include "string.h" -#include "assert.h" - -#define DEVICE_INFO NULL -#define DRIVER_INFO NULL -#define TIME_START Pt_Start(1, 0, 0) /* timer started w/millisecond accuracy */ - -#define STRING_MAX 80 /* used for console input */ - -void show_usage() -{ - printf("Usage: pmlist [-h]\n -h means help.\n" - " Type return to rescan and list devices, q<ret> to quit\n"); -} - - -int main(int argc, char *argv[]) -{ - if (argc > 1) { - show_usage(); - exit(0); - } - - while (1) { - char input[STRING_MAX]; - const char *deflt; - const char *in_or_out; - int default_in, default_out, i; - - // Pm_Initialize(); - /* list device information */ - default_in = Pm_GetDefaultInputDeviceID(); - default_out = Pm_GetDefaultOutputDeviceID(); - for (i = 0; i < Pm_CountDevices(); i++) { - const PmDeviceInfo *info = Pm_GetDeviceInfo(i); - printf("%d: %s, %s", i, info->interf, info->name); - deflt = ""; - if (i == default_out || i == default_in) { - deflt = "default "; - } - in_or_out = (info->input ? "input" : "output"); - printf(" (%s%s)\n", deflt, in_or_out); - } - if (fgets(input, STRING_MAX, stdin) && input[0] == 'q') { - return 0; - } - Pm_Terminate(); - } - return 0; -} |
