Skip to content

Commit

Permalink
Added configuration needed to choose between Modern, OPL and Mark I e…
Browse files Browse the repository at this point in the history
…ngines (#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

#403 (comment)

* Update Synth_Dexed to a908f78

#358 (reply in thread)

* 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

#526 (comment)

---------

Co-authored-by: probonopd <probonopd@users.noreply.github.com>
  • Loading branch information
donluca and probonopd committed Aug 10, 2023
1 parent 571816f commit 8a34880
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Synth_Dexed.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
17 changes: 17 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#include "config.h"
#include "../Synth_Dexed/src/dexed.h"

CConfig::CConfig (FATFS *pFileSystem)
: m_Properties ("minidexed.ini", pFileSystem)
Expand All @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -400,3 +415,5 @@ bool CConfig::GetPerformanceSelectToLoad (void) const
{
return m_bPerformanceSelectToLoad;
}


4 changes: 4 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class CConfig // Configuration for MiniDexed
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;
Expand Down Expand Up @@ -152,6 +153,7 @@ class CConfig // Configuration for MiniDexed
unsigned m_nChunkSize;
unsigned m_nDACI2CAddress;
bool m_bChannelsSwapped;
unsigned m_EngineType;

unsigned m_nMIDIBaudRate;
std::string m_MIDIThruIn;
Expand Down Expand Up @@ -212,6 +214,8 @@ class CConfig // Configuration for MiniDexed
bool m_bMIDIDumpEnabled;
bool m_bProfileEnabled;
bool m_bPerformanceSelectToLoad;


};

#endif
3 changes: 2 additions & 1 deletion src/minidexed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
}

Expand Down
2 changes: 2 additions & 0 deletions src/minidexed.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion submod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -

0 comments on commit 8a34880

Please sign in to comment.