Revert "volume handling refactor, part 1 - BEWARE"

This reverts commit e1cb84a076.
This commit is contained in:
tildearrow 2023-11-04 04:13:20 -05:00
parent e1cb84a076
commit 54187d043d
5 changed files with 39 additions and 40 deletions

View file

@ -43,6 +43,7 @@ void DivMacroStruct::prepare(DivInstrumentMacro& source, DivEngine* e) {
mode=source.mode;
type=(source.open>>1)&3;
activeRelease=source.open&8;
linger=(source.macroType==DIV_MACRO_VOL && e->song.volMacroLinger);
lfoPos=LFO_PHASE;
}
@ -63,7 +64,7 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
}
if (delay>0) {
delay--;
had=false;
if (!linger) had=false;
return;
}
if (began && source.delay>0) {
@ -97,6 +98,8 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
if (pos>=source.len) {
if (source.loop<source.len && (source.loop>=source.rel || source.rel>=source.len)) {
pos=source.loop;
} else if (linger) {
pos--;
} else {
has=false;
}
@ -137,7 +140,7 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
break;
case 4: // end
pos=0;
has=false;
if (!linger) has=false;
break;
}
val=ADSR_LOW+((pos+(ADSR_HIGH-ADSR_LOW)*pos)>>8);
@ -250,11 +253,6 @@ void DivMacroInt::setEngine(DivEngine* eng) {
e=eng;
}
bool DivMacroInt::brokenOutVol() {
if (e==NULL) return false;
return e->song.brokenOutVol;
}
#define ADD_MACRO(m,s) \
if (!m.masked) { \
macroList[macroListLen]=&m; \