mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 06:53:01 +00:00
OPL: fix fixed frequency drums
This commit is contained in:
parent
5a0c715ba0
commit
34d0925569
3 changed files with 8 additions and 5 deletions
1
TODO.md
1
TODO.md
|
@ -1,6 +1,5 @@
|
||||||
# to-do for 0.6pre1
|
# to-do for 0.6pre1
|
||||||
|
|
||||||
- fix an OPLL/OPL fixed drum freq regression caused by full linear pitch
|
|
||||||
- piano/input pad
|
- piano/input pad
|
||||||
- note input via piano
|
- note input via piano
|
||||||
- input pad
|
- input pad
|
||||||
|
|
|
@ -595,6 +595,7 @@ void DivPlatformOPL::tick(bool sysTick) {
|
||||||
for (int i=0; i<totalChans; i++) {
|
for (int i=0; i<totalChans; i++) {
|
||||||
if (chan[i].freqChanged) {
|
if (chan[i].freqChanged) {
|
||||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq),chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq),chan[i].pitch2,chipClock,CHIP_FREQBASE);
|
||||||
|
if (chan[i].fixedFreq>0) chan[i].freq=chan[i].fixedFreq;
|
||||||
if (chan[i].freq>131071) chan[i].freq=131071;
|
if (chan[i].freq>131071) chan[i].freq=131071;
|
||||||
int freqt=toFreq(chan[i].freq)+chan[i].pitch2;
|
int freqt=toFreq(chan[i].freq)+chan[i].pitch2;
|
||||||
chan[i].freqH=freqt>>8;
|
chan[i].freqH=freqt>>8;
|
||||||
|
@ -844,16 +845,18 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
if (c.value!=DIV_NOTE_NULL) {
|
if (c.value!=DIV_NOTE_NULL) {
|
||||||
if (c.chan>=melodicChans && chan[c.chan].state.opllPreset==16 && chan[c.chan].state.fixedDrums) { // drums
|
if (c.chan>=melodicChans && chan[c.chan].state.opllPreset==16 && chan[c.chan].state.fixedDrums) { // drums
|
||||||
if (c.chan==melodicChans) {
|
if (c.chan==melodicChans) {
|
||||||
chan[c.chan].baseFreq=(chan[c.chan].state.kickFreq&1023)<<(chan[c.chan].state.kickFreq>>10);
|
chan[c.chan].fixedFreq=(chan[c.chan].state.kickFreq&1023)<<(chan[c.chan].state.kickFreq>>10);
|
||||||
} else if (c.chan==melodicChans+1 || c.chan==melodicChans+4) {
|
} else if (c.chan==melodicChans+1 || c.chan==melodicChans+4) {
|
||||||
chan[c.chan].baseFreq=(chan[c.chan].state.snareHatFreq&1023)<<(chan[c.chan].state.snareHatFreq>>10);
|
chan[c.chan].fixedFreq=(chan[c.chan].state.snareHatFreq&1023)<<(chan[c.chan].state.snareHatFreq>>10);
|
||||||
} else if (c.chan==melodicChans+2 || c.chan==melodicChans+3) {
|
} else if (c.chan==melodicChans+2 || c.chan==melodicChans+3) {
|
||||||
chan[c.chan].baseFreq=(chan[c.chan].state.tomTopFreq&1023)<<(chan[c.chan].state.tomTopFreq>>10);
|
chan[c.chan].fixedFreq=(chan[c.chan].state.tomTopFreq&1023)<<(chan[c.chan].state.tomTopFreq>>10);
|
||||||
} else {
|
} else {
|
||||||
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
|
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
|
||||||
|
chan[c.chan].fixedFreq=0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
|
chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value);
|
||||||
|
chan[c.chan].fixedFreq=0;
|
||||||
}
|
}
|
||||||
chan[c.chan].note=c.value;
|
chan[c.chan].note=c.value;
|
||||||
chan[c.chan].freqChanged=true;
|
chan[c.chan].freqChanged=true;
|
||||||
|
|
|
@ -40,7 +40,7 @@ class DivPlatformOPL: public DivDispatch {
|
||||||
DivInstrumentFM state;
|
DivInstrumentFM state;
|
||||||
DivMacroInt std;
|
DivMacroInt std;
|
||||||
unsigned char freqH, freqL;
|
unsigned char freqH, freqL;
|
||||||
int freq, baseFreq, pitch, pitch2, note, ins, sample;
|
int freq, baseFreq, pitch, pitch2, note, ins, sample, fixedFreq;
|
||||||
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnacePCM, inPorta, fourOp, hardReset;
|
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnacePCM, inPorta, fourOp, hardReset;
|
||||||
int vol, outVol;
|
int vol, outVol;
|
||||||
unsigned char pan;
|
unsigned char pan;
|
||||||
|
@ -58,6 +58,7 @@ class DivPlatformOPL: public DivDispatch {
|
||||||
note(0),
|
note(0),
|
||||||
ins(-1),
|
ins(-1),
|
||||||
sample(-1),
|
sample(-1),
|
||||||
|
fixedFreq(0),
|
||||||
active(false),
|
active(false),
|
||||||
insChanged(true),
|
insChanged(true),
|
||||||
freqChanged(false),
|
freqChanged(false),
|
||||||
|
|
Loading…
Reference in a new issue