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

@ -31,7 +31,7 @@ template<typename T> struct SharedChannel {
int freq, baseFreq, baseNoteOverride, pitch, pitch2, arpOff;
int ins, note;
bool active, insChanged, freqChanged, fixedArp, keyOn, keyOff, portaPause, inPorta, volChanged;
T vol, outVol;
T vol, macroVol, outVol, maxVol;
DivMacroInt std;
void handleArp(int offset=0) {
if (std.arp.had) {
@ -61,6 +61,19 @@ template<typename T> struct SharedChannel {
arpOff=0;
baseNoteOverride=0;
fixedArp=false;
if (active && !std.brokenOutVol()) {
if (which==NULL) {
if (macroVol!=maxVol) {
macroVol=maxVol;
volChanged=true;
}
} else if (which->std.volMacro.len==0) {
if (macroVol!=maxVol) {
macroVol=maxVol;
volChanged=true;
}
}
}
}
SharedChannel(T initVol):
freq(0),
@ -79,9 +92,11 @@ template<typename T> struct SharedChannel {
keyOff(false),
portaPause(false),
inPorta(false),
volChanged(false),
volChanged(true),
vol(initVol),
macroVol(initVol),
outVol(initVol),
maxVol(initVol),
std() {}
};