mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-26 22:43:01 +00:00
implement arp speed and arp tick
This commit is contained in:
parent
c0f7f12c89
commit
c766f98719
3 changed files with 25 additions and 13 deletions
|
@ -11,7 +11,7 @@ struct DivChannelState {
|
|||
int volume, volSpeed, cut, rowDelay, volMax;
|
||||
int vibratoDepth, vibratoRate, vibratoPos, vibratoDir;
|
||||
int tremoloDepth, tremoloRate, tremoloPos;
|
||||
unsigned char arp, arpStage;
|
||||
unsigned char arp, arpStage, arpTicks;
|
||||
bool doNote, legato;
|
||||
|
||||
DivChannelState():
|
||||
|
@ -32,6 +32,7 @@ struct DivChannelState {
|
|||
tremoloPos(0),
|
||||
arp(0),
|
||||
arpStage(-1),
|
||||
arpTicks(1),
|
||||
doNote(false), legato(false) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -331,6 +331,8 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
|||
case DIV_CMD_GET_VOLMAX:
|
||||
return 127;
|
||||
break;
|
||||
case DIV_CMD_PRE_PORTA:
|
||||
break;
|
||||
default:
|
||||
printf("WARNING: unimplemented command %d\n",c.cmd);
|
||||
break;
|
||||
|
|
|
@ -218,6 +218,9 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
|||
chan[i].rowDelay=effectVal+1;
|
||||
break;
|
||||
|
||||
case 0xe0: // arp speed
|
||||
song.arpLen=effectVal;
|
||||
break;
|
||||
case 0xe1: // portamento up
|
||||
chan[i].portaNote=chan[i].note+(effectVal&15);
|
||||
chan[i].portaSpeed=(effectVal>>4)*4;
|
||||
|
@ -239,6 +242,9 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
|||
case 0xec: // delayed note cut
|
||||
chan[i].cut=effectVal+1;
|
||||
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) {
|
||||
chan[i].arpStage++;
|
||||
if (chan[i].arpStage>2) chan[i].arpStage=0;
|
||||
switch (chan[i].arpStage) {
|
||||
case 0:
|
||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
|
||||
break;
|
||||
case 1:
|
||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note+(chan[i].arp>>4)));
|
||||
break;
|
||||
case 2:
|
||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note+(chan[i].arp&15)));
|
||||
break;
|
||||
if (--chan[i].arpTicks<1) {
|
||||
chan[i].arpTicks=song.arpLen;
|
||||
chan[i].arpStage++;
|
||||
if (chan[i].arpStage>2) chan[i].arpStage=0;
|
||||
switch (chan[i].arpStage) {
|
||||
case 0:
|
||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
|
||||
break;
|
||||
case 1:
|
||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note+(chan[i].arp>>4)));
|
||||
break;
|
||||
case 2:
|
||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note+(chan[i].arp&15)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue