From 4161dcd7862f469aa9b7f2ad6c4e863c47e4c93f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 24 Jul 2023 22:34:39 -0500 Subject: [PATCH] fix crash when exporting audio (per chip) also fix two misc issues in ES5506 and Sound Unit --- src/engine/engine.cpp | 5 +++-- src/engine/platform/es5506.cpp | 1 + src/engine/platform/su.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index c32b53112..1b9f427c8 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -927,12 +927,13 @@ void DivEngine::runExportThread() { } } - float* outBuf[2]; + float* outBuf[DIV_MAX_OUTPUTS]; + memset(outBuf,0,sizeof(void*)*DIV_MAX_OUTPUTS); outBuf[0]=new float[EXPORT_BUFSIZE]; outBuf[1]=new float[EXPORT_BUFSIZE]; short* sysBuf[DIV_MAX_CHIPS]; for (int i=0; igetOutputCount()]; } // take control of audio output diff --git a/src/engine/platform/es5506.cpp b/src/engine/platform/es5506.cpp index adb342f38..c44cdb0cf 100644 --- a/src/engine/platform/es5506.cpp +++ b/src/engine/platform/es5506.cpp @@ -1253,6 +1253,7 @@ int DivPlatformES5506::init(DivEngine* p, int channels, int sugRate, const DivCo dumpWrites=false; skipRegisterWrites=false; volScale=0; + curPage=0; for (int i=0; i<32; i++) { isMuted[i]=false; diff --git a/src/engine/platform/su.cpp b/src/engine/platform/su.cpp index b38b9f860..3c591cdaf 100644 --- a/src/engine/platform/su.cpp +++ b/src/engine/platform/su.cpp @@ -626,7 +626,7 @@ void DivPlatformSoundUnit::quit() { delete oscBuf[i]; } delete su; - delete sampleMem; + delete[] sampleMem; } DivPlatformSoundUnit::~DivPlatformSoundUnit() {