mirror of https://github.com/AxioDL/boo.git
Synchronous lifetime control of AudioQueue on macOS
This commit is contained in:
parent
93f6e11fa8
commit
f0e8e0a1fa
|
@ -48,9 +48,13 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
|
||||||
std::condition_variable m_engineEnterCv;
|
std::condition_variable m_engineEnterCv;
|
||||||
std::condition_variable m_engineLeaveCv;
|
std::condition_variable m_engineLeaveCv;
|
||||||
bool m_cbWaiting = false;
|
bool m_cbWaiting = false;
|
||||||
|
bool m_cbRunning = true;
|
||||||
|
|
||||||
static void Callback(AQSAudioVoiceEngine* engine, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer)
|
static void Callback(AQSAudioVoiceEngine* engine, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer)
|
||||||
{
|
{
|
||||||
|
if (!engine->m_cbRunning)
|
||||||
|
return;
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lk(engine->m_engineMutex);
|
std::unique_lock<std::mutex> lk(engine->m_engineMutex);
|
||||||
engine->m_cbWaiting = true;
|
engine->m_cbWaiting = true;
|
||||||
engine->m_engineEnterCv.wait(lk);
|
engine->m_engineEnterCv.wait(lk);
|
||||||
|
@ -712,7 +716,10 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
|
||||||
|
|
||||||
~AQSAudioVoiceEngine()
|
~AQSAudioVoiceEngine()
|
||||||
{
|
{
|
||||||
AudioQueueDispose(m_queue, false);
|
m_cbRunning = false;
|
||||||
|
if (m_cbWaiting)
|
||||||
|
m_engineEnterCv.notify_one();
|
||||||
|
AudioQueueDispose(m_queue, true);
|
||||||
if (m_midiClient)
|
if (m_midiClient)
|
||||||
MIDIClientDispose(m_midiClient);
|
MIDIClientDispose(m_midiClient);
|
||||||
}
|
}
|
||||||
|
|
|
@ -467,7 +467,14 @@ static const MTLBlendFactor BLEND_FACTOR_TABLE[] =
|
||||||
MTLBlendFactorSourceAlpha,
|
MTLBlendFactorSourceAlpha,
|
||||||
MTLBlendFactorOneMinusSourceAlpha,
|
MTLBlendFactorOneMinusSourceAlpha,
|
||||||
MTLBlendFactorDestinationAlpha,
|
MTLBlendFactorDestinationAlpha,
|
||||||
MTLBlendFactorOneMinusDestinationAlpha
|
MTLBlendFactorOneMinusDestinationAlpha,
|
||||||
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
|
||||||
|
MTLBlendFactorSource1Color,
|
||||||
|
MTLBlendFactorOneMinusSource1Color,
|
||||||
|
#else
|
||||||
|
MTLBlendFactorSourceColor,
|
||||||
|
MTLBlendFactorOneMinusSourceColor,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const MTLPrimitiveType PRIMITIVE_TABLE[] =
|
static const MTLPrimitiveType PRIMITIVE_TABLE[] =
|
||||||
|
|
2
logvisor
2
logvisor
|
@ -1 +1 @@
|
||||||
Subproject commit f913fb8479e14029aa510b01d620e64b17d4ad31
|
Subproject commit e6f24e64284fff5d5559b3d7e5aa44b610e2d7e9
|
Loading…
Reference in New Issue