summaryrefslogtreecommitdiffstats
path: root/audio.c
diff options
context:
space:
mode:
authorYour Name <you@example.com>2019-02-26 13:21:29 +0000
committerYour Name <you@example.com>2019-02-26 13:21:29 +0000
commit89aa56f25116fc642928f352c14fe2d485532749 (patch)
treef3e74785601c2d9daca159e049cdd3be4089aec1 /audio.c
parent9b0002fc40f4d8b97cf2064910a9ded467f29276 (diff)
downloadgen_msf-89aa56f25116fc642928f352c14fe2d485532749.tar.gz
gen_msf-89aa56f25116fc642928f352c14fe2d485532749.tar.bz2
gen_msf-89aa56f25116fc642928f352c14fe2d485532749.zip
working sync and audio
Diffstat (limited to 'audio.c')
-rw-r--r--audio.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/audio.c b/audio.c
new file mode 100644
index 0000000..83e6de9
--- /dev/null
+++ b/audio.c
@@ -0,0 +1,33 @@
+#include "project.h"
+#include <ao/ao.h>
+
+static ao_device *device;
+static int d_num;
+
+void audio_init (void)
+{
+
+ ao_initialize();
+
+ d_num = ao_default_driver_id();
+}
+
+void audio_start (void)
+{
+ ao_sample_format fmt = {0};
+
+
+ fmt.bits = 16;
+ fmt.rate = SAMPLE_RATE;
+ fmt.channels = 1;
+ fmt.byte_format = AO_FMT_NATIVE;
+ fmt.matrix = 0;
+
+ device = ao_open_live (d_num, &fmt, NULL);
+}
+
+
+void audio_play (void *data, size_t len)
+{
+ ao_play (device, data, len);
+}