[Audio] Add AI_Update to OpenSLES.cpp

This commit is contained in:
zilmar 2017-09-20 17:24:54 +10:00
parent 118d58f16b
commit 38b5131f16
3 changed files with 23 additions and 4 deletions

View File

@ -13,6 +13,7 @@
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#include <Common/Util.h>
#include <Project64-audio/Driver/OpenSLES.h>
#include "audio_1.1.h"
#include "Version.h"
@ -101,9 +102,18 @@ EXPORT uint32_t CALL AiReadLength(void)
return 0;
}
EXPORT void CALL AiUpdate(int32_t /*Wait*/)
EXPORT void CALL AiUpdate(int32_t Wait)
{
WriteTrace(TraceAudioInterface, TraceDebug, "Called");
WriteTrace(TraceAudioInterface, TraceDebug, "Start (Wait: %s)", Wait ? "true" : "false");
if (g_SoundDriver)
{
g_SoundDriver->AI_Update(Wait != 0);
}
else
{
pjutil::Sleep(1);
}
WriteTrace(TraceAudioInterface, TraceDebug, "Done");
}
EXPORT void CALL CloseDLL(void)
@ -145,6 +155,7 @@ EXPORT int32_t CALL InitiateAudio(AUDIO_INFO Audio_Info)
WriteTrace(TraceAudioInterface, TraceDebug, "Start");
if (g_SoundDriver != NULL)
{
g_SoundDriver->AI_Shutdown();
delete g_SoundDriver;
}
g_AudioInfo = Audio_Info;

View File

@ -663,4 +663,9 @@ void OpenSLESDriver::AI_LenChanged(uint8_t *start, uint32_t length)
}
}
WriteTrace(TraceAudioInterface, TraceDebug, "Done");
}
void OpenSLESDriver::AI_Update(bool Wait)
{
m_AiUpdateEvent.IsTriggered(Wait ? SyncEvent::INFINITE_TIMEOUT : 0);
}

View File

@ -14,8 +14,7 @@
* *
****************************************************************************/
#pragma once
#pragma once
#include <Common/SyncEvent.h>
#include <Project64-audio/Audio_1.1.h>
#include "SoundBase.h"
@ -27,4 +26,8 @@ public:
void AI_Shutdown(void);
void AI_SetFrequency(uint32_t freq);
void AI_LenChanged(uint8_t *start, uint32_t length);
void AI_Update(bool Wait);
private:
SyncEvent m_AiUpdateEvent;
};