implement arp speed and arp tick

This commit is contained in:
tildearrow 2021-05-18 02:53:59 -05:00
parent c0f7f12c89
commit c766f98719
3 changed files with 25 additions and 13 deletions

View file

@ -11,7 +11,7 @@ struct DivChannelState {
int volume, volSpeed, cut, rowDelay, volMax; int volume, volSpeed, cut, rowDelay, volMax;
int vibratoDepth, vibratoRate, vibratoPos, vibratoDir; int vibratoDepth, vibratoRate, vibratoPos, vibratoDir;
int tremoloDepth, tremoloRate, tremoloPos; int tremoloDepth, tremoloRate, tremoloPos;
unsigned char arp, arpStage; unsigned char arp, arpStage, arpTicks;
bool doNote, legato; bool doNote, legato;
DivChannelState(): DivChannelState():
@ -32,6 +32,7 @@ struct DivChannelState {
tremoloPos(0), tremoloPos(0),
arp(0), arp(0),
arpStage(-1), arpStage(-1),
arpTicks(1),
doNote(false), legato(false) {} doNote(false), legato(false) {}
}; };

View file

@ -331,6 +331,8 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
case DIV_CMD_GET_VOLMAX: case DIV_CMD_GET_VOLMAX:
return 127; return 127;
break; break;
case DIV_CMD_PRE_PORTA:
break;
default: default:
printf("WARNING: unimplemented command %d\n",c.cmd); printf("WARNING: unimplemented command %d\n",c.cmd);
break; break;

View file

@ -218,6 +218,9 @@ void DivEngine::processRow(int i, bool afterDelay) {
chan[i].rowDelay=effectVal+1; chan[i].rowDelay=effectVal+1;
break; break;
case 0xe0: // arp speed
song.arpLen=effectVal;
break;
case 0xe1: // portamento up case 0xe1: // portamento up
chan[i].portaNote=chan[i].note+(effectVal&15); chan[i].portaNote=chan[i].note+(effectVal&15);
chan[i].portaSpeed=(effectVal>>4)*4; chan[i].portaSpeed=(effectVal>>4)*4;
@ -239,6 +242,9 @@ void DivEngine::processRow(int i, bool afterDelay) {
case 0xec: // delayed note cut case 0xec: // delayed note cut
chan[i].cut=effectVal+1; chan[i].cut=effectVal+1;
break; break;
case 0xee: // external command
printf("\x1b[1;36m%d: extern command %d\x1b[m\n",i,effectVal);
break;
} }
} }
@ -393,6 +399,8 @@ void DivEngine::nextTick() {
} }
} }
if (chan[i].arp!=0 && chan[i].portaSpeed<1) { if (chan[i].arp!=0 && chan[i].portaSpeed<1) {
if (--chan[i].arpTicks<1) {
chan[i].arpTicks=song.arpLen;
chan[i].arpStage++; chan[i].arpStage++;
if (chan[i].arpStage>2) chan[i].arpStage=0; if (chan[i].arpStage>2) chan[i].arpStage=0;
switch (chan[i].arpStage) { switch (chan[i].arpStage) {
@ -408,6 +416,7 @@ void DivEngine::nextTick() {
} }
} }
} }
}
// system tick // system tick
dispatch->tick(); dispatch->tick();