From 8a3488021aaf0484b77c71ff909cf6cd5042856c Mon Sep 17 00:00:00 2001 From: Luca <51792528+donluca@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:38:26 +0200 Subject: [PATCH] Added configuration needed to choose between Modern, OPL and Mark I engines (#443) * Added Engines Mark I and OPL * Added Engine selection * Update config.cpp * Added selection for Engine Type * Added Engine Type selection * Update build.yml * Fixes * Reverting to an old commit (I screwed up) * Small fix * Small Fixes * Fix for error when compiling on 64-bit platforms * Casting of the engine variable corrected * Changed the way we parse and set the engine type from the config file following @diyelectromusic suggestions * Fixed a typo * Update Synth_Dexed commit * Moved blocks of code around * Update Synth_Dexed to 8c67f73 https://github.com/probonopd/MiniDexed/issues/403#issuecomment-1455130745 * Update Synth_Dexed to a908f78 https://github.com/probonopd/MiniDexed/discussions/358#discussioncomment-5358731 * Synth_Dexed deb0905 * Add EngineMsfa.o to Makefile * Don't add EngineMsfa.o here... * ...but add EngineMsfa.o here * Fix missing \ * Update build.yml * Add Synth_Dexed to the submodules update * Update Synth_Dexed * Update Synth_Dexed to c9f5274 https://github.com/probonopd/MiniDexed/issues/526#issuecomment-1670217925 --------- Co-authored-by: probonopd --- src/Synth_Dexed.mk | 3 +++ src/config.cpp | 17 +++++++++++++++++ src/config.h | 4 ++++ src/minidexed.cpp | 3 ++- src/minidexed.ini | 2 ++ submod.sh | 4 +++- 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/Synth_Dexed.mk b/src/Synth_Dexed.mk index 443d606..6aa4a49 100644 --- a/src/Synth_Dexed.mk +++ b/src/Synth_Dexed.mk @@ -22,6 +22,9 @@ OBJS += \ $(SYNTH_DEXED_DIR)/pitchenv.o \ $(SYNTH_DEXED_DIR)/porta.o \ $(SYNTH_DEXED_DIR)/sin.o \ + $(SYNTH_DEXED_DIR)/EngineMkI.o\ + $(SYNTH_DEXED_DIR)/EngineOpl.o\ + $(SYNTH_DEXED_DIR)/EngineMsfa.o\ $(CMSIS_DSP_SOURCE_DIR)/SupportFunctions/SupportFunctions.o \ $(CMSIS_DSP_SOURCE_DIR)/BasicMathFunctions/BasicMathFunctions.o \ $(CMSIS_DSP_SOURCE_DIR)/FastMathFunctions/FastMathFunctions.o \ diff --git a/src/config.cpp b/src/config.cpp index c40d29a..9a64f50 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -21,6 +21,7 @@ // along with this program. If not, see . // #include "config.h" +#include "../Synth_Dexed/src/dexed.h" CConfig::CConfig (FATFS *pFileSystem) : m_Properties ("minidexed.ini", pFileSystem) @@ -46,6 +47,15 @@ void CConfig::Load (void) m_nDACI2CAddress = m_Properties.GetNumber ("DACI2CAddress", 0); m_bChannelsSwapped = m_Properties.GetNumber ("ChannelsSwapped", 0) != 0; + unsigned newEngineType = m_Properties.GetNumber ("EngineType", 1); + if (newEngineType == 2) { + m_EngineType = MKI; + } else if (newEngineType == 3) { + m_EngineType = OPL; + } else { + m_EngineType = MSFA; + } + m_nMIDIBaudRate = m_Properties.GetNumber ("MIDIBaudRate", 31250); const char *pMIDIThru = m_Properties.GetString ("MIDIThru"); @@ -151,6 +161,11 @@ bool CConfig::GetChannelsSwapped (void) const return m_bChannelsSwapped; } +unsigned CConfig::GetEngineType (void) const +{ + return m_EngineType; +} + unsigned CConfig::GetMIDIBaudRate (void) const { return m_nMIDIBaudRate; @@ -400,3 +415,5 @@ bool CConfig::GetPerformanceSelectToLoad (void) const { return m_bPerformanceSelectToLoad; } + + diff --git a/src/config.h b/src/config.h index a316be8..c34cdf5 100644 --- a/src/config.h +++ b/src/config.h @@ -69,6 +69,7 @@ public: unsigned GetChunkSize (void) const; unsigned GetDACI2CAddress (void) const; // 0 for auto probing bool GetChannelsSwapped (void) const; + unsigned GetEngineType (void) const; // MIDI unsigned GetMIDIBaudRate (void) const; @@ -152,6 +153,7 @@ private: unsigned m_nChunkSize; unsigned m_nDACI2CAddress; bool m_bChannelsSwapped; + unsigned m_EngineType; unsigned m_nMIDIBaudRate; std::string m_MIDIThruIn; @@ -212,6 +214,8 @@ private: bool m_bMIDIDumpEnabled; bool m_bProfileEnabled; bool m_bPerformanceSelectToLoad; + + }; #endif diff --git a/src/minidexed.cpp b/src/minidexed.cpp index fafeff8..83de52d 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -93,7 +93,8 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, m_pTG[i] = new CDexedAdapter (CConfig::MaxNotes, pConfig->GetSampleRate ()); assert (m_pTG[i]); - + + m_pTG[i]->setEngineType(pConfig->GetEngineType ()); m_pTG[i]->activate (); } diff --git a/src/minidexed.ini b/src/minidexed.ini index 27d622c..f58b44c 100644 --- a/src/minidexed.ini +++ b/src/minidexed.ini @@ -10,6 +10,8 @@ SampleRate=48000 #ChunkSize=256 DACI2CAddress=0 ChannelsSwapped=0 +# Engine Type ( 1=Modern ; 2=Mark I ; 3=OPL ) +EngineType=1 # MIDI MIDIBaudRate=31250 diff --git a/submod.sh b/submod.sh index e941660..dcdf2af 100755 --- a/submod.sh +++ b/submod.sh @@ -10,4 +10,6 @@ cd - cd circle-stdlib/libs/circle-newlib git checkout 48bf91d # needed for circle ec09d7e cd - - +cd Synth_Dexed/ +git checkout c9f5274 +cd -