audio threads

This commit is contained in:
Ariel Manzur 2015-12-21 09:01:40 -03:00
parent 19267f30d9
commit 72a6b137ba

View file

@ -30,6 +30,10 @@
#include "globals.h" #include "globals.h"
#include "os/os.h" #include "os/os.h"
#ifdef NO_THREADS
#define NO_AUDIO_THREADS
#endif
struct _AudioDriverLock { struct _AudioDriverLock {
_AudioDriverLock() { if (AudioDriverSW::get_singleton()) AudioDriverSW::get_singleton()->lock(); } _AudioDriverLock() { if (AudioDriverSW::get_singleton()) AudioDriverSW::get_singleton()->lock(); }
@ -803,7 +807,7 @@ void AudioServerSW::init() {
if (AudioDriverSW::get_singleton()) if (AudioDriverSW::get_singleton())
AudioDriverSW::get_singleton()->start(); AudioDriverSW::get_singleton()->start();
#ifndef NO_THREADS #ifndef NO_AUDIO_THREADS
exit_update_thread=false; exit_update_thread=false;
thread = Thread::create(_thread_func,this); thread = Thread::create(_thread_func,this);
thread->set_name("AudioServerSW"); thread->set_name("AudioServerSW");
@ -813,7 +817,7 @@ void AudioServerSW::init() {
void AudioServerSW::finish() { void AudioServerSW::finish() {
#ifndef NO_THREADS #ifndef NO_AUDIO_THREADS
exit_update_thread=true; exit_update_thread=true;
Thread::wait_to_finish(thread); Thread::wait_to_finish(thread);
memdelete(thread); memdelete(thread);
@ -846,7 +850,7 @@ void AudioServerSW::_update_streams(bool p_thread) {
void AudioServerSW::update() { void AudioServerSW::update() {
_update_streams(false); _update_streams(false);
#ifdef NO_THREADS #ifdef NO_AUDIO_THREADS
_update_streams(true); _update_streams(true);
#endif #endif