diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 29 |
1 files changed, 22 insertions, 7 deletions
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "version.h" | 7 | #include "version.h" |
| 8 | #include "midi.h" | 8 | #include "midi.h" |
| 9 | #include "synth.h" | 9 | #include "synth.h" |
| 10 | #include "interface.h" | ||
| 10 | #include "mutex.h" | 11 | #include "mutex.h" |
| 11 | 12 | ||
| 12 | void help(const char *argv0) { | 13 | void help(const char *argv0) { |
| @@ -27,7 +28,7 @@ int main(int argc, char *argv[]) { | |||
| 27 | { "list", 0, NULL, 'l' }, | 28 | { "list", 0, NULL, 'l' }, |
| 28 | { "client", 1, NULL, 'c' }, | 29 | { "client", 1, NULL, 'c' }, |
| 29 | { "soundfont", 1, NULL, 's' }, | 30 | { "soundfont", 1, NULL, 's' }, |
| 30 | { "preset", 1, NULL, 'p' }, | 31 | { "preset", 0, NULL, 'p' }, |
| 31 | { "help", 0, NULL, 'h' }, | 32 | { "help", 0, NULL, 'h' }, |
| 32 | { "version", 0, NULL, 'v' }, | 33 | { "version", 0, NULL, 'v' }, |
| 33 | { 0 }, | 34 | { 0 }, |
| @@ -35,7 +36,7 @@ int main(int argc, char *argv[]) { | |||
| 35 | 36 | ||
| 36 | char *port_name = NULL; | 37 | char *port_name = NULL; |
| 37 | char *soundfont_file = NULL; | 38 | char *soundfont_file = NULL; |
| 38 | int soundfont_preset = -1; | 39 | int soundfont_preset = 0; |
| 39 | 40 | ||
| 40 | int opt; | 41 | int opt; |
| 41 | while ((opt = getopt_long(argc, argv, short_options, long_options, NULL)) != -1) { | 42 | while ((opt = getopt_long(argc, argv, short_options, long_options, NULL)) != -1) { |
| @@ -56,11 +57,11 @@ int main(int argc, char *argv[]) { | |||
| 56 | help(argv[0]); | 57 | help(argv[0]); |
| 57 | return 0; | 58 | return 0; |
| 58 | case 'v': | 59 | case 'v': |
| 59 | fprintf(stdout, "ttdaw version %s\n", TTDAW_VERSION); | 60 | fprintf(stdout, "ttdaw version %s\n", VERSION); |
| 60 | fprintf(stdout, "Website: %s.\n", TTDAW_WEBSITE); | 61 | fprintf(stdout, "Website: %s.\n", WEBSITE); |
| 61 | fprintf(stdout, "%s\n", TTDAW_LICENSE); | 62 | fprintf(stdout, "%s\n", LICENSE); |
| 62 | fprintf(stdout, "%s\n", TTDAW_WARRANTY); | 63 | fprintf(stdout, "%s\n", WARRANTY); |
| 63 | fprintf(stdout, "\n%s\n", TTDAW_AUTHOR); | 64 | fprintf(stdout, "\n%s\n", AUTHOR); |
| 64 | return 0; | 65 | return 0; |
| 65 | default: | 66 | default: |
| 66 | fprintf(stdout, "Missing options. Check help.\n"); | 67 | fprintf(stdout, "Missing options. Check help.\n"); |
| @@ -102,8 +103,22 @@ int main(int argc, char *argv[]) { | |||
| 102 | return 1; | 103 | return 1; |
| 103 | } | 104 | } |
| 104 | 105 | ||
| 106 | // Create UI thread. | ||
| 107 | pthread_t interface_thread; | ||
| 108 | InterfaceArgs interface_args = { | ||
| 109 | .soundfont_file = soundfont_file, | ||
| 110 | .soundfont_preset = soundfont_preset, | ||
| 111 | }; | ||
| 112 | |||
| 113 | if (pthread_create(&interface_thread, NULL, interface, (void*)&interface_args) != 0) { | ||
| 114 | fprintf(stderr, "Error creating interface thread\n"); | ||
| 115 | return 1; | ||
| 116 | } | ||
| 117 | |||
| 118 | // Start threads. | ||
| 105 | pthread_join(midi_thread, NULL); | 119 | pthread_join(midi_thread, NULL); |
| 106 | pthread_join(synth_thread, NULL); | 120 | pthread_join(synth_thread, NULL); |
| 121 | pthread_join(interface_thread, NULL); | ||
| 107 | 122 | ||
| 108 | // Destroy mutex. | 123 | // Destroy mutex. |
| 109 | destroy_mutex(); | 124 | destroy_mutex(); |
