volume handling refactor, part 1 - BEWARE

do not use these versions for production. your modules will break until this is finished!

only Amiga is done for now
This commit is contained in:
tildearrow 2023-11-03 14:46:23 -05:00
parent 4e48e87313
commit e1cb84a076
5 changed files with 40 additions and 39 deletions

View file

@ -43,7 +43,6 @@ 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;
}
@ -64,7 +63,7 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
}
if (delay>0) {
delay--;
if (!linger) had=false;
had=false;
return;
}
if (began && source.delay>0) {
@ -98,8 +97,6 @@ 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;
}
@ -140,7 +137,7 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
break;
case 4: // end
pos=0;
if (!linger) has=false;
has=false;
break;
}
val=ADSR_LOW+((pos+(ADSR_HIGH-ADSR_LOW)*pos)>>8);
@ -253,6 +250,11 @@ 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; \