add more vibrato shapes
This commit is contained in:
parent
55a8bb2448
commit
2877d488ca
5 changed files with 65 additions and 20 deletions
|
|
@ -101,7 +101,7 @@ const char* DivEngine::getEffectDesc(unsigned char effect, int chan, bool notNul
|
|||
case 0xe2:
|
||||
return _("E2xy: Note slide down (x: speed; y: semitones)");
|
||||
case 0xe3:
|
||||
return _("E3xx: Set vibrato shape (0: up/down; 1: up only; 2: down only)");
|
||||
return _("E3xx: Set vibrato shape");
|
||||
case 0xe4:
|
||||
return _("E4xx: Set vibrato range");
|
||||
case 0xe5:
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ struct DivChannelState {
|
|||
int note, oldNote, lastIns, pitch, portaSpeed, portaNote;
|
||||
int volume, volSpeed, cut, legatoDelay, legatoTarget, rowDelay, volMax;
|
||||
int delayOrder, delayRow, retrigSpeed, retrigTick;
|
||||
int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoDir, vibratoFine;
|
||||
int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoShape, vibratoFine;
|
||||
int tremoloDepth, tremoloRate, tremoloPos;
|
||||
int sampleOff;
|
||||
unsigned char arp, arpStage, arpTicks, panL, panR, panRL, panRR, lastVibrato, lastPorta, cutType;
|
||||
|
|
@ -169,7 +169,7 @@ struct DivChannelState {
|
|||
vibratoRate(0),
|
||||
vibratoPos(0),
|
||||
vibratoPosGiant(0),
|
||||
vibratoDir(0),
|
||||
vibratoShape(0),
|
||||
vibratoFine(15),
|
||||
tremoloDepth(0),
|
||||
tremoloRate(0),
|
||||
|
|
|
|||
|
|
@ -951,9 +951,9 @@ void DivEngine::processRow(int i, bool afterDelay) {
|
|||
if (!song.brokenShortcutSlides) dispatchCmd(DivCommand(DIV_CMD_PRE_PORTA,i,false,0));
|
||||
}
|
||||
break;
|
||||
case 0xe3: // vibrato direction
|
||||
chan[i].vibratoDir=effectVal;
|
||||
dispatchCmd(DivCommand(DIV_CMD_HINT_VIBRATO_SHAPE,i,chan[i].vibratoDir));
|
||||
case 0xe3: // vibrato shape
|
||||
chan[i].vibratoShape=effectVal;
|
||||
dispatchCmd(DivCommand(DIV_CMD_HINT_VIBRATO_SHAPE,i,chan[i].vibratoShape));
|
||||
break;
|
||||
case 0xe4: // vibrato fine
|
||||
chan[i].vibratoFine=effectVal;
|
||||
|
|
@ -1579,19 +1579,55 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
|
|||
while (chan[i].vibratoPos>=64) chan[i].vibratoPos-=64;
|
||||
|
||||
chan[i].vibratoPosGiant+=chan[i].vibratoRate;
|
||||
while (chan[i].vibratoPos>=512) chan[i].vibratoPos-=512;
|
||||
while (chan[i].vibratoPosGiant>=512) chan[i].vibratoPosGiant-=512;
|
||||
|
||||
switch (chan[i].vibratoDir) {
|
||||
case 1: // up
|
||||
dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(MAX(0,(chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||
int vibratoOut=0;
|
||||
switch (chan[i].vibratoShape) {
|
||||
case 1: // sine, up only
|
||||
vibratoOut=MAX(0,vibTable[chan[i].vibratoPos]);
|
||||
break;
|
||||
case 2: // down
|
||||
dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(MIN(0,(chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||
case 2: // sine, down only
|
||||
vibratoOut=MIN(0,vibTable[chan[i].vibratoPos]);
|
||||
break;
|
||||
default: // both
|
||||
dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
|
||||
case 3: // triangle
|
||||
vibratoOut=(chan[i].vibratoPos&31);
|
||||
if (chan[i].vibratoPos&16) {
|
||||
vibratoOut=32-(chan[i].vibratoPos&31);
|
||||
}
|
||||
if (chan[i].vibratoPos&32) {
|
||||
vibratoOut=-vibratoOut;
|
||||
}
|
||||
vibratoOut<<=3;
|
||||
break;
|
||||
case 4: // ramp up
|
||||
vibratoOut=chan[i].vibratoPos<<1;
|
||||
break;
|
||||
case 5: // ramp down
|
||||
vibratoOut=-chan[i].vibratoPos<<1;
|
||||
break;
|
||||
case 6: // square
|
||||
vibratoOut=(chan[i].vibratoPos>=32)?-127:127;
|
||||
break;
|
||||
case 7: // random (TODO: use LFSR)
|
||||
vibratoOut=(rand()&255)-128;
|
||||
break;
|
||||
case 8: // square up
|
||||
vibratoOut=(chan[i].vibratoPos>=32)?0:127;
|
||||
break;
|
||||
case 9: // square down
|
||||
vibratoOut=(chan[i].vibratoPos>=32)?0:-127;
|
||||
break;
|
||||
case 10: // half sine up
|
||||
vibratoOut=vibTable[chan[i].vibratoPos>>1];
|
||||
break;
|
||||
case 11: // half sine down
|
||||
vibratoOut=vibTable[32|(chan[i].vibratoPos>>1)];
|
||||
break;
|
||||
default: // sine
|
||||
vibratoOut=vibTable[chan[i].vibratoPos];
|
||||
break;
|
||||
}
|
||||
dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibratoOut*chan[i].vibratoFine)>>4)/15)));
|
||||
}
|
||||
if (chan[i].legatoDelay>0) {
|
||||
if (--chan[i].legatoDelay<1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue