one-byte vibrato

This commit is contained in:
tildearrow 2025-04-17 18:58:11 -05:00
parent b1a630f2cd
commit 334d4bab67
6 changed files with 96 additions and 10 deletions

View file

@ -140,11 +140,13 @@ bool DivCSPlayer::tick() {
case 0xc1: // arp time
arpSpeed=(unsigned char)stream.readC();
break;
case 0xc2: // vibrato
chan[i].vibratoDepth=(signed char)stream.readC();
chan[i].vibratoRate=(unsigned char)stream.readC();
case 0xc2: { // vibrato
unsigned char param=stream.readC();
chan[i].vibratoDepth=param&15;
chan[i].vibratoRate=param>>4;
sendPitch=true;
break;
}
case 0xc3: // vibrato range
chan[i].vibratoRange=(unsigned char)stream.readC();
break;

View file

@ -244,9 +244,9 @@ int DivCS::getInsLength(unsigned char ins, unsigned char ext, unsigned char* spe
case 0xcd: // panbrello
case 0xce: // pan slide
case 0xdd: // waitc
case 0xc2: // vibrato
return 2;
case 0xcf: // pan
case 0xc2: // vibrato
case 0xc8: // vol slide
case 0xc9: // porta
return 3;
@ -373,10 +373,10 @@ void writeCommandValues(SafeWriter* w, const DivCommand& c, bool bigEndian) {
case DIV_CMD_HINT_PAN_SLIDE:
case DIV_CMD_HINT_ARPEGGIO:
case DIV_CMD_HINT_ARP_TIME:
case DIV_CMD_HINT_VIBRATO:
w->writeC(c.value);
break;
case DIV_CMD_HINT_PANNING:
case DIV_CMD_HINT_VIBRATO:
case DIV_CMD_HINT_PORTA:
w->writeC(c.value);
w->writeC(c.value2);

View file

@ -870,7 +870,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
if (effectVal) chan[i].lastVibrato=effectVal;
chan[i].vibratoDepth=effectVal&15;
chan[i].vibratoRate=effectVal>>4;
dispatchCmd(DivCommand(DIV_CMD_HINT_VIBRATO,i,chan[i].vibratoDepth,chan[i].vibratoRate));
dispatchCmd(DivCommand(DIV_CMD_HINT_VIBRATO,i,(chan[i].vibratoDepth&15)|(chan[i].vibratoRate<<4)));
dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
break;
case 0x05: // vol slide + vibrato
@ -881,7 +881,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
chan[i].vibratoDepth=chan[i].lastVibrato&15;
chan[i].vibratoRate=chan[i].lastVibrato>>4;
}
dispatchCmd(DivCommand(DIV_CMD_HINT_VIBRATO,i,chan[i].vibratoDepth,chan[i].vibratoRate));
dispatchCmd(DivCommand(DIV_CMD_HINT_VIBRATO,i,(chan[i].vibratoDepth&15)|(chan[i].vibratoRate<<4)));
dispatchCmd(DivCommand(DIV_CMD_PITCH,i,chan[i].pitch+(((chan[i].vibratoDepth*vibTable[chan[i].vibratoPos]*chan[i].vibratoFine)>>4)/15)));
// TODO: non-0x-or-x0 value should be treated as 00
if (effectVal!=0) {