implement E4 effect
This commit is contained in:
parent
c766f98719
commit
d9c02531e8
|
@ -9,7 +9,7 @@ struct DivChannelState {
|
||||||
std::vector<DivDelayedCommand> delayed;
|
std::vector<DivDelayedCommand> delayed;
|
||||||
int note, pitch, portaSpeed, portaNote;
|
int note, pitch, portaSpeed, portaNote;
|
||||||
int volume, volSpeed, cut, rowDelay, volMax;
|
int volume, volSpeed, cut, rowDelay, volMax;
|
||||||
int vibratoDepth, vibratoRate, vibratoPos, vibratoDir;
|
int vibratoDepth, vibratoRate, vibratoPos, vibratoDir, vibratoFine;
|
||||||
int tremoloDepth, tremoloRate, tremoloPos;
|
int tremoloDepth, tremoloRate, tremoloPos;
|
||||||
unsigned char arp, arpStage, arpTicks;
|
unsigned char arp, arpStage, arpTicks;
|
||||||
bool doNote, legato;
|
bool doNote, legato;
|
||||||
|
@ -27,6 +27,7 @@ struct DivChannelState {
|
||||||
vibratoRate(0),
|
vibratoRate(0),
|
||||||
vibratoPos(0),
|
vibratoPos(0),
|
||||||
vibratoDir(0),
|
vibratoDir(0),
|
||||||
|
vibratoFine(15),
|
||||||
tremoloDepth(0),
|
tremoloDepth(0),
|
||||||
tremoloRate(0),
|
tremoloRate(0),
|
||||||
tremoloPos(0),
|
tremoloPos(0),
|
||||||
|
|
|
@ -198,7 +198,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
||||||
case 0x04: // vibrato
|
case 0x04: // vibrato
|
||||||
chan[i].vibratoDepth=effectVal&15;
|
chan[i].vibratoDepth=effectVal&15;
|
||||||
chan[i].vibratoRate=effectVal>>4;
|
chan[i].vibratoRate=effectVal>>4;
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos])>>4)));
|
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||||
break;
|
break;
|
||||||
case 0x0a: // volume ramp
|
case 0x0a: // volume ramp
|
||||||
if (effectVal!=0) {
|
if (effectVal!=0) {
|
||||||
|
@ -232,9 +232,12 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
||||||
case 0xe3: // vibrato direction
|
case 0xe3: // vibrato direction
|
||||||
chan[i].vibratoDir=effectVal;
|
chan[i].vibratoDir=effectVal;
|
||||||
break;
|
break;
|
||||||
|
case 0xe4: // vibrato fine
|
||||||
|
chan[i].vibratoFine=effectVal;
|
||||||
|
break;
|
||||||
case 0xe5: // pitch
|
case 0xe5: // pitch
|
||||||
chan[i].pitch=effectVal-0x80;
|
chan[i].pitch=effectVal-0x80;
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos])>>2)));
|
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||||
break;
|
break;
|
||||||
case 0xea: // legato mode
|
case 0xea: // legato mode
|
||||||
chan[i].legato=effectVal;
|
chan[i].legato=effectVal;
|
||||||
|
@ -250,7 +253,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
||||||
|
|
||||||
if (chan[i].doNote) {
|
if (chan[i].doNote) {
|
||||||
chan[i].vibratoPos=0;
|
chan[i].vibratoPos=0;
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos])>>4)));
|
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||||
if (chan[i].legato) {
|
if (chan[i].legato) {
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
|
dispatch->dispatch(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
|
||||||
} else {
|
} else {
|
||||||
|
@ -376,13 +379,13 @@ void DivEngine::nextTick() {
|
||||||
if (chan[i].vibratoPos>=64) chan[i].vibratoPos-=64;
|
if (chan[i].vibratoPos>=64) chan[i].vibratoPos-=64;
|
||||||
switch (chan[i].vibratoDir) {
|
switch (chan[i].vibratoDir) {
|
||||||
case 1: // up
|
case 1: // up
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(MAX(0,chan[i].vibratoDepth*vibTable[chan[i].vibratoPos])>>4)));
|
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(MAX(0,(chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||||
break;
|
break;
|
||||||
case 2: // down
|
case 2: // down
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(MIN(0,chan[i].vibratoDepth*vibTable[chan[i].vibratoPos])>>4)));
|
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(MIN(0,(chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||||
break;
|
break;
|
||||||
default: // both
|
default: // both
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos])>>4)));
|
dispatch->dispatch(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue