diff options
author | Your Name <you@example.com> | 2019-02-26 13:21:29 +0000 |
---|---|---|
committer | Your Name <you@example.com> | 2019-02-26 13:21:29 +0000 |
commit | 89aa56f25116fc642928f352c14fe2d485532749 (patch) | |
tree | f3e74785601c2d9daca159e049cdd3be4089aec1 /audio.c | |
parent | 9b0002fc40f4d8b97cf2064910a9ded467f29276 (diff) | |
download | gen_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.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -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); +} |