prepare to move things around

speed dial commands and speed delays will be moved to e0-ff in order to
accelerate command check process (one cmp as opposed to a large command call table)
This commit is contained in:
tildearrow 2025-04-15 18:35:50 -05:00
parent a2269bc2b1
commit ecc60a3a64
4 changed files with 100 additions and 111 deletions

View file

@ -72,6 +72,7 @@ hex | description
c0 | pre porta (X) c0 | pre porta (X)
| - bit 7: inPorta | - bit 7: inPorta
| - bit 6: isPortaOrSlide | - bit 6: isPortaOrSlide
c1 | arpeggio speed (b)
c2 | vibrato (bb) // speed, depth c2 | vibrato (bb) // speed, depth
c3 | vibrato range (b) c3 | vibrato range (b)
c4 | vibrato shape (b) c4 | vibrato shape (b)
@ -310,8 +311,6 @@ hex | description
9f | envelope K1 ramp (bb) 9f | envelope K1 ramp (bb)
a0 | envelope K2 ramp (bb) a0 | envelope K2 ramp (bb)
a1 | pause (b) a1 | pause (b)
----|------------------------------------
a2 | arpeggio speed (b)
----|------------------------------------ ----|------------------------------------
| **SNES commands (continued)** | **SNES commands (continued)**
a3 | global vol left (c) a3 | global vol left (c)

View file

@ -137,48 +137,72 @@ bool DivCSPlayer::tick() {
case 0xc0: case 0xc0:
command=DIV_CMD_PRE_PORTA; command=DIV_CMD_PRE_PORTA;
break; break;
case 0xc2: case 0xc1: // arp time
command=DIV_CMD_HINT_VIBRATO; arpSpeed=(unsigned char)stream.readC();
break; break;
case 0xc3: case 0xc2: // vibrato
command=DIV_CMD_HINT_VIBRATO_RANGE; chan[i].vibratoDepth=(signed char)stream.readC();
chan[i].vibratoRate=(unsigned char)stream.readC();
sendPitch=true;
break; break;
case 0xc4: case 0xc3: // vibrato range
command=DIV_CMD_HINT_VIBRATO_SHAPE; chan[i].vibratoRange=(unsigned char)stream.readC();
break; break;
case 0xc5: case 0xc4: // vibrato shape
command=DIV_CMD_HINT_PITCH; chan[i].vibratoShape=(unsigned char)stream.readC();
break; break;
case 0xc6: case 0xc5: // pitch
command=DIV_CMD_HINT_ARPEGGIO; chan[i].pitch=(signed char)stream.readC();
sendPitch=true;
break; break;
case 0xc7: case 0xc6: // arpeggio
command=DIV_CMD_HINT_VOLUME; chan[i].arp=(unsigned char)stream.readC();
break; break;
case 0xc8: case 0xc7: // volume
command=DIV_CMD_HINT_VOL_SLIDE; chan[i].volume=((unsigned char)stream.readC())<<8;
sendVolume=true;
break; break;
case 0xc9: case 0xc8: // vol slide
command=DIV_CMD_HINT_PORTA; chan[i].volSpeed=(short)(bigEndian?stream.readS_BE():stream.readS());
chan[i].volSpeedTarget=-1;
break; break;
case 0xca: case 0xc9: // porta
command=DIV_CMD_HINT_LEGATO; chan[i].portaTarget=(signed char)stream.readC();
chan[i].portaSpeed=(unsigned char)stream.readC();
break; break;
case 0xcb: case 0xca: { // legato
command=DIV_CMD_HINT_VOL_SLIDE_TARGET; int arg0=(unsigned char)stream.readC();
if (arg0==0xff) {
arg0=DIV_NOTE_NULL;
} else {
arg0-=60;
}
chan[i].note=arg0;
e->dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
break; break;
case 0xcc: }
command=DIV_CMD_HINT_TREMOLO; case 0xcb: { // vol slide target
int arg0=(short)(bigEndian?stream.readS_BE():stream.readS());
int arg1=(short)(bigEndian?stream.readS_BE():stream.readS());
chan[i].volSpeed=arg0;
chan[i].volSpeedTarget=arg0==0 ? -1 : arg1;
break; break;
case 0xcd: }
command=DIV_CMD_HINT_PANBRELLO; case 0xcc: // tremolo (TODO)
stream.readC();
break; break;
case 0xce: case 0xcd: // panbrello (TODO)
command=DIV_CMD_HINT_PAN_SLIDE; stream.readC();
break; break;
case 0xcf: case 0xce: // pan slide (TODO)
command=DIV_CMD_HINT_PANNING; stream.readC();
break; break;
case 0xcf: { // panning
int panL=(unsigned char)stream.readC();
int panR=(unsigned char)stream.readC();
e->dispatchCmd(DivCommand(DIV_CMD_PANNING,i,panL,panR));
break;
}
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd0: case 0xd1: case 0xd2: case 0xd3:
case 0xd4: case 0xd5: case 0xd6: case 0xd7: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xd8: case 0xd9: case 0xda: case 0xdb:
@ -290,44 +314,13 @@ bool DivCSPlayer::tick() {
int arg1=0; int arg1=0;
switch (command) { switch (command) {
case DIV_CMD_INSTRUMENT: case DIV_CMD_INSTRUMENT:
case DIV_CMD_HINT_VIBRATO_RANGE:
case DIV_CMD_HINT_VIBRATO_SHAPE:
case DIV_CMD_HINT_VOLUME:
case DIV_CMD_HINT_ARPEGGIO:
arg0=(unsigned char)stream.readC(); arg0=(unsigned char)stream.readC();
break; break;
case DIV_CMD_HINT_PITCH:
arg0=(signed char)stream.readC();
break;
case DIV_CMD_HINT_VIBRATO:
case DIV_CMD_HINT_PORTA:
arg0=(signed char)stream.readC();
arg1=(unsigned char)stream.readC();
break;
case DIV_CMD_HINT_PANNING: // TODO: panbrello
arg0=(unsigned char)stream.readC();
arg1=(unsigned char)stream.readC();
break;
case DIV_CMD_PRE_PORTA: case DIV_CMD_PRE_PORTA:
arg0=(unsigned char)stream.readC(); arg0=(unsigned char)stream.readC();
arg1=(arg0&0x40)?1:0; arg1=(arg0&0x40)?1:0;
arg0=(arg0&0x80)?1:0; arg0=(arg0&0x80)?1:0;
break; break;
case DIV_CMD_HINT_VOL_SLIDE:
arg0=(short)(bigEndian?stream.readS_BE():stream.readS());
break;
case DIV_CMD_HINT_VOL_SLIDE_TARGET:
arg0=(short)(bigEndian?stream.readS_BE():stream.readS());
arg1=(short)(bigEndian?stream.readS_BE():stream.readS());
break;
case DIV_CMD_HINT_LEGATO:
arg0=(unsigned char)stream.readC();
if (arg0==0xff) {
arg0=DIV_NOTE_NULL;
} else {
arg0-=60;
}
break;
// ONE BYTE COMMANDS // ONE BYTE COMMANDS
case DIV_CMD_SAMPLE_MODE: case DIV_CMD_SAMPLE_MODE:
case DIV_CMD_SAMPLE_FREQ: case DIV_CMD_SAMPLE_FREQ:
@ -377,7 +370,6 @@ bool DivCSPlayer::tick() {
case DIV_CMD_MACRO_OFF: case DIV_CMD_MACRO_OFF:
case DIV_CMD_MACRO_ON: case DIV_CMD_MACRO_ON:
case DIV_CMD_MACRO_RESTART: case DIV_CMD_MACRO_RESTART:
case DIV_CMD_HINT_ARP_TIME:
case DIV_CMD_QSOUND_ECHO_FEEDBACK: case DIV_CMD_QSOUND_ECHO_FEEDBACK:
case DIV_CMD_QSOUND_ECHO_LEVEL: case DIV_CMD_QSOUND_ECHO_LEVEL:
case DIV_CMD_QSOUND_SURROUND: case DIV_CMD_QSOUND_SURROUND:
@ -548,49 +540,8 @@ bool DivCSPlayer::tick() {
break; break;
} }
switch (command) { // dispatch it
case DIV_CMD_HINT_VOLUME:
chan[i].volume=arg0<<8;
sendVolume=true;
break;
case DIV_CMD_HINT_VOL_SLIDE:
chan[i].volSpeed=arg0;
chan[i].volSpeedTarget=-1;
break;
case DIV_CMD_HINT_VOL_SLIDE_TARGET:
chan[i].volSpeed=arg0;
chan[i].volSpeedTarget=arg0==0 ? -1 : arg1;
break;
case DIV_CMD_HINT_PITCH:
chan[i].pitch=arg0;
sendPitch=true;
break;
case DIV_CMD_HINT_VIBRATO:
chan[i].vibratoDepth=arg0;
chan[i].vibratoRate=arg1;
sendPitch=true;
break;
case DIV_CMD_HINT_PORTA:
chan[i].portaTarget=arg0;
chan[i].portaSpeed=arg1;
break;
case DIV_CMD_HINT_LEGATO:
chan[i].note=arg0;
e->dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
break;
case DIV_CMD_HINT_ARPEGGIO:
chan[i].arp=(unsigned char)arg0;
break;
case DIV_CMD_HINT_ARP_TIME:
arpSpeed=arg0;
break;
case DIV_CMD_HINT_PANNING:
e->dispatchCmd(DivCommand(DIV_CMD_PANNING,i,arg0,arg1));
break;
default: // dispatch it
e->dispatchCmd(DivCommand((DivDispatchCmds)command,i,arg0,arg1)); e->dispatchCmd(DivCommand((DivDispatchCmds)command,i,arg0,arg1));
break;
}
} }
for (unsigned int j=accessTSBegin; j<stream.tell(); j++) { for (unsigned int j=accessTSBegin; j<stream.tell(); j++) {

View file

@ -36,7 +36,7 @@ struct DivCSChannelState {
int note, pitch; int note, pitch;
int volume, volMax, volSpeed, volSpeedTarget; int volume, volMax, volSpeed, volSpeedTarget;
int vibratoDepth, vibratoRate, vibratoPos; int vibratoDepth, vibratoRate, vibratoPos, vibratoRange, vibratoShape;
int portaTarget, portaSpeed; int portaTarget, portaSpeed;
unsigned char arp, arpStage, arpTicks, loopCount; unsigned char arp, arpStage, arpTicks, loopCount;

View file

@ -71,7 +71,6 @@ int DivCS::getCmdLength(unsigned char ext) {
case DIV_CMD_MACRO_OFF: case DIV_CMD_MACRO_OFF:
case DIV_CMD_MACRO_ON: case DIV_CMD_MACRO_ON:
case DIV_CMD_MACRO_RESTART: case DIV_CMD_MACRO_RESTART:
case DIV_CMD_HINT_ARP_TIME:
case DIV_CMD_QSOUND_ECHO_FEEDBACK: case DIV_CMD_QSOUND_ECHO_FEEDBACK:
case DIV_CMD_QSOUND_ECHO_LEVEL: case DIV_CMD_QSOUND_ECHO_LEVEL:
case DIV_CMD_QSOUND_SURROUND: case DIV_CMD_QSOUND_SURROUND:
@ -234,6 +233,7 @@ int DivCS::getInsLength(unsigned char ins, unsigned char ext, unsigned char* spe
switch (ins) { switch (ins) {
case 0xb8: // ins case 0xb8: // ins
case 0xc0: // pre porta case 0xc0: // pre porta
case 0xc1: // arp time
case 0xc3: // vib range case 0xc3: // vib range
case 0xc4: // vib shape case 0xc4: // vib shape
case 0xc5: // pitch case 0xc5: // pitch
@ -283,25 +283,64 @@ void writeCommandValues(SafeWriter* w, const DivCommand& c, bool bigEndian) {
} }
break; break;
case DIV_CMD_NOTE_OFF: case DIV_CMD_NOTE_OFF:
w->writeC(0xb5);
break;
case DIV_CMD_NOTE_OFF_ENV: case DIV_CMD_NOTE_OFF_ENV:
w->writeC(0xb6);
break;
case DIV_CMD_ENV_RELEASE: case DIV_CMD_ENV_RELEASE:
w->writeC(0xb7);
break;
case DIV_CMD_INSTRUMENT: case DIV_CMD_INSTRUMENT:
w->writeC(0xb8);
break;
case DIV_CMD_PRE_PORTA: case DIV_CMD_PRE_PORTA:
w->writeC(0xc0);
break;
case DIV_CMD_HINT_ARP_TIME:
w->writeC(0xc1);
break;
case DIV_CMD_HINT_VIBRATO: case DIV_CMD_HINT_VIBRATO:
w->writeC(0xc2);
break;
case DIV_CMD_HINT_VIBRATO_RANGE: case DIV_CMD_HINT_VIBRATO_RANGE:
w->writeC(0xc3);
break;
case DIV_CMD_HINT_VIBRATO_SHAPE: case DIV_CMD_HINT_VIBRATO_SHAPE:
w->writeC(0xc4);
break;
case DIV_CMD_HINT_PITCH: case DIV_CMD_HINT_PITCH:
w->writeC(0xc5);
break;
case DIV_CMD_HINT_ARPEGGIO: case DIV_CMD_HINT_ARPEGGIO:
w->writeC(0xc6);
break;
case DIV_CMD_HINT_VOLUME: case DIV_CMD_HINT_VOLUME:
case DIV_CMD_HINT_PORTA: w->writeC(0xc7);
break;
case DIV_CMD_HINT_VOL_SLIDE: case DIV_CMD_HINT_VOL_SLIDE:
case DIV_CMD_HINT_VOL_SLIDE_TARGET: w->writeC(0xc8);
break;
case DIV_CMD_HINT_PORTA:
w->writeC(0xc9);
break;
case DIV_CMD_HINT_LEGATO: case DIV_CMD_HINT_LEGATO:
w->writeC(0xca);
break;
case DIV_CMD_HINT_VOL_SLIDE_TARGET:
w->writeC(0xcb);
break;
case DIV_CMD_HINT_TREMOLO: case DIV_CMD_HINT_TREMOLO:
w->writeC(0xcc);
break;
case DIV_CMD_HINT_PANBRELLO: case DIV_CMD_HINT_PANBRELLO:
w->writeC(0xcd);
break;
case DIV_CMD_HINT_PAN_SLIDE: case DIV_CMD_HINT_PAN_SLIDE:
w->writeC(0xce);
break;
case DIV_CMD_HINT_PANNING: case DIV_CMD_HINT_PANNING:
w->writeC((unsigned char)c.cmd+0xb4); w->writeC(0xcf);
break; break;
default: default:
w->writeC(0xf7); w->writeC(0xf7);
@ -330,6 +369,7 @@ void writeCommandValues(SafeWriter* w, const DivCommand& c, bool bigEndian) {
case DIV_CMD_HINT_PANBRELLO: case DIV_CMD_HINT_PANBRELLO:
case DIV_CMD_HINT_PAN_SLIDE: case DIV_CMD_HINT_PAN_SLIDE:
case DIV_CMD_HINT_ARPEGGIO: case DIV_CMD_HINT_ARPEGGIO:
case DIV_CMD_HINT_ARP_TIME:
w->writeC(c.value); w->writeC(c.value);
break; break;
case DIV_CMD_HINT_PANNING: case DIV_CMD_HINT_PANNING:
@ -405,7 +445,6 @@ void writeCommandValues(SafeWriter* w, const DivCommand& c, bool bigEndian) {
case DIV_CMD_MACRO_OFF: case DIV_CMD_MACRO_OFF:
case DIV_CMD_MACRO_ON: case DIV_CMD_MACRO_ON:
case DIV_CMD_MACRO_RESTART: case DIV_CMD_MACRO_RESTART:
case DIV_CMD_HINT_ARP_TIME:
case DIV_CMD_QSOUND_ECHO_FEEDBACK: case DIV_CMD_QSOUND_ECHO_FEEDBACK:
case DIV_CMD_QSOUND_ECHO_LEVEL: case DIV_CMD_QSOUND_ECHO_LEVEL:
case DIV_CMD_QSOUND_SURROUND: case DIV_CMD_QSOUND_SURROUND: