add experimental low-latency mode

do not use (yet)!
This commit is contained in:
tildearrow 2022-04-15 05:37:23 -05:00
parent d47a59f5f0
commit 96715ed88c
38 changed files with 201 additions and 120 deletions

View file

@ -19,6 +19,7 @@
#include "macroInt.h"
#include "instrument.h"
#include "engine.h"
void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released) {
if (finished) {
@ -51,9 +52,16 @@ void DivMacroInt::next() {
if (ins==NULL) return;
// run macros
// TODO: potentially get rid of list to avoid allocations
for (size_t i=0; i<macroListLen; i++) {
if (macroList[i]!=NULL && macroSource[i]!=NULL) {
macroList[i]->doMacro(*macroSource[i],released);
if (--subTick<=0) {
if (e==NULL) {
subTick=1;
} else {
subTick=e->tickMult;
}
for (size_t i=0; i<macroListLen; i++) {
if (macroList[i]!=NULL && macroSource[i]!=NULL) {
macroList[i]->doMacro(*macroSource[i],released);
}
}
}
}
@ -62,6 +70,10 @@ void DivMacroInt::release() {
released=true;
}
void DivMacroInt::setEngine(DivEngine* eng) {
e=eng;
}
#define ADD_MACRO(m,s) \
macroList[macroListLen]=&m; \
macroSource[macroListLen++]=&s;