AudioCommon: Migrate threadData to OpenALStream and AOSoundStream

This is only ever used in these two sound streams. Seems silly to have it as a class member. Converted it to an atomic as well.
This commit is contained in:
Lioncash
2015-05-09 23:48:22 -04:00
parent 78e59d08fe
commit 4920dbed13
5 changed files with 12 additions and 9 deletions

View File

@ -32,7 +32,7 @@ void AOSound::SoundLoop()
buf_size = format.bits/8 * format.channels * format.rate;
while (!threadData)
while (m_run_thread.load())
{
m_mixer->Mix(realtimeBuffer, numBytesToRender >> 2);
@ -47,6 +47,7 @@ void AOSound::SoundLoop()
bool AOSound::Start()
{
m_run_thread.store(true);
memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
thread = std::thread(&AOSound::SoundLoop, this);
@ -60,7 +61,7 @@ void AOSound::Update()
void AOSound::Stop()
{
threadData = 1;
m_run_thread.store(false);
soundSyncEvent.Set();
{