C64: 20xy and 21xy for setting ADSR

dropping DefleJank
This commit is contained in:
tildearrow 2023-10-23 13:49:03 -05:00
parent aad3557693
commit 6dddee40d5
5 changed files with 25 additions and 0 deletions

View file

@ -238,6 +238,9 @@ enum DivDispatchCmds {
DIV_CMD_EXTERNAL, // (value)
DIV_CMD_C64_AD, // (value)
DIV_CMD_C64_SR, // (value)
DIV_ALWAYS_SET_VOLUME, // () -> alwaysSetVol
DIV_CMD_MAX

View file

@ -493,6 +493,16 @@ int DivPlatformC64::dispatch(DivCommand c) {
break;
}
break;
case DIV_CMD_C64_AD:
chan[c.chan].attack=c.value>>4;
chan[c.chan].decay=c.value&15;
rWrite(c.chan*7+5,(chan[c.chan].attack<<4)|(chan[c.chan].decay));
break;
case DIV_CMD_C64_SR:
chan[c.chan].sustain=c.value>>4;
chan[c.chan].release=c.value&15;
rWrite(c.chan*7+6,(chan[c.chan].sustain<<4)|(chan[c.chan].release));
break;
case DIV_CMD_MACRO_OFF:
chan[c.chan].std.mask(c.value,true);
break;

View file

@ -239,6 +239,9 @@ const char* cmdName[]={
"EXTERNAL",
"C64_AD",
"C64_SR",
"ALWAYS_SET_VOLUME"
};

View file

@ -598,6 +598,8 @@ void DivEngine::registerSystems() {
{0x1b, {DIV_CMD_C64_FILTER_RESET, "1Bxy: Reset cutoff (x: on new note; y: now)"}},
{0x1c, {DIV_CMD_C64_DUTY_RESET, "1Cxy: Reset pulse width (x: on new note; y: now)"}},
{0x1e, {DIV_CMD_C64_EXTENDED, "1Exy: Change additional parameters"}},
{0x20, {DIV_CMD_C64_AD, "20xy: Set attack/decay (x: attack; y: decay)"}},
{0x21, {DIV_CMD_C64_SR, "21xy: Set sustain/release (x: sustain; y: release)"}},
};
const EffectHandler c64FineDutyHandler(DIV_CMD_C64_FINE_DUTY, "3xxx: Set pulse width (0 to FFF)", effectValLong<12>);
const EffectHandler c64FineCutoffHandler(DIV_CMD_C64_FINE_CUTOFF, "4xxx: Set cutoff (0 to 7FF)", effectValLong<11>);