summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-10-09 03:12:15 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-10-09 03:12:15 +0200
commitcf2cfcd8a96921dbe812647045dff71ab63989cd (patch)
treeab097af301e539254b42dd5a4c1faf42a321e6df /main.c
parentc05e271a0507231eaf131930b5b9711ef85ae4a8 (diff)
downloadttdaw-cf2cfcd8a96921dbe812647045dff71ab63989cd.tar.gz
Added synth thread that plays a simple note
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/main.c b/main.c
index 3a45592..5a1916e 100644
--- a/main.c
+++ b/main.c
@@ -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;