Minor code formatting fixes in ao driver
This commit is contained in:
parent
2f92e2a67a
commit
3c2e35ada9
@ -54,10 +54,10 @@ Error AudioDriverAO::init() {
|
|||||||
device = ao_open_live(ao_default_driver_id(), &format, 0);
|
device = ao_open_live(ao_default_driver_id(), &format, 0);
|
||||||
ERR_FAIL_COND_V(device == 0, ERR_CANT_OPEN);
|
ERR_FAIL_COND_V(device == 0, ERR_CANT_OPEN);
|
||||||
|
|
||||||
int latency = GLOBAL_DEF("audio/output_latency",25);
|
int latency = GLOBAL_DEF("audio/output_latency", 25);
|
||||||
buffer_size = nearest_power_of_2( latency * mix_rate / 1000 );
|
buffer_size = nearest_power_of_2( latency * mix_rate / 1000 );
|
||||||
|
|
||||||
samples_in = memnew_arr(int32_t, buffer_size*channels);
|
samples_in = memnew_arr(int32_t, buffer_size * channels);
|
||||||
|
|
||||||
mutex = Mutex::create();
|
mutex = Mutex::create();
|
||||||
thread = Thread::create(AudioDriverAO::thread_func, this);
|
thread = Thread::create(AudioDriverAO::thread_func, this);
|
||||||
@ -66,10 +66,9 @@ Error AudioDriverAO::init() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void AudioDriverAO::thread_func(void* p_udata) {
|
void AudioDriverAO::thread_func(void* p_udata) {
|
||||||
|
|
||||||
AudioDriverAO* ad = (AudioDriverAO*)p_udata;
|
AudioDriverAO* ad = (AudioDriverAO*)p_udata;
|
||||||
|
|
||||||
uint64_t usdelay = (ad->buffer_size / float(ad->mix_rate))*1000000;
|
uint64_t usdelay = (ad->buffer_size / float(ad->mix_rate)) * 1000000;
|
||||||
|
|
||||||
while (!ad->exit_thread) {
|
while (!ad->exit_thread) {
|
||||||
if (!ad->active) {
|
if (!ad->active) {
|
||||||
@ -78,13 +77,12 @@ void AudioDriverAO::thread_func(void* p_udata) {
|
|||||||
ad->lock();
|
ad->lock();
|
||||||
ad->audio_server_process(ad->buffer_size, ad->samples_in);
|
ad->audio_server_process(ad->buffer_size, ad->samples_in);
|
||||||
ad->unlock();
|
ad->unlock();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
OS::get_singleton()->delay_usec(usdelay);
|
OS::get_singleton()->delay_usec(usdelay);
|
||||||
};
|
};
|
||||||
|
|
||||||
ad->thread_exited=true;
|
ad->thread_exited = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
void AudioDriverAO::start() {
|
void AudioDriverAO::start() {
|
||||||
|
Loading…
Reference in New Issue
Block a user