finish work on ADSR/LFO macro type

This commit is contained in:
tildearrow 2022-10-07 16:47:18 -05:00
parent 3ffe257158
commit 66234df636
3 changed files with 44 additions and 3 deletions

View file

@ -182,6 +182,8 @@ struct DivInstrumentMacro {
// the following variables are used by the GUI and not saved in the file
int vScroll, vZoom;
int typeMemory[16];
unsigned char lenMemory;
explicit DivInstrumentMacro(const String& n, bool initOpen=false):
name(n),
@ -193,8 +195,10 @@ struct DivInstrumentMacro {
loop(255),
rel(255),
vScroll(0),
vZoom(-1) {
vZoom(-1),
lenMemory(0) {
memset(val,0,256*sizeof(int));
memset(typeMemory,0,16*sizeof(int));
}
};

View file

@ -332,7 +332,14 @@ void DivMacroInt::init(DivInstrument* which) {
for (size_t i=0; i<macroListLen; i++) {
if (macroSource[i]!=NULL) {
macroList[i]->prepare(*macroSource[i],e);
hasRelease=(macroSource[i]->rel<macroSource[i]->len);
// check ADSR mode
if ((macroSource[i]->open&6)==4) {
hasRelease=false;
} else if ((macroSource[i]->open&6)==2) {
hasRelease=true;
} else {
hasRelease=(macroSource[i]->rel<macroSource[i]->len);
}
} else {
hasRelease=false;
}