summaryrefslogtreecommitdiffstats
path: root/audio.c
diff options
context:
space:
mode:
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);
+}