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;