parent
a945ee5353
commit
b8a0084587
4 changed files with 27 additions and 7 deletions
|
|
@ -21,6 +21,12 @@
|
|||
#include "instrument.h"
|
||||
#include "engine.h"
|
||||
|
||||
void DivMacroStruct::prepare(DivInstrumentMacro& source, DivEngine* e) {
|
||||
has=had=actualHad=will=true;
|
||||
mode=source.mode;
|
||||
linger=(source.name=="vol" && e->song.volMacroLinger);
|
||||
}
|
||||
|
||||
void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tick) {
|
||||
if (!tick) {
|
||||
had=false;
|
||||
|
|
@ -46,6 +52,8 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
|
|||
if (pos>=source.len) {
|
||||
if (source.loop<source.len && source.loop>=0 && (source.loop>=source.rel || source.rel>=source.len)) {
|
||||
pos=source.loop;
|
||||
} else if (linger) {
|
||||
pos--;
|
||||
} else {
|
||||
has=false;
|
||||
}
|
||||
|
|
@ -228,7 +236,7 @@ void DivMacroInt::init(DivInstrument* which) {
|
|||
}
|
||||
|
||||
for (size_t i=0; i<macroListLen; i++) {
|
||||
macroList[i]->prepare(*macroSource[i]);
|
||||
macroList[i]->prepare(*macroSource[i],e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,19 +27,17 @@ class DivEngine;
|
|||
struct DivMacroStruct {
|
||||
int pos;
|
||||
int val;
|
||||
bool has, had, actualHad, finished, will;
|
||||
bool has, had, actualHad, finished, will, linger;
|
||||
unsigned int mode;
|
||||
void doMacro(DivInstrumentMacro& source, bool released, bool tick);
|
||||
void init() {
|
||||
pos=mode=0;
|
||||
has=had=actualHad=will=false;
|
||||
linger=false;
|
||||
// TODO: test whether this breaks anything?
|
||||
val=0;
|
||||
}
|
||||
void prepare(DivInstrumentMacro& source) {
|
||||
has=had=actualHad=will=true;
|
||||
mode=source.mode;
|
||||
}
|
||||
void prepare(DivInstrumentMacro& source, DivEngine* e);
|
||||
DivMacroStruct():
|
||||
pos(0),
|
||||
val(0),
|
||||
|
|
@ -48,6 +46,7 @@ struct DivMacroStruct {
|
|||
actualHad(false),
|
||||
finished(false),
|
||||
will(false),
|
||||
linger(false),
|
||||
mode(0) {}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue