implement arp speed and arp tick
This commit is contained in:
parent
c0f7f12c89
commit
c766f98719
|
@ -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) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,18 +399,21 @@ void DivEngine::nextTick() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].arp!=0 && chan[i].portaSpeed<1) {
|
if (chan[i].arp!=0 && chan[i].portaSpeed<1) {
|
||||||
chan[i].arpStage++;
|
if (--chan[i].arpTicks<1) {
|
||||||
if (chan[i].arpStage>2) chan[i].arpStage=0;
|
chan[i].arpTicks=song.arpLen;
|
||||||
switch (chan[i].arpStage) {
|
chan[i].arpStage++;
|
||||||
case 0:
|
if (chan[i].arpStage>2) chan[i].arpStage=0;
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
|
switch (chan[i].arpStage) {
|
||||||
break;
|
case 0:
|
||||||
case 1:
|
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note+(chan[i].arp>>4)));
|
break;
|
||||||
break;
|
case 1:
|
||||||
case 2:
|
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note+(chan[i].arp>>4)));
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note+(chan[i].arp&15)));
|
break;
|
||||||
break;
|
case 2:
|
||||||
|
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note+(chan[i].arp&15)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue