summaryrefslogtreecommitdiff
path: root/drivers/ao/audio_driver_ao.cpp
diff options
context:
space:
mode:
authorAnton Yabchinskiy <arn@bestmx.ru>2014-11-22 12:59:12 +0300
committerAnton Yabchinskiy <arn@bestmx.ru>2014-11-22 13:38:11 +0300
commitf9db628d172949abb3cccf1eb8185ae011dc9e9f (patch)
tree159d124f2dd565593ef97a283d65fe77a360184e /drivers/ao/audio_driver_ao.cpp
parent4c8bfecc43886ce2414a96100f56d2ba1a0a4078 (diff)
Write audio samples to libao device
Diffstat (limited to 'drivers/ao/audio_driver_ao.cpp')
-rw-r--r--drivers/ao/audio_driver_ao.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/ao/audio_driver_ao.cpp b/drivers/ao/audio_driver_ao.cpp
index c43a3b15ae..49ce1a8e59 100644
--- a/drivers/ao/audio_driver_ao.cpp
+++ b/drivers/ao/audio_driver_ao.cpp
@@ -45,7 +45,7 @@ Error AudioDriverAO::init() {
ao_sample_format format;
- format.bits = 16;
+ format.bits = 32;
format.rate = mix_rate;
format.channels = channels;
format.byte_format = AO_FMT_LITTLE;
@@ -68,18 +68,18 @@ Error AudioDriverAO::init() {
void AudioDriverAO::thread_func(void* p_udata) {
AudioDriverAO* ad = (AudioDriverAO*)p_udata;
- uint64_t usdelay = (ad->buffer_size / float(ad->mix_rate)) * 1000000;
-
while (!ad->exit_thread) {
- if (!ad->active) {
-
- } else {
+ if (ad->active) {
ad->lock();
ad->audio_server_process(ad->buffer_size, ad->samples_in);
ad->unlock();
};
- OS::get_singleton()->delay_usec(usdelay);
+ if (ad->exit_thread)
+ break;
+
+ ao_play(ad->device, reinterpret_cast<char*>(ad->samples_in),
+ ad->buffer_size * ad->channels * sizeof(int32_t));
};
ad->thread_exited = true;