OPN: apply max freq limit

This commit is contained in:
tildearrow 2022-02-17 22:07:20 -05:00
parent eafc3078cf
commit 36eaea0fa7
4 changed files with 4 additions and 0 deletions

View file

@ -372,6 +372,7 @@ void DivPlatformGenesis::tick() {
if (i==2 && extMode) continue; if (i==2 && extMode) continue;
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].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq));
if (chan[i].freq>262143) chan[i].freq=262143;
int freqt=toFreq(chan[i].freq); int freqt=toFreq(chan[i].freq);
immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8); immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8);
immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff); immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff);

View file

@ -270,6 +270,7 @@ void DivPlatformGenesisExt::tick() {
if (extMode) for (int i=0; i<4; i++) { if (extMode) for (int i=0; i<4; i++) {
if (opChan[i].freqChanged) { if (opChan[i].freqChanged) {
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch); opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch);
if (opChan[i].freq>262143) opChan[i].freq=262143;
if (opChan[i].freq>=82432) { if (opChan[i].freq>=82432) {
opChan[i].freqH=((opChan[i].freq>>15)&7)|0x38; opChan[i].freqH=((opChan[i].freq>>15)&7)|0x38;
opChan[i].freqL=(opChan[i].freq>>7)&0xff; opChan[i].freqL=(opChan[i].freq>>7)&0xff;

View file

@ -368,6 +368,7 @@ void DivPlatformYM2610::tick() {
if (i==1 && extMode) continue; if (i==1 && extMode) continue;
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].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,false,octave(chan[i].baseFreq));
if (chan[i].freq>262143) chan[i].freq=262143;
int freqt=toFreq(chan[i].freq); int freqt=toFreq(chan[i].freq);
immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8); immWrite(chanOffs[i]+ADDR_FREQH,freqt>>8);
immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff); immWrite(chanOffs[i]+ADDR_FREQ,freqt&0xff);

View file

@ -234,6 +234,7 @@ void DivPlatformYM2610Ext::tick() {
if (extMode) for (int i=0; i<4; i++) { if (extMode) for (int i=0; i<4; i++) {
if (opChan[i].freqChanged) { if (opChan[i].freqChanged) {
opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch); opChan[i].freq=parent->calcFreq(opChan[i].baseFreq,opChan[i].pitch);
if (opChan[i].freq>262143) opChan[i].freq=262143;
int freqt=toFreq(opChan[i].freq); int freqt=toFreq(opChan[i].freq);
opChan[i].freqH=freqt>>8; opChan[i].freqH=freqt>>8;
opChan[i].freqL=freqt&0xff; opChan[i].freqL=freqt&0xff;