better default instrument for OPL/OPLL

no longer silence
This commit is contained in:
tildearrow 2022-04-21 02:24:06 -05:00
parent 73a4552e09
commit 79fa8f1d02
37 changed files with 128 additions and 98 deletions

View file

@ -738,8 +738,22 @@ String DivEngine::getWarnings() {
return warnings;
}
DivInstrument* DivEngine::getIns(int index) {
if (index<0 || index>=song.insLen) return &song.nullIns;
DivInstrument* DivEngine::getIns(int index, DivInstrumentType fallbackType) {
if (index<0 || index>=song.insLen) {
switch (fallbackType) {
case DIV_INS_OPLL:
logV("returning the OPLL null instrument");
return &song.nullInsOPLL;
break;
case DIV_INS_OPL:
logV("returning the OPL null instrument");
return &song.nullInsOPL;
break;
default:
break;
}
return &song.nullIns;
}
return song.ins[index];
}
@ -1970,7 +1984,7 @@ void DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
}
do {
if ((ins==-1 || getChannelType(finalChan)==4 || getPreferInsType(finalChan)==getIns(ins)->type || getIns(ins)->type==DIV_INS_AMIGA) && chan[finalChan].midiNote==-1) {
if ((ins<0 || ins>=song.insLen || getChannelType(finalChan)==4 || getPreferInsType(finalChan)==getIns(ins)->type || getIns(ins)->type==DIV_INS_AMIGA) && chan[finalChan].midiNote==-1) {
chan[finalChan].midiNote=note;
pendingNotes.push(DivNoteEvent(finalChan,ins,note,vol,true));
break;

View file

@ -19,6 +19,7 @@
#ifndef _ENGINE_H
#define _ENGINE_H
#include "instrument.h"
#include "song.h"
#include "dispatch.h"
#include "dataErrors.h"
@ -309,7 +310,7 @@ class DivEngine {
void runExportThread();
void nextBuf(float** in, float** out, int inChans, int outChans, unsigned int size);
DivInstrument* getIns(int index);
DivInstrument* getIns(int index, DivInstrumentType fallbackType=DIV_INS_FM);
DivWavetable* getWave(int index);
DivSample* getSample(int index);
// start fresh

View file

@ -206,7 +206,7 @@ void DivPlatformAmiga::tick(bool sysTick) {
}
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins);
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_AMIGA);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].freq>4095) chan[i].freq=4095;
if (chan[i].freq<0) chan[i].freq=0;
@ -224,7 +224,7 @@ void DivPlatformAmiga::tick(bool sysTick) {
int DivPlatformAmiga::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
double off=1.0;
if (ins->amiga.useWave) {
chan[c.chan].useWave=true;
@ -314,7 +314,7 @@ int DivPlatformAmiga::dispatch(DivCommand c) {
chan[c.chan].ws.changeWave1(chan[c.chan].wave);
break;
case DIV_CMD_NOTE_PORTA: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
chan[c.chan].sample=ins->amiga.initSample;
double off=1.0;
if (!chan[c.chan].useWave && chan[c.chan].sample>=0 && chan[c.chan].sample<parent->song.sampleLen) {
@ -364,7 +364,7 @@ int DivPlatformAmiga::dispatch(DivCommand c) {
}
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -446,7 +446,7 @@ void DivPlatformArcade::muteChannel(int ch, bool mute) {
int DivPlatformArcade::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_FM);
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;

View file

@ -294,7 +294,7 @@ void DivPlatformAY8910::tick(bool sysTick) {
int DivPlatformAY8910::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AY);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
chan[c.chan].freqChanged=true;
@ -457,7 +457,7 @@ int DivPlatformAY8910::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_AY));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -318,7 +318,7 @@ void DivPlatformAY8930::tick(bool sysTick) {
int DivPlatformAY8930::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AY8930);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
chan[c.chan].freqChanged=true;
@ -482,7 +482,7 @@ int DivPlatformAY8930::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_AY8930));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -119,7 +119,7 @@ void DivPlatformBubSysWSG::tick(bool sysTick) {
}
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins);
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_SCC);
chan[i].freq=0x1000-parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>4095) chan[i].freq=4095;
@ -142,7 +142,7 @@ void DivPlatformBubSysWSG::tick(bool sysTick) {
int DivPlatformBubSysWSG::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_SCC);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
chan[c.chan].freqChanged=true;
@ -228,7 +228,7 @@ int DivPlatformBubSysWSG::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_SCC));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -126,7 +126,7 @@ void DivPlatformC64::tick(bool sysTick) {
for (int i=0; i<3; i++) {
chan[i].std.next();
if (chan[i].std.vol.had) {
DivInstrument* ins=parent->getIns(chan[i].ins);
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_C64);
if (ins->c64.volIsCutoff) {
if (ins->c64.filterIsAbs) {
filtCut=MIN(2047,chan[i].std.vol.val);
@ -157,7 +157,7 @@ void DivPlatformC64::tick(bool sysTick) {
}
}
if (chan[i].std.duty.had) {
DivInstrument* ins=parent->getIns(chan[i].ins);
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_C64);
if (ins->c64.dutyIsAbs) {
chan[i].duty=chan[i].std.duty.val;
} else {
@ -223,7 +223,7 @@ void DivPlatformC64::tick(bool sysTick) {
int DivPlatformC64::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_C64);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
chan[c.chan].freqChanged=true;
@ -345,7 +345,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta || !chan[c.chan].inPorta) {
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_C64));
chan[c.chan].keyOn=true;
}
}
@ -383,7 +383,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
break;
case DIV_CMD_C64_FILTER_RESET:
if (c.value&15) {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_C64);
if (ins->c64.initFilter) {
filtCut=ins->c64.cut;
updateFilter();
@ -393,7 +393,7 @@ int DivPlatformC64::dispatch(DivCommand c) {
break;
case DIV_CMD_C64_DUTY_RESET:
if (c.value&15) {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_C64);
chan[c.chan].duty=ins->c64.duty;
rWrite(c.chan*7+2,chan[c.chan].duty&0xff);
rWrite(c.chan*7+3,chan[c.chan].duty>>8);

View file

@ -198,7 +198,7 @@ void DivPlatformFDS::tick(bool sysTick) {
int DivPlatformFDS::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_FDS);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
chan[c.chan].freqChanged=true;
@ -358,7 +358,7 @@ int DivPlatformFDS::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_FDS));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -176,7 +176,7 @@ void DivPlatformGB::tick(bool sysTick) {
}
if (chan[i].std.duty.had) {
chan[i].duty=chan[i].std.duty.val;
DivInstrument* ins=parent->getIns(chan[i].ins);
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_GB);
if (i!=2) {
rWrite(16+i*5+1,((chan[i].duty&3)<<6)|(63-(ins->gb.soundLen&63)));
} else {
@ -220,7 +220,7 @@ void DivPlatformGB::tick(bool sysTick) {
}
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
DivInstrument* ins=parent->getIns(chan[i].ins);
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_GB);
if (i==3) { // noise
int ntPos=chan[i].baseFreq;
if (ntPos<0) ntPos=0;
@ -269,7 +269,7 @@ void DivPlatformGB::muteChannel(int ch, bool mute) {
int DivPlatformGB::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_GB);
if (c.value!=DIV_NOTE_NULL) {
if (c.chan==3) { // noise
chan[c.chan].baseFreq=c.value;
@ -306,7 +306,7 @@ int DivPlatformGB::dispatch(DivCommand c) {
chan[c.chan].ins=c.value;
chan[c.chan].insChanged=true;
if (c.chan!=2) {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_GB);
chan[c.chan].vol=ins->gb.envVol;
if (parent->song.gbInsAffectsEnvelope) {
rWrite(16+c.chan*5+2,((chan[c.chan].vol<<4))|(ins->gb.envLen&7)|((ins->gb.envDir&1)<<3));
@ -360,7 +360,7 @@ int DivPlatformGB::dispatch(DivCommand c) {
chan[c.chan].duty=c.value;
if (c.chan!=2) {
chan[c.chan].freqChanged=true;
rWrite(16+c.chan*5+1,((chan[c.chan].duty&3)<<6)|(63-(parent->getIns(chan[c.chan].ins)->gb.soundLen&63)));
rWrite(16+c.chan*5+1,((chan[c.chan].duty&3)<<6)|(63-(parent->getIns(chan[c.chan].ins,DIV_INS_GB)->gb.soundLen&63)));
}
break;
case DIV_CMD_PANNING: {
@ -379,7 +379,7 @@ int DivPlatformGB::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_GB));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -484,7 +484,7 @@ void DivPlatformGenesis::muteChannel(int ch, bool mute) {
int DivPlatformGenesis::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_FM);
if (c.chan==5) {
if (ins->type==DIV_INS_AMIGA) {
dacMode=1;

View file

@ -37,7 +37,7 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) {
int ordch=orderedOps[ch];
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
if (opChan[ch].insChanged) {
chan[2].state.alg=ins->fm.alg;

View file

@ -224,7 +224,7 @@ int DivPlatformLynx::dispatch(DivCommand c) {
}
chan[c.chan].active=true;
WRITE_VOLUME(c.chan,(isMuted[c.chan]?0:(chan[c.chan].vol&127)));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_MIKEY));
break;
case DIV_CMD_NOTE_OFF:
chan[c.chan].active=false;
@ -241,7 +241,7 @@ int DivPlatformLynx::dispatch(DivCommand c) {
break;
case DIV_CMD_INSTRUMENT:
chan[c.chan].ins=c.value;
//chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
//chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_MIKEY));
break;
case DIV_CMD_VOLUME:
if (chan[c.chan].vol!=c.value) {
@ -297,7 +297,7 @@ int DivPlatformLynx::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_MIKEY));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -177,7 +177,7 @@ int DivPlatformMMC5::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON:
if (c.chan==2) { // PCM
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_STD);
if (ins->type==DIV_INS_AMIGA) {
dacSample=ins->amiga.initSample;
if (dacSample<0 || dacSample>=parent->song.sampleLen) {
@ -227,7 +227,7 @@ int DivPlatformMMC5::dispatch(DivCommand c) {
}
chan[c.chan].active=true;
chan[c.chan].keyOn=true;
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_STD));
rWrite(0x5000+c.chan*4,0x30|chan[c.chan].vol|((chan[c.chan].duty&3)<<6));
break;
case DIV_CMD_NOTE_OFF:
@ -305,7 +305,7 @@ int DivPlatformMMC5::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_STD));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -374,7 +374,7 @@ void DivPlatformN163::tick(bool sysTick) {
int DivPlatformN163::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_N163);
if (chan[c.chan].insChanged) {
chan[c.chan].wave=ins->n163.wave;
chan[c.chan].ws.changeWave1(chan[c.chan].wave);
@ -546,7 +546,7 @@ int DivPlatformN163::dispatch(DivCommand c) {
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) {
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_N163));
chan[c.chan].keyOn=true;
}
}

View file

@ -271,7 +271,7 @@ int DivPlatformNES::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON:
if (c.chan==4) { // PCM
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_STD);
if (ins->type==DIV_INS_AMIGA) {
dacSample=ins->amiga.initSample;
if (dacSample<0 || dacSample>=parent->song.sampleLen) {
@ -325,7 +325,7 @@ int DivPlatformNES::dispatch(DivCommand c) {
}
chan[c.chan].active=true;
chan[c.chan].keyOn=true;
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_STD));
if (c.chan==2) {
rWrite(0x4000+c.chan*4,0xff);
} else {
@ -428,7 +428,7 @@ int DivPlatformNES::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_STD));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -535,7 +535,7 @@ int DivPlatformOPL::dispatch(DivCommand c) {
}
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_OPL);
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;

View file

@ -365,7 +365,7 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
if (c.chan>=9 && !properDrums) return 0;
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_OPLL);
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;
}

View file

@ -216,7 +216,7 @@ void DivPlatformPCE::tick(bool sysTick) {
}
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins);
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_PCE);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true)+chan[i].std.pitch.val;
if (chan[i].furnaceDac) {
double off=1.0;
@ -251,7 +251,7 @@ void DivPlatformPCE::tick(bool sysTick) {
int DivPlatformPCE::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_PCE);
if (ins->type==DIV_INS_AMIGA) {
chan[c.chan].pcm=true;
} else if (chan[c.chan].furnaceDac) {
@ -429,7 +429,7 @@ int DivPlatformPCE::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_PCE));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -217,7 +217,7 @@ int DivPlatformPCSpeaker::dispatch(DivCommand c) {
}
chan[c.chan].active=true;
chan[c.chan].keyOn=true;
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_BEEPER));
break;
case DIV_CMD_NOTE_OFF:
chan[c.chan].active=false;
@ -282,7 +282,7 @@ int DivPlatformPCSpeaker::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_BEEPER));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -138,7 +138,7 @@ void DivPlatformPET::tick(bool sysTick) {
int DivPlatformPET::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan.ins);
DivInstrument* ins=parent->getIns(chan.ins,DIV_INS_PET);
if (c.value!=DIV_NOTE_NULL) {
chan.baseFreq=NOTE_PERIODIC(c.value);
chan.freqChanged=true;
@ -213,7 +213,7 @@ int DivPlatformPET::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan.active && c.value2) {
if (parent->song.resetMacroOnPorta) chan.std.init(parent->getIns(chan.ins));
if (parent->song.resetMacroOnPorta) chan.std.init(parent->getIns(chan.ins,DIV_INS_PET));
}
chan.inPorta=c.value;
break;

View file

@ -330,7 +330,7 @@ void DivPlatformQSound::tick(bool sysTick) {
chan[i].freqChanged=true;
}
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
//DivInstrument* ins=parent->getIns(chan[i].ins);
//DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_AMIGA);
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false)+chan[i].std.pitch.val;
if (chan[i].freq>0xffff) chan[i].freq=0xffff;
if (chan[i].keyOn) {
@ -363,7 +363,7 @@ void DivPlatformQSound::tick(bool sysTick) {
int DivPlatformQSound::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
chan[c.chan].sample=ins->amiga.initSample;
double off=1.0;
if (chan[c.chan].sample>=0 && chan[c.chan].sample<parent->song.sampleLen) {
@ -487,7 +487,7 @@ int DivPlatformQSound::dispatch(DivCommand c) {
}
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -249,7 +249,7 @@ void DivPlatformSAA1099::tick(bool sysTick) {
int DivPlatformSAA1099::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_SAA1099);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
chan[c.chan].freqChanged=true;
@ -356,7 +356,7 @@ int DivPlatformSAA1099::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_SAA1099));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -149,7 +149,7 @@ void DivPlatformSegaPCM::muteChannel(int ch, bool mute) {
int DivPlatformSegaPCM::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
if (skipRegisterWrites) break;
if (ins->type==DIV_INS_AMIGA) {
chan[c.chan].pcm.sample=ins->amiga.initSample;

View file

@ -175,7 +175,7 @@ int DivPlatformSMS::dispatch(DivCommand c) {
}
chan[c.chan].active=true;
rWrite(0x90|c.chan<<5|(isMuted[c.chan]?15:(15-(chan[c.chan].vol&15))));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_STD));
break;
case DIV_CMD_NOTE_OFF:
chan[c.chan].active=false;
@ -188,7 +188,7 @@ int DivPlatformSMS::dispatch(DivCommand c) {
break;
case DIV_CMD_INSTRUMENT:
chan[c.chan].ins=c.value;
//chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
//chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_STD));
break;
case DIV_CMD_VOLUME:
if (chan[c.chan].vol!=c.value) {
@ -244,7 +244,7 @@ int DivPlatformSMS::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_STD));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -147,7 +147,7 @@ void DivPlatformSwan::tick(bool sysTick) {
chan[i].std.next();
if (chan[i].std.vol.had) {
int env=chan[i].std.vol.val;
if(parent->getIns(chan[i].ins)->type==DIV_INS_AMIGA) {
if(parent->getIns(chan[i].ins,DIV_INS_SWAN)->type==DIV_INS_AMIGA) {
env=MIN(env/4,15);
}
calcAndWriteOutVol(i,env);
@ -240,7 +240,7 @@ void DivPlatformSwan::tick(bool sysTick) {
int DivPlatformSwan::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_SWAN);
if (c.chan==1) {
if (ins->type==DIV_INS_AMIGA) {
pcm=true;
@ -415,7 +415,7 @@ int DivPlatformSwan::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_SWAN));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -154,7 +154,7 @@ void DivPlatformTIA::tick(bool sysTick) {
int DivPlatformTIA::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_TIA);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=c.value<<8;
chan[c.chan].freqChanged=true;
@ -248,7 +248,7 @@ int DivPlatformTIA::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_TIA));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -424,7 +424,7 @@ void DivPlatformTX81Z::muteChannel(int ch, bool mute) {
int DivPlatformTX81Z::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_OPZ);
if (chan[c.chan].insChanged) {
chan[c.chan].state=ins->fm;

View file

@ -237,7 +237,7 @@ int DivPlatformVERA::dispatch(DivCommand c) {
if(c.chan<16) {
rWriteLo(c.chan,2,chan[c.chan].vol)
} else {
chan[16].pcm.sample=parent->getIns(chan[16].ins)->amiga.initSample;
chan[16].pcm.sample=parent->getIns(chan[16].ins,DIV_INS_VERA)->amiga.initSample;
if (chan[16].pcm.sample<0 || chan[16].pcm.sample>=parent->song.sampleLen) {
chan[16].pcm.sample=-1;
}
@ -259,7 +259,7 @@ int DivPlatformVERA::dispatch(DivCommand c) {
chan[c.chan].note=c.value;
}
chan[c.chan].active=true;
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_VERA));
break;
case DIV_CMD_NOTE_OFF:
chan[c.chan].active=false;
@ -327,7 +327,7 @@ int DivPlatformVERA::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_VERA));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -158,7 +158,7 @@ void DivPlatformVIC20::tick(bool sysTick) {
int DivPlatformVIC20::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_VIC);
if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=NOTE_PERIODIC(c.value);
chan[c.chan].freqChanged=true;
@ -232,7 +232,7 @@ int DivPlatformVIC20::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_VIC));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -220,7 +220,7 @@ int DivPlatformVRC6::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON:
if (c.chan!=2) { // pulse wave
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_VRC6);
if (ins->type==DIV_INS_AMIGA) {
chan[c.chan].pcm=true;
} else if (chan[c.chan].furnaceDac) {
@ -284,7 +284,7 @@ int DivPlatformVRC6::dispatch(DivCommand c) {
}
chan[c.chan].active=true;
chan[c.chan].keyOn=true;
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_VRC6));
if (!isMuted[c.chan]) {
if (c.chan==2) { // sawtooth
chWrite(c.chan,0,chan[c.chan].vol);
@ -380,7 +380,7 @@ int DivPlatformVRC6::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_VRC6));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -525,7 +525,7 @@ int DivPlatformX1_010::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
chWrite(c.chan,0,0); // reset previous note
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_X1_010);
if ((ins->type==DIV_INS_AMIGA) || chan[c.chan].pcm) {
if (ins->type==DIV_INS_AMIGA) {
chan[c.chan].furnacePCM=true;
@ -703,7 +703,7 @@ int DivPlatformX1_010::dispatch(DivCommand c) {
break;
case DIV_CMD_PRE_PORTA:
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_X1_010));
}
chan[c.chan].inPorta=c.value;
break;

View file

@ -635,7 +635,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
if (c.chan>12) { // ADPCM-B
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_FM);
if (ins->type==DIV_INS_AMIGA) {
chan[c.chan].furnacePCM=true;
} else {
@ -718,7 +718,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
immWrite(0x100,0x00|(1<<(c.chan-7)));
break;
}
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_FM);
chan[c.chan].std.init(ins);
if (c.chan<4) {
if (!chan[c.chan].std.vol.will) {
@ -981,7 +981,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) {
case DIV_CMD_PRE_PORTA:
if (c.chan>3) {
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_FM));
}
}
chan[c.chan].inPorta=c.value;

View file

@ -698,7 +698,7 @@ int DivPlatformYM2610B::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
if (c.chan>14) { // ADPCM-B
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_FM);
if (ins->type==DIV_INS_AMIGA) {
chan[c.chan].furnacePCM=true;
} else {
@ -781,7 +781,7 @@ int DivPlatformYM2610B::dispatch(DivCommand c) {
immWrite(0x100,0x00|(1<<(c.chan-9)));
break;
}
DivInstrument* ins=parent->getIns(chan[c.chan].ins);
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_FM);
chan[c.chan].std.init(ins);
if (c.chan<6) {
if (!chan[c.chan].std.vol.will) {
@ -1044,7 +1044,7 @@ int DivPlatformYM2610B::dispatch(DivCommand c) {
case DIV_CMD_PRE_PORTA:
if (c.chan>5) {
if (chan[c.chan].active && c.value2) {
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins));
if (parent->song.resetMacroOnPorta) chan[c.chan].std.init(parent->getIns(chan[c.chan].ins,DIV_INS_FM));
}
}
chan[c.chan].inPorta=c.value;

View file

@ -36,7 +36,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
int ordch=orderedOps[ch];
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=ins->fm.op[ordch];
@ -78,7 +78,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
break;
case DIV_CMD_VOLUME: {
opChan[ch].vol=c.value;
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=ins->fm.op[ordch];
if (isOpMuted[ch]) {
@ -104,7 +104,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
} else {
opChan[ch].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1);
}
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
if (parent->song.sharedExtStat) {
for (int i=0; i<4; i++) {
if (ch==i) continue;
@ -159,14 +159,14 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
}
case DIV_CMD_FM_MULT: { // TODO
unsigned short baseAddr=chanOffs[2]|opOffs[orderedOps[c.value]];
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
DivInstrumentFM::Operator op=ins->fm.op[orderedOps[c.value]];
rWrite(baseAddr+0x30,(c.value2&15)|(dtTable[op.dt&7]<<4));
break;
}
case DIV_CMD_FM_TL: { // TODO
unsigned short baseAddr=chanOffs[2]|opOffs[orderedOps[c.value]];
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
if (isOutput[ins->fm.alg][c.value]) {
rWrite(baseAddr+0x40,127-(((127-c.value2)*(opChan[ch].vol&0x7f))/127));
} else {
@ -175,7 +175,7 @@ int DivPlatformYM2610BExt::dispatch(DivCommand c) {
break;
}
case DIV_CMD_FM_AR: {
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
if (c.value<0) {
for (int i=0; i<4; i++) {
DivInstrumentFM::Operator op=ins->fm.op[i];
@ -268,7 +268,7 @@ void DivPlatformYM2610BExt::muteChannel(int ch, bool mute) {
isOpMuted[ch-2]=mute;
int ordch=orderedOps[ch-2];
DivInstrument* ins=parent->getIns(opChan[ch-2].ins);
DivInstrument* ins=parent->getIns(opChan[ch-2].ins,DIV_INS_FM);
unsigned short baseAddr=chanOffs[2]|opOffs[ordch];
DivInstrumentFM::Operator op=ins->fm.op[ordch];
if (isOpMuted[ch-2]) {

View file

@ -36,7 +36,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
int ordch=orderedOps[ch];
switch (c.cmd) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
unsigned short baseAddr=chanOffs[1]|opOffs[ordch];
DivInstrumentFM::Operator op=ins->fm.op[ordch];
@ -78,7 +78,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
break;
case DIV_CMD_VOLUME: {
opChan[ch].vol=c.value;
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
unsigned short baseAddr=chanOffs[1]|opOffs[ordch];
DivInstrumentFM::Operator op=ins->fm.op[ordch];
if (isOpMuted[ch]) {
@ -104,7 +104,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
} else {
opChan[ch].pan=((c.value&15)>0)|(((c.value>>4)>0)<<1);
}
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
if (parent->song.sharedExtStat) {
for (int i=0; i<4; i++) {
if (ch==i) continue;
@ -159,14 +159,14 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
}
case DIV_CMD_FM_MULT: { // TODO
unsigned short baseAddr=chanOffs[1]|opOffs[orderedOps[c.value]];
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
DivInstrumentFM::Operator op=ins->fm.op[orderedOps[c.value]];
rWrite(baseAddr+0x30,(c.value2&15)|(dtTable[op.dt&7]<<4));
break;
}
case DIV_CMD_FM_TL: { // TODO
unsigned short baseAddr=chanOffs[1]|opOffs[orderedOps[c.value]];
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
if (isOutput[ins->fm.alg][c.value]) {
rWrite(baseAddr+0x40,127-(((127-c.value2)*(opChan[ch].vol&0x7f))/127));
} else {
@ -175,7 +175,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) {
break;
}
case DIV_CMD_FM_AR: {
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
if (c.value<0) {
for (int i=0; i<4; i++) {
DivInstrumentFM::Operator op=ins->fm.op[i];
@ -268,7 +268,7 @@ void DivPlatformYM2610Ext::muteChannel(int ch, bool mute) {
isOpMuted[ch-1]=mute;
int ordch=orderedOps[ch-1];
DivInstrument* ins=parent->getIns(opChan[ch].ins);
DivInstrument* ins=parent->getIns(opChan[ch].ins,DIV_INS_FM);
unsigned short baseAddr=chanOffs[1]|opOffs[ordch];
DivInstrumentFM::Operator op=ins->fm.op[ordch];
if (isOpMuted[ch]) {

View file

@ -334,7 +334,7 @@ struct DivSong {
bool chanShow[DIV_MAX_CHANS];
bool chanCollapse[DIV_MAX_CHANS];
DivInstrument nullIns;
DivInstrument nullIns, nullInsOPLL, nullInsOPL;
DivWavetable nullWave;
DivSample nullSample;
@ -419,6 +419,21 @@ struct DivSong {
}
system[0]=DIV_SYSTEM_YM2612;
system[1]=DIV_SYSTEM_SMS;
nullInsOPLL.fm.opllPreset=7;
nullInsOPLL.fm.op[1].tl=0;
nullInsOPL.fm.alg=0;
nullInsOPL.fm.fb=7;
nullInsOPL.fm.op[0].dr=2;
nullInsOPL.fm.op[0].rr=7;
nullInsOPL.fm.op[0].tl=22;
nullInsOPL.fm.op[0].ksl=1;
nullInsOPL.fm.op[0].mult=3;
nullInsOPL.fm.op[1].tl=0;
nullInsOPL.fm.op[1].dr=3;
nullInsOPL.fm.op[1].rr=12;
nullInsOPL.fm.op[1].mult=1;
}
};