implement DCxx effect

delayed mute
This commit is contained in:
tildearrow 2024-07-17 04:11:24 -05:00
parent 9bf4cd8dd8
commit f0f0b7fcd6
5 changed files with 37 additions and 3 deletions

View file

@ -98,6 +98,8 @@ const char* DivEngine::getEffectDesc(unsigned char effect, int chan, bool notNul
break; break;
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc0: case 0xc1: case 0xc2: case 0xc3:
return _("Cxxx: Set tick rate (hz)"); return _("Cxxx: Set tick rate (hz)");
case 0xdc:
return _("DCxx: Delayed mute");
case 0xe0: case 0xe0:
return _("E0xx: Set arp speed"); return _("E0xx: Set arp speed");
case 0xe1: case 0xe1:

View file

@ -133,7 +133,7 @@ struct DivAudioExportOptions {
struct DivChannelState { struct DivChannelState {
std::vector<DivDelayedCommand> delayed; std::vector<DivDelayedCommand> delayed;
int note, oldNote, lastIns, pitch, portaSpeed, portaNote; int note, oldNote, lastIns, pitch, portaSpeed, portaNote;
int volume, volSpeed, cut, legatoDelay, legatoTarget, rowDelay, volMax; int volume, volSpeed, cut, volCut, legatoDelay, legatoTarget, rowDelay, volMax;
int delayOrder, delayRow, retrigSpeed, retrigTick; int delayOrder, delayRow, retrigSpeed, retrigTick;
int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoShape, vibratoFine; int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoShape, vibratoFine;
int tremoloDepth, tremoloRate, tremoloPos; int tremoloDepth, tremoloRate, tremoloPos;
@ -158,6 +158,7 @@ struct DivChannelState {
volume(0x7f00), volume(0x7f00),
volSpeed(0), volSpeed(0),
cut(-1), cut(-1),
volCut(-1),
legatoDelay(-1), legatoDelay(-1),
legatoTarget(0), legatoTarget(0),
rowDelay(0), rowDelay(0),

View file

@ -1077,8 +1077,24 @@ bool DivEngine::loadXM(unsigned char* file, size_t len) {
p->data[j][effectCol[k]++]=0x0c; p->data[j][effectCol[k]++]=0x0c;
p->data[j][effectCol[k]++]=(effectVal&15); p->data[j][effectCol[k]++]=(effectVal&15);
break; break;
case 0xa: // vol slide up (fine)
volSlideStatus[k]=((effectVal&15)<<4)|0xf;
volSlideStatusChanged[k]=true;
if (hasNote || hasIns) {
volSlideStatusChanged[k]=true;
}
volSliding[k]=true;
break;
case 0xb: // vol slide down (fine)
volSlideStatus[k]=0xf0|(effectVal&15);
volSlideStatusChanged[k]=true;
if (hasNote || hasIns) {
volSlideStatusChanged[k]=true;
}
volSliding[k]=true;
break;
case 0xc: case 0xc:
p->data[j][effectCol[k]++]=0xec; p->data[j][effectCol[k]++]=0xdc;
p->data[j][effectCol[k]++]=MAX(1,effectVal&15); p->data[j][effectCol[k]++]=MAX(1,effectVal&15);
break; break;
case 0xd: case 0xd:

View file

@ -932,6 +932,12 @@ void DivEngine::processRow(int i, bool afterDelay) {
clockDrift=0; clockDrift=0;
subticks=0; subticks=0;
break; break;
case 0xdc: // delayed mute
if (effectVal>0 && (song.delayBehavior==2 || effectVal<nextSpeed)) {
chan[i].volCut=effectVal+1;
chan[i].cutType=0;
}
break;
case 0xe0: // arp speed case 0xe0: // arp speed
if (effectVal>0) { if (effectVal>0) {
curSubSong->arpLen=effectVal; curSubSong->arpLen=effectVal;
@ -1781,6 +1787,15 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
} }
} }
// volume cut/mute
if (chan[i].volCut>0) {
if (--chan[i].volCut<1) {
chan[i].volume=0;
dispatchCmd(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
dispatchCmd(DivCommand(DIV_CMD_HINT_VOLUME,i,chan[i].volume>>8));
}
}
// arpeggio // arpeggio
if (chan[i].resetArp) { if (chan[i].resetArp) {
dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note)); dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));

View file

@ -482,7 +482,7 @@ const FurnaceGUIColors fxColors[256]={
GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID,
GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID,
GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID,
GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_VOLUME, // DC
GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID,
GUI_COLOR_PATTERN_EFFECT_INVALID, GUI_COLOR_PATTERN_EFFECT_INVALID,
GUI_COLOR_PATTERN_EFFECT_MISC, // DF GUI_COLOR_PATTERN_EFFECT_MISC, // DF