summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-10-09 17:59:41 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-10-09 17:59:41 +0200
commitbfc79cef2cb743fedba3e93fd005d25b0a4923dc (patch)
treeba322aea6b9ce203b9daf9b4b7b9280455027454 /main.c
parentcf2cfcd8a96921dbe812647045dff71ab63989cd (diff)
downloadttdaw-bfc79cef2cb743fedba3e93fd005d25b0a4923dc.tar.gz
Added mutex and proper audio playback
Diffstat (limited to 'main.c')
-rw-r--r--main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.c b/main.c
index 5a1916e..4eb4cf7 100644
--- a/main.c
+++ b/main.c
@@ -7,6 +7,7 @@
#include "version.h"
#include "midi.h"
#include "synth.h"
+#include "mutex.h"
void help(const char *argv0) {
printf("Usage: %s [options]\n"
@@ -70,6 +71,9 @@ int main(int argc, char *argv[]) {
fprintf(stdout, "> Device port: %s\n", port_name);
fprintf(stdout, "> Soundfont: %s\n", soundfont_file);
+ // Create mutex.
+ initialize_mutex();
+
// Create synth thread.
pthread_t synth_thread;
SynthArgs synth_args = { soundfont_file };
@@ -91,6 +95,9 @@ int main(int argc, char *argv[]) {
pthread_join(midi_thread, NULL);
pthread_join(synth_thread, NULL);
+ // Destroy mutex.
+ destroy_mutex();
+
fprintf(stdout, "Exiting...\n");
return 0;
}