diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index a45a19cb..a3669a18 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -4371,6 +4371,7 @@ bool DivEngine::initAudioBackend() { lowLatency=getConfInt("lowLatency",0); metroVol=(float)(getConfInt("metroVol",100))/100.0f; midiOutClock=getConfInt("midiOutClock",0); + midiOutProgramChange = getConfInt("midiOutProgramChange",0); midiOutMode=getConfInt("midiOutMode",DIV_MIDI_MODE_NOTE); if (metroVol<0.0f) metroVol=0.0f; if (metroVol>2.0f) metroVol=2.0f; diff --git a/src/engine/engine.h b/src/engine/engine.h index c15302ba..b76a3e5b 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -365,6 +365,7 @@ class DivEngine { bool systemsRegistered; bool hasLoadedSomething; bool midiOutClock; + bool midiOutProgramChange; int midiOutMode; int softLockCount; int subticks, ticks, curRow, curOrder, prevRow, prevOrder, remainingLoops, totalLoops, lastLoopPos, exportLoopCount, nextSpeed, elapsedBars, elapsedBeats, curSpeed; @@ -1110,6 +1111,7 @@ class DivEngine { systemsRegistered(false), hasLoadedSomething(false), midiOutClock(false), + midiOutProgramChange(false), midiOutMode(DIV_MIDI_MODE_NOTE), softLockCount(0), subticks(0), diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 9176a067..c58763b4 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -278,7 +278,7 @@ int DivEngine::dispatchCmd(DivCommand c) { cmdStream.push_back(c); } - if (output) if (!skipping && output->midiOut!=NULL) { + if (output) if (!skipping && output->midiOut!=NULL && !isChannelMuted(c.chan)) { if (output->midiOut->isDeviceOpen()) { if (midiOutMode==DIV_MIDI_MODE_NOTE) { int scaledVol=(chan[c.chan].volume*127)/MAX(1,chan[c.chan].volMax); @@ -305,7 +305,7 @@ int DivEngine::dispatchCmd(DivCommand c) { chan[c.chan].curMidiNote=-1; break; case DIV_CMD_INSTRUMENT: - if (chan[c.chan].lastIns!=c.value) { + if (chan[c.chan].lastIns!=c.value && midiOutProgramChange) { output->midiOut->send(TAMidiMessage(0xc0|(c.chan&15),c.value,0)); } break; diff --git a/src/gui/gui.h b/src/gui/gui.h index f3f96fb3..9d4ee9fb 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1362,6 +1362,7 @@ class FurnaceGUI { int channelFont; int channelTextCenter; int midiOutClock; + int midiOutProgramChange; int midiOutMode; int maxRecentFile; int centerPattern; @@ -1503,6 +1504,7 @@ class FurnaceGUI { channelFont(1), channelTextCenter(1), midiOutClock(0), + midiOutProgramChange(0), midiOutMode(1), maxRecentFile(10), centerPattern(0), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index c39d03e0..b66e52b6 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -1149,6 +1149,11 @@ void FurnaceGUI::drawSettings() { settings.midiOutClock=midiOutClockB; } + bool midiOutProgramChangeB=settings.midiOutProgramChange; + if (ImGui::Checkbox("Send Program Change",&midiOutProgramChangeB)) { + settings.midiOutProgramChange=midiOutProgramChangeB; + } + ImGui::TreePop(); } } @@ -2608,6 +2613,7 @@ void FurnaceGUI::syncSettings() { settings.channelTextCenter=e->getConfInt("channelTextCenter",1); settings.maxRecentFile=e->getConfInt("maxRecentFile",10); settings.midiOutClock=e->getConfInt("midiOutClock",0); + settings.midiOutProgramChange=e->getConfInt("midiOutProgramChange",0); settings.midiOutMode=e->getConfInt("midiOutMode",1); settings.centerPattern=e->getConfInt("centerPattern",0); settings.ordersCursor=e->getConfInt("ordersCursor",1); @@ -2726,6 +2732,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.channelTextCenter,0,1); clampSetting(settings.maxRecentFile,0,30); clampSetting(settings.midiOutClock,0,1); + clampSetting(settings.midiOutProgramChange,0,1); clampSetting(settings.midiOutMode,0,2); clampSetting(settings.centerPattern,0,1); clampSetting(settings.ordersCursor,0,1); @@ -2935,6 +2942,7 @@ void FurnaceGUI::commitSettings() { e->setConf("channelTextCenter",settings.channelTextCenter); e->setConf("maxRecentFile",settings.maxRecentFile); e->setConf("midiOutClock",settings.midiOutClock); + e->setConf("midiOutProgramChange",settings.midiOutProgramChange); e->setConf("midiOutMode",settings.midiOutMode); e->setConf("centerPattern",settings.centerPattern); e->setConf("ordersCursor",settings.ordersCursor);