commit 4bee0d16c27453f07559261ec5c13872fa18e65b parent 13b5b07c5398d95e0dd7e034f7c566fb4afd3839 Author: dsp56300 <dsp56300@users.noreply.github.com> Date: Thu, 1 Aug 2024 18:37:33 +0200 more shutdown madness Diffstat:
M | source/nord/n2x/n2xLib/n2xhardware.cpp | | | 18 | ++++++++++-------- |
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/source/nord/n2x/n2xLib/n2xhardware.cpp b/source/nord/n2x/n2xLib/n2xhardware.cpp @@ -45,22 +45,24 @@ namespace n2x m_dspA.terminate(); m_dspB.terminate(); - // DSP A waits for space to push to DSP B for(uint32_t i=0; i<notifyCount; ++i) - m_semDspAtoB.notify(); - // DSP B waits for ESAI rate limiting m_esaiFrameIndex = 0; m_maxEsaiCallbacks = std::numeric_limits<uint32_t>::max(); m_esaiLatency = 0; for(uint32_t i=0; i<notifyCount; ++i) - m_haltDSPcv.notify_all(); - m_dspB.terminate(); - m_dspA.join(); - m_dspB.terminate(); - m_dspB.join(); + while(!m_dspA.getDSPThread().runThread() || !m_dspB.getDSPThread().runThread()) + { + // DSP A waits for space to push to DSP B + m_semDspAtoB.notify(); + + // DSP B waits for ESAI rate limiting and for DSP A to provide audio data + m_haltDSPcv.notify_all(); + if(m_dspA.getPeriph().getEsai().getAudioOutputs().empty()) + m_dspA.getPeriph().getEsai().getAudioOutputs().push_back({}); + } m_ucThread->join(); }