Create OpenAL sound sources asychronously

This commit is contained in:
Marianne Gagnon 2015-11-09 19:22:06 -05:00
parent 86d18c0c3e
commit bf14e49ea4
3 changed files with 6 additions and 1 deletions

View File

@ -378,7 +378,10 @@ void* SFXManager::mainLoop(void *obj)
case SFX_MUSIC_DEFAULT_VOLUME: case SFX_MUSIC_DEFAULT_VOLUME:
{ {
current->m_music_information->setDefaultVolume(); current->m_music_information->setDefaultVolume();
break;
} }
case SFX_CREATE_SOURCE:
current->m_sfx->init(); break;
default: assert("Not yet supported."); default: assert("Not yet supported.");
} }
delete current; delete current;

View File

@ -88,6 +88,7 @@ public:
SFX_MUSIC_WAITING, SFX_MUSIC_WAITING,
SFX_MUSIC_DEFAULT_VOLUME, SFX_MUSIC_DEFAULT_VOLUME,
SFX_EXIT, SFX_EXIT,
SFX_CREATE_SOURCE
}; // SFXCommands }; // SFXCommands
/** /**

View File

@ -58,7 +58,8 @@ SFXOpenAL::SFXOpenAL(SFXBuffer* buffer, bool positional, float volume,
// will not be used anyway. // will not be used anyway.
if (SFXManager::get()->sfxAllowed()) if (SFXManager::get()->sfxAllowed())
{ {
init(); SFXManager::get()->queue(SFXManager::SFX_CREATE_SOURCE, this);
//init();
} }
} // SFXOpenAL } // SFXOpenAL