init support for setting program change

This commit is contained in:
KMoene 2023-03-22 00:51:54 -04:00
parent 5af3804195
commit 913d22fd57
5 changed files with 15 additions and 2 deletions

View File

@ -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;

View File

@ -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),

View File

@ -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;

View File

@ -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),

View File

@ -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);