diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-10-09 03:12:15 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-10-09 03:12:15 +0200 |
| commit | cf2cfcd8a96921dbe812647045dff71ab63989cd (patch) | |
| tree | ab097af301e539254b42dd5a4c1faf42a321e6df /main.c | |
| parent | c05e271a0507231eaf131930b5b9711ef85ae4a8 (diff) | |
| download | ttdaw-cf2cfcd8a96921dbe812647045dff71ab63989cd.tar.gz | |
Added synth thread that plays a simple note
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -6,6 +6,7 @@ #include "version.h" #include "midi.h" +#include "synth.h" void help(const char *argv0) { printf("Usage: %s [options]\n" @@ -69,7 +70,16 @@ int main(int argc, char *argv[]) { fprintf(stdout, "> Device port: %s\n", port_name); fprintf(stdout, "> Soundfont: %s\n", soundfont_file); - // Create and start MIDI thread. + // Create synth thread. + pthread_t synth_thread; + SynthArgs synth_args = { soundfont_file }; + + if (pthread_create(&synth_thread, NULL, synth, (void*)&synth_args) != 0) { + fprintf(stderr, "Error creating synth thread\n"); + return 1; + } + + // Create MIDI thread. pthread_t midi_thread; MidiArgs midi_args = { port_name }; @@ -79,6 +89,7 @@ int main(int argc, char *argv[]) { } pthread_join(midi_thread, NULL); + pthread_join(synth_thread, NULL); fprintf(stdout, "Exiting...\n"); return 0; |
