Genesis: implement arp macros

This commit is contained in:
tildearrow 2022-01-23 15:55:12 -05:00
parent 45d9bef2a8
commit 524f8c312e
2 changed files with 44 additions and 5 deletions

View file

@ -83,6 +83,23 @@ void DivPlatformGenesis::tick() {
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
if (i==2 && extMode) continue; if (i==2 && extMode) continue;
chan[i].std.next(); chan[i].std.next();
if (chan[i].std.hadArp) {
if (!chan[i].inPorta) {
if (chan[i].std.arpMode) {
chan[i].baseFreq=644.0f*pow(2.0f,((float)chan[i].std.arp/12.0f));
} else {
chan[i].baseFreq=644.0f*pow(2.0f,((float)(chan[i].note+(signed char)chan[i].std.arp-12)/12.0f));
}
}
chan[i].freqChanged=true;
} else {
if (chan[i].std.arpMode && chan[i].std.finishedArp) {
chan[i].baseFreq=644.0f*pow(2.0f,((float)chan[i].note/12.0f));
chan[i].freqChanged=true;
}
}
if (chan[i].std.hadAlg) { if (chan[i].std.hadAlg) {
chan[i].state.alg=chan[i].std.alg; chan[i].state.alg=chan[i].std.alg;
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)); rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
@ -314,6 +331,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
if (c.value!=DIV_NOTE_NULL) { if (c.value!=DIV_NOTE_NULL) {
chan[c.chan].baseFreq=644.0f*pow(2.0f,((float)c.value/12.0f)); chan[c.chan].baseFreq=644.0f*pow(2.0f,((float)c.value/12.0f));
chan[c.chan].note=c.value;
chan[c.chan].freqChanged=true; chan[c.chan].freqChanged=true;
} }
chan[c.chan].keyOn=true; chan[c.chan].keyOn=true;
@ -397,7 +415,10 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
chan[c.chan].baseFreq=newFreq; chan[c.chan].baseFreq=newFreq;
chan[c.chan].portaPause=false; chan[c.chan].portaPause=false;
chan[c.chan].freqChanged=true; chan[c.chan].freqChanged=true;
if (return2) return 2; if (return2) {
chan[c.chan].inPorta=false;
return 2;
}
break; break;
} }
case DIV_CMD_SAMPLE_MODE: { case DIV_CMD_SAMPLE_MODE: {
@ -413,6 +434,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
break; break;
case DIV_CMD_LEGATO: { case DIV_CMD_LEGATO: {
chan[c.chan].baseFreq=644.0f*pow(2.0f,((float)c.value/12.0f)); chan[c.chan].baseFreq=644.0f*pow(2.0f,((float)c.value/12.0f));
chan[c.chan].note=c.value;
chan[c.chan].freqChanged=true; chan[c.chan].freqChanged=true;
break; break;
} }
@ -463,6 +485,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
return 127; return 127;
break; break;
case DIV_CMD_PRE_PORTA: case DIV_CMD_PRE_PORTA:
chan[c.chan].inPorta=c.value;
break; break;
case DIV_CMD_PRE_NOTE: case DIV_CMD_PRE_NOTE:
break; break;

View file

@ -12,13 +12,29 @@ class DivPlatformGenesis: public DivDispatch {
DivInstrumentFM state; DivInstrumentFM state;
DivMacroInt std; DivMacroInt std;
unsigned char freqH, freqL; unsigned char freqH, freqL;
int freq, baseFreq, pitch; int freq, baseFreq, pitch, note;
unsigned char ins; unsigned char ins;
signed char konCycles; bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnaceDac, inPorta;
bool active, insChanged, freqChanged, keyOn, keyOff, portaPause, furnaceDac;
int vol; int vol;
unsigned char pan; unsigned char pan;
Channel(): freqH(0), freqL(0), freq(0), baseFreq(0), pitch(0), ins(-1), active(false), insChanged(true), freqChanged(false), keyOn(false), keyOff(false), portaPause(false), furnaceDac(false), vol(0), pan(3) {} Channel():
freqH(0),
freqL(0),
freq(0),
baseFreq(0),
pitch(0),
note(0),
ins(-1),
active(false),
insChanged(true),
freqChanged(false),
keyOn(false),
keyOff(false),
portaPause(false),
furnaceDac(false),
inPorta(false),
vol(0),
pan(3) {}
}; };
Channel chan[10]; Channel chan[10];
bool isMuted[10]; bool isMuted[10];