a lot of master system fixes!

fixes forest frolick, professional tracker, YZYX, Monday (kinda),
MasterTracker and Ice Fields
This commit is contained in:
tildearrow 2021-12-29 02:08:50 -05:00
parent 3e34c60b32
commit dc5990a37e
10 changed files with 73 additions and 13 deletions

View file

@ -31,6 +31,14 @@ bool DivDispatch::keyOffAffectsArp(int ch) {
return false;
}
bool DivDispatch::keyOffAffectsPorta(int ch) {
return false;
}
int DivDispatch::getPortaFloor(int ch) {
return 0x00;
}
void DivDispatch::setPAL(bool pal) {
}

View file

@ -419,6 +419,10 @@ bool DivPlatformGenesis::keyOffAffectsArp(int ch) {
return (ch>5);
}
bool DivPlatformGenesis::keyOffAffectsPorta(int ch) {
return (ch>5);
}
void DivPlatformGenesis::setPAL(bool pal) {
if (pal) {
rate=211125;

View file

@ -58,6 +58,7 @@ class DivPlatformGenesis: public DivDispatch {
void muteChannel(int ch, bool mute);
bool isStereo();
bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch);
void setPAL(bool pal);
int init(DivEngine* parent, int channels, int sugRate, bool pal);
void quit();

View file

@ -306,6 +306,10 @@ bool DivPlatformGenesisExt::keyOffAffectsArp(int ch) {
return (ch>8);
}
bool DivPlatformGenesisExt::keyOffAffectsPorta(int ch) {
return (ch>8);
}
int DivPlatformGenesisExt::init(DivEngine* parent, int channels, int sugRate, bool pal) {
DivPlatformGenesis::init(parent,channels,sugRate,pal);
for (int i=0; i<4; i++) {

View file

@ -22,6 +22,7 @@ class DivPlatformGenesisExt: public DivPlatformGenesis {
void tick();
void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch);
int init(DivEngine* parent, int channels, int sugRate, bool pal);
void quit();
~DivPlatformGenesisExt();

View file

@ -2,6 +2,8 @@
#include "../engine.h"
#include <math.h>
#define FREQ_BASE 1712.0f
void DivPlatformSMS::acquire(short* bufL, short* bufR, size_t start, size_t len) {
sn->sound_stream_update(bufL+start,len);
}
@ -21,14 +23,19 @@ void DivPlatformSMS::tick() {
}
if (chan[i].std.hadArp) {
if (chan[i].std.arpMode) {
chan[i].baseFreq=round(1712.0f/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].std.arp)/12.0f)));
} else {
chan[i].baseFreq=round(1712.0f/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note+chan[i].std.arp-12)/12.0f)));
}
chan[i].freqChanged=true;
} else {
if (chan[i].std.arpMode && chan[i].std.finishedArp) {
chan[i].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(chan[i].note)/12.0f)));
chan[i].freqChanged=true;
}
}
if (chan[i].std.hadDuty) {
snNoiseMode=(snNoiseMode&2)|(chan[i].std.duty&1);
if (i==3) if (chan[i].std.hadDuty) {
snNoiseMode=chan[i].std.duty;
if (chan[i].std.duty<2) {
chan[3].freqChanged=false;
}
@ -46,7 +53,8 @@ void DivPlatformSMS::tick() {
}
if (chan[3].freqChanged || updateSNMode) {
updateSNMode=false;
chan[3].freq=parent->calcFreq(chan[3].baseFreq,chan[3].pitch,true);
// seems arbitrary huh?
chan[3].freq=parent->calcFreq(chan[3].baseFreq,chan[3].pitch-1,true);
if (chan[3].note>0x5d) chan[3].freq=0x01;
chan[3].freqChanged=false;
if (snNoiseMode&2) { // take period from channel 3
@ -80,7 +88,7 @@ void DivPlatformSMS::tick() {
int DivPlatformSMS::dispatch(DivCommand c) {
switch (c.cmd) {
case DIV_CMD_NOTE_ON:
chan[c.chan].baseFreq=round(1712.0f/pow(2.0f,((float)c.value/12.0f)));
chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)c.value/12.0f)));
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
chan[c.chan].active=true;
@ -116,7 +124,7 @@ int DivPlatformSMS::dispatch(DivCommand c) {
chan[c.chan].freqChanged=true;
break;
case DIV_CMD_NOTE_PORTA: {
int destFreq=round(1712.0f/pow(2.0f,((float)c.value2/12.0f)));
int destFreq=round(FREQ_BASE/pow(2.0f,((float)c.value2/12.0f)));
bool return2=false;
if (destFreq>chan[c.chan].baseFreq) {
chan[c.chan].baseFreq+=c.value;
@ -140,7 +148,7 @@ int DivPlatformSMS::dispatch(DivCommand c) {
updateSNMode=true;
break;
case DIV_CMD_LEGATO:
chan[c.chan].baseFreq=round(1712.0f/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f)));
chan[c.chan].baseFreq=round(FREQ_BASE/pow(2.0f,((float)(c.value+((chan[c.chan].std.willArp && !chan[c.chan].std.arpMode)?(chan[c.chan].std.arp-12):(0)))/12.0f)));
chan[c.chan].freqChanged=true;
chan[c.chan].note=c.value;
break;
@ -177,6 +185,14 @@ bool DivPlatformSMS::keyOffAffectsArp(int ch) {
return true;
}
bool DivPlatformSMS::keyOffAffectsPorta(int ch) {
return true;
}
int DivPlatformSMS::getPortaFloor(int ch) {
return 12;
}
void DivPlatformSMS::setPAL(bool pal) {
if (pal) {
rate=221681;

View file

@ -39,6 +39,8 @@ class DivPlatformSMS: public DivDispatch {
void tick();
void muteChannel(int ch, bool mute);
bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch);
int getPortaFloor(int ch);
void setPAL(bool pal);
int init(DivEngine* parent, int channels, int sugRate, bool pal);
void quit();