From 156147b83d4cffdd7ff76dd0bcfffd732b8a6723 Mon Sep 17 00:00:00 2001 From: Kevin <68612569+diyelectromusic@users.noreply.github.com> Date: Tue, 28 May 2024 15:56:58 +0100 Subject: [PATCH] Adjusted default chunk sizes to correctly support number of channels. --- src/config.cpp | 14 ++++++++++---- src/minidexed.cpp | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 3f95ce5..ea6bde3 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -41,15 +41,22 @@ void CConfig::Load (void) m_SoundDevice = m_Properties.GetString ("SoundDevice", "pwm"); m_nSampleRate = m_Properties.GetNumber ("SampleRate", 48000); + m_bQuadDAC8Chan = m_Properties.GetNumber ("QuadDAC8Chan", 0) != 0; + if (m_SoundDevice == "hdmi") { + m_nChunkSize = m_Properties.GetNumber ("ChunkSize", 384*6); + } + else + { #ifdef ARM_ALLOW_MULTI_CORE - m_nChunkSize = m_Properties.GetNumber ("ChunkSize", m_SoundDevice == "hdmi" ? 384*6 : 256); + m_nChunkSize = m_Properties.GetNumber ("ChunkSize", m_bQuadDAC8Chan ? 1024 : 256); // 128 per channel #else - m_nChunkSize = m_Properties.GetNumber ("ChunkSize", m_SoundDevice == "hdmi" ? 384*6 : 1024); + m_nChunkSize = m_Properties.GetNumber ("ChunkSize", 1024); #endif + } m_nDACI2CAddress = m_Properties.GetNumber ("DACI2CAddress", 0); m_bChannelsSwapped = m_Properties.GetNumber ("ChannelsSwapped", 0) != 0; - unsigned newEngineType = m_Properties.GetNumber ("EngineType", 1); + unsigned newEngineType = m_Properties.GetNumber ("EngineType", 1); if (newEngineType == 2) { m_EngineType = MKI; } else if (newEngineType == 3) { @@ -85,7 +92,6 @@ void CConfig::Load (void) m_bMIDIAutoVoiceDumpOnPC = m_Properties.GetNumber ("MIDIAutoVoiceDumpOnPC", 0) != 0; m_bHeaderlessSysExVoices = m_Properties.GetNumber ("HeaderlessSysExVoices", 0) != 0; m_bExpandPCAcrossBanks = m_Properties.GetNumber ("ExpandPCAcrossBanks", 1) != 0; - m_bQuadDAC8Chan = m_Properties.GetNumber ("QuadDAC8Chan", 0) != 0; m_bLCDEnabled = m_Properties.GetNumber ("LCDEnabled", 0) != 0; m_nLCDPinEnable = m_Properties.GetNumber ("LCDPinEnable", 4); diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 31d11fd..3a39680 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -279,7 +279,7 @@ bool CMiniDexed::Initialize (void) Channels = 2; // 16-bit Stereo } #endif - if (!m_pSoundDevice->AllocateQueueFrames (Channels * m_pConfig->GetChunkSize ())) + if (!m_pSoundDevice->AllocateQueueFrames (m_pConfig->GetChunkSize () / Channels)) { LOGERR ("Cannot allocate sound queue");