commit 8a0515f3dd04d676b39b6b46c7618262ca292978
parent 8eb915a745d49e58aa5911737c275f36d98a3f55
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Tue, 30 Jul 2024 10:24:18 +0200
first proper shutdown attempts
Diffstat:
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/source/nord/n2x/n2xLib/n2xhardware.cpp b/source/nord/n2x/n2xLib/n2xhardware.cpp
@@ -32,7 +32,13 @@ namespace n2x
processAudio(8,8);
}
- Hardware::~Hardware() = default;
+ Hardware::~Hardware()
+ {
+ m_destroy = true;
+ m_dspA.dsp().terminate();
+ m_dspB.dsp().terminate();
+ m_ucThread->join();
+ }
bool Hardware::isValid() const
{
@@ -257,7 +263,7 @@ namespace n2x
dsp56k::ThreadTools::setCurrentThreadName("MC68331");
dsp56k::ThreadTools::setCurrentThreadPriority(dsp56k::ThreadPriority::Highest);
- while(true)
+ while(!m_destroy)
{
processUC();
processUC();
diff --git a/source/nord/n2x/n2xLib/n2xhardware.h b/source/nord/n2x/n2xLib/n2xhardware.h
@@ -73,8 +73,14 @@ namespace n2x
size_t m_requestedFrames = 0;
bool m_dspHalted = false;
dsp56k::SpscSemaphore m_semDspAtoB;
+
dsp56k::RingBuffer<dsp56k::Audio::RxFrame, 4, true> m_dspAtoBbuf;
+
std::unique_ptr<std::thread> m_ucThread;
+ bool m_destroy = false;
+
+
+ // Midi
dsp56k::RingBuffer<synthLib::SMidiEvent, 256, true, true> m_midiIn;
uint32_t m_midiOffsetCounter = 0;