OPLL: add option to apply fixed frequency to all d

issue #289
This commit is contained in:
tildearrow 2023-08-10 00:15:44 -05:00
parent 805c3ba7ac
commit d5776e02bb
3 changed files with 29 additions and 11 deletions

View file

@ -468,16 +468,28 @@ int DivPlatformOPLL::dispatch(DivCommand c) {
drumActivated[c.chan-6]=true; drumActivated[c.chan-6]=true;
if (c.value!=DIV_NOTE_NULL) { if (c.value!=DIV_NOTE_NULL) {
if (chan[c.chan].state.opllPreset==16 && chan[c.chan].state.fixedDrums) { if (chan[c.chan].state.opllPreset==16 && chan[c.chan].state.fixedDrums) {
switch (c.chan) { if (fixedAll) {
case 6: chan[6].fixedFreq=(chan[c.chan].state.kickFreq&511)<<(chan[c.chan].state.kickFreq>>9);
chan[c.chan].fixedFreq=(chan[c.chan].state.kickFreq&511)<<(chan[c.chan].state.kickFreq>>9); chan[7].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9);
break; chan[8].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9);
case 7: case 10: chan[9].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9);
chan[c.chan].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9); chan[10].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9);
break;
case 8: case 9: chan[7].freqChanged=true;
chan[c.chan].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9); chan[8].freqChanged=true;
break; chan[9].freqChanged=true;
} else {
switch (c.chan) {
case 6:
chan[c.chan].fixedFreq=(chan[c.chan].state.kickFreq&511)<<(chan[c.chan].state.kickFreq>>9);
break;
case 7: case 10:
chan[c.chan].fixedFreq=(chan[c.chan].state.snareHatFreq&511)<<(chan[c.chan].state.snareHatFreq>>9);
break;
case 8: case 9:
chan[c.chan].fixedFreq=(chan[c.chan].state.tomTopFreq&511)<<(chan[c.chan].state.tomTopFreq>>9);
break;
}
} }
} else { } else {
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value); chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
@ -1076,6 +1088,7 @@ void DivPlatformOPLL::setFlags(const DivConfig& flags) {
oscBuf[i]->rate=rate/2; oscBuf[i]->rate=rate/2;
} }
noTopHatFreq=flags.getBool("noTopHatFreq",false); noTopHatFreq=flags.getBool("noTopHatFreq",false);
fixedAll=flags.getBool("fixedAll",false);
} }
int DivPlatformOPLL::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { int DivPlatformOPLL::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {

View file

@ -70,7 +70,7 @@ class DivPlatformOPLL: public DivDispatch {
bool useYMFM; bool useYMFM;
bool crapDrums; bool crapDrums;
bool properDrums, properDrumsSys, noTopHatFreq; bool properDrums, properDrumsSys, noTopHatFreq, fixedAll;
bool vrc7; bool vrc7;
unsigned char patchSet; unsigned char patchSet;

View file

@ -395,6 +395,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
int clockSel=flags.getInt("clockSel",0); int clockSel=flags.getInt("clockSel",0);
int patchSet=flags.getInt("patchSet",0); int patchSet=flags.getInt("patchSet",0);
bool noTopHatFreq=flags.getBool("noTopHatFreq",false); bool noTopHatFreq=flags.getBool("noTopHatFreq",false);
bool fixedAll=flags.getBool("fixedAll",false);
ImGui::Text("Clock rate:"); ImGui::Text("Clock rate:");
ImGui::Indent(); ImGui::Indent();
@ -441,6 +442,9 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
if (ImGui::Checkbox("Ignore top/hi-hat frequency changes",&noTopHatFreq)) { if (ImGui::Checkbox("Ignore top/hi-hat frequency changes",&noTopHatFreq)) {
altered=true; altered=true;
} }
if (ImGui::Checkbox("Apply fixed frequency to all drums at once",&fixedAll)) {
altered=true;
}
} }
if (altered) { if (altered) {
@ -450,6 +454,7 @@ bool FurnaceGUI::drawSysConf(int chan, DivSystem type, DivConfig& flags, bool mo
flags.set("patchSet",patchSet); flags.set("patchSet",patchSet);
} }
flags.set("noTopHatFreq",noTopHatFreq); flags.set("noTopHatFreq",noTopHatFreq);
flags.set("fixedAll",fixedAll);
}); });
} }
break; break;