Prepare for macro refactoring

This commit is contained in:
cam900 2022-04-10 14:01:55 +09:00
parent 9e0e8f3345
commit d3e5efe834
43 changed files with 2337 additions and 2309 deletions

View file

@ -21,127 +21,115 @@
#define _MACROINT_H
#include "instrument.h"
#include <list>
struct DivMacroStruct {
DivInstrumentMacro* source;
int pos;
int val;
bool has, had, finished, will;
unsigned int mode;
void doMacro(DivInstrumentMacro& source, bool released);
void init() {
source=NULL;
pos=mode=0;
has=had=will=false;
}
void prepare(DivInstrumentMacro* s) {
if (s!=NULL) {
source=s;
has=had=will=true;
mode=source->mode;
}
}
DivMacroStruct():
source(NULL),
pos(0),
val(0),
has(false),
had(false),
finished(false),
will(false),
mode(0) {}
};
struct DivMacroExecList {
DivMacroStruct& macro;
DivInstrumentMacro& source;
void prepare() {
macro.prepare(&source);
}
void doMacro(bool released) {
macro.doMacro(source, released);
}
DivMacroExecList(DivMacroStruct &m, DivInstrumentMacro& s):
macro(m),
source(s) {}
};
class DivMacroInt {
DivInstrument* ins;
int volPos, arpPos, dutyPos, wavePos, pitchPos, ex1Pos, ex2Pos, ex3Pos;
int algPos, fbPos, fmsPos, amsPos;
int panLPos, panRPos, phaseResetPos, ex4Pos, ex5Pos, ex6Pos, ex7Pos, ex8Pos;
std::list<DivMacroExecList> macroList;
bool released;
public:
int vol;
int arp;
int duty, wave, pitch, ex1, ex2, ex3;
int alg, fb, fms, ams;
int panL, panR, phaseReset, ex4, ex5, ex6, ex7, ex8;
bool hasVol, hasArp, hasDuty, hasWave, hasPitch, hasEx1, hasEx2, hasEx3, hasAlg, hasFb, hasFms, hasAms;
bool hasPanL, hasPanR, hasPhaseReset, hasEx4, hasEx5, hasEx6, hasEx7, hasEx8;
bool hadVol, hadArp, hadDuty, hadWave, hadPitch, hadEx1, hadEx2, hadEx3, hadAlg, hadFb, hadFms, hadAms;
bool hadPanL, hadPanR, hadPhaseReset, hadEx4, hadEx5, hadEx6, hadEx7, hadEx8;
bool finishedVol, finishedArp, finishedDuty, finishedWave, finishedPitch, finishedEx1, finishedEx2, finishedEx3;
bool finishedAlg, finishedFb, finishedFms, finishedAms;
bool finishedPanL, finishedPanR, finishedPhaseReset, finishedEx4, finishedEx5, finishedEx6, finishedEx7, finishedEx8;
bool willVol, willArp, willDuty, willWave, willPitch, willEx1, willEx2, willEx3, willAlg, willFb, willFms, willAms;
bool willPanL, willPanR, willPhaseReset, willEx4, willEx5, willEx6, willEx7, willEx8;
bool arpMode;
// common macro
DivMacroStruct vol;
DivMacroStruct arp;
DivMacroStruct duty, wave, pitch, ex1, ex2, ex3;
DivMacroStruct alg, fb, fms, fms2, ams, ams2;
DivMacroStruct panL, panR, phaseReset, ex4, ex5, ex6, ex7, ex8;
// FM operator macro
struct IntOp {
int amPos, arPos, drPos, multPos;
int rrPos, slPos, tlPos, dt2Pos;
int rsPos, dtPos, d2rPos, ssgPos;
int damPos, dvbPos, egtPos, kslPos;
int susPos, vibPos, wsPos, ksrPos;
int am, ar, dr, mult;
int rr, sl, tl, dt2;
int rs, dt, d2r, ssg;
int dam, dvb, egt, ksl;
int sus, vib, ws, ksr;
bool hasAm, hasAr, hasDr, hasMult;
bool hasRr, hasSl, hasTl, hasDt2;
bool hasRs, hasDt, hasD2r, hasSsg;
bool hasDam, hasDvb, hasEgt, hasKsl;
bool hasSus, hasVib, hasWs, hasKsr;
bool hadAm, hadAr, hadDr, hadMult;
bool hadRr, hadSl, hadTl, hadDt2;
bool hadRs, hadDt, hadD2r, hadSsg;
bool hadDam, hadDvb, hadEgt, hadKsl;
bool hadSus, hadVib, hadWs, hadKsr;
bool finishedAm, finishedAr, finishedDr, finishedMult;
bool finishedRr, finishedSl, finishedTl, finishedDt2;
bool finishedRs, finishedDt, finishedD2r, finishedSsg;
bool finishedDam, finishedDvb, finishedEgt, finishedKsl;
bool finishedSus, finishedVib, finishedWs, finishedKsr;
bool willAm, willAr, willDr, willMult;
bool willRr, willSl, willTl, willDt2;
bool willRs, willDt, willD2r, willSsg;
bool willDam, willDvb, willEgt, willKsl;
bool willSus, willVib, willWs, willKsr;
DivMacroStruct am, ar, dr, mult;
DivMacroStruct rr, sl, tl, dt2;
DivMacroStruct rs, dt, d2r, ssg;
DivMacroStruct dam, dvb, egt, ksl;
DivMacroStruct sus, vib, ws, ksr;
IntOp():
amPos(0),
arPos(0),
drPos(0),
multPos(0),
rrPos(0),
slPos(0),
tlPos(0),
dt2Pos(0),
rsPos(0),
dtPos(0),
d2rPos(0),
ssgPos(0),
damPos(0),
dvbPos(0),
egtPos(0),
kslPos(0),
susPos(0),
vibPos(0),
wsPos(0),
ksrPos(0),
am(0),
ar(0),
dr(0),
mult(0),
rr(0),
sl(0),
tl(0),
dt2(0),
rs(0),
dt(0),
d2r(0),
ssg(0),
dam(0),
dvb(0),
egt(0),
ksl(0),
sus(0),
vib(0),
ws(0),
ksr(0),
hasAm(false), hasAr(false), hasDr(false), hasMult(false),
hasRr(false), hasSl(false), hasTl(false), hasDt2(false),
hasRs(false), hasDt(false), hasD2r(false), hasSsg(false),
hasDam(false), hasDvb(false), hasEgt(false), hasKsl(false),
hasSus(false), hasVib(false), hasWs(false), hasKsr(false),
hadAm(false), hadAr(false), hadDr(false), hadMult(false),
hadRr(false), hadSl(false), hadTl(false), hadDt2(false),
hadRs(false), hadDt(false), hadD2r(false), hadSsg(false),
hadDam(false), hadDvb(false), hadEgt(false), hadKsl(false),
hadSus(false), hadVib(false), hadWs(false), hadKsr(false),
finishedAm(false), finishedAr(false), finishedDr(false), finishedMult(false),
finishedRr(false), finishedSl(false), finishedTl(false), finishedDt2(false),
finishedRs(false), finishedDt(false), finishedD2r(false), finishedSsg(false),
finishedDam(false), finishedDvb(false), finishedEgt(false), finishedKsl(false),
finishedSus(false), finishedVib(false), finishedWs(false), finishedKsr(false),
willAm(false), willAr(false), willDr(false), willMult(false),
willRr(false), willSl(false), willTl(false), willDt2(false),
willRs(false), willDt(false), willD2r(false), willSsg(false),
willDam(false), willDvb(false), willEgt(false), willKsl(false),
willSus(false), willVib(false), willWs(false), willKsr(false) {}
am(),
ar(),
dr(),
mult(),
rr(),
sl(),
tl(),
dt2(),
rs(),
dt(),
d2r(),
ssg(),
dam(),
dvb(),
egt(),
ksl(),
sus(),
vib(),
ws(),
ksr() {}
} op[4];
// wavesynth macro
struct IntWS {
DivMacroStruct wave1, wave2;
DivMacroStruct rateDivider;
DivMacroStruct effect;
DivMacroStruct oneShot, enabled, global;
DivMacroStruct speed, param1, param2, param3, param4;
IntWS():
wave1(),
wave2(),
rateDivider(),
effect(),
oneShot(),
enabled(),
global(),
speed(),
param1(),
param2(),
param3(),
param4() {}
} ws;
/**
* trigger macro release.
@ -167,128 +155,29 @@ class DivMacroInt {
DivMacroInt():
ins(NULL),
volPos(0),
arpPos(0),
dutyPos(0),
wavePos(0),
pitchPos(0),
ex1Pos(0),
ex2Pos(0),
ex3Pos(0),
algPos(0),
fbPos(0),
fmsPos(0),
amsPos(0),
panLPos(0),
panRPos(0),
phaseResetPos(0),
ex4Pos(0),
ex5Pos(0),
ex6Pos(0),
ex7Pos(0),
ex8Pos(0),
released(false),
vol(0),
arp(0),
duty(0),
wave(0),
pitch(0),
ex1(0),
ex2(0),
ex3(0),
alg(0),
fb(0),
fms(0),
ams(0),
panL(0),
panR(0),
phaseReset(0),
ex4(0),
ex5(0),
ex6(0),
ex7(0),
ex8(0),
hasVol(false),
hasArp(false),
hasDuty(false),
hasWave(false),
hasPitch(false),
hasEx1(false),
hasEx2(false),
hasEx3(false),
hasAlg(false),
hasFb(false),
hasFms(false),
hasAms(false),
hasPanL(false),
hasPanR(false),
hasPhaseReset(false),
hasEx4(false),
hasEx5(false),
hasEx6(false),
hasEx7(false),
hasEx8(false),
hadVol(false),
hadArp(false),
hadDuty(false),
hadWave(false),
hadPitch(false),
hadEx1(false),
hadEx2(false),
hadEx3(false),
hadAlg(false),
hadFb(false),
hadFms(false),
hadAms(false),
hadPanL(false),
hadPanR(false),
hadPhaseReset(false),
hadEx4(false),
hadEx5(false),
hadEx6(false),
hadEx7(false),
hadEx8(false),
finishedVol(false),
finishedArp(false),
finishedDuty(false),
finishedWave(false),
finishedPitch(false),
finishedEx1(false),
finishedEx2(false),
finishedEx3(false),
finishedAlg(false),
finishedFb(false),
finishedFms(false),
finishedAms(false),
finishedPanL(false),
finishedPanR(false),
finishedPhaseReset(false),
finishedEx4(false),
finishedEx5(false),
finishedEx6(false),
finishedEx7(false),
finishedEx8(false),
willVol(false),
willArp(false),
willDuty(false),
willWave(false),
willPitch(false),
willEx1(false),
willEx2(false),
willEx3(false),
willAlg(false),
willFb(false),
willFms(false),
willAms(false),
willPanL(false),
willPanR(false),
willPhaseReset(false),
willEx4(false),
willEx5(false),
willEx6(false),
willEx7(false),
willEx8(false),
arpMode(false) {}
vol(),
arp(),
duty(),
wave(),
pitch(),
ex1(),
ex2(),
ex3(),
alg(),
fb(),
fms(),
fms2(),
ams(),
ams2(),
panL(),
panR(),
phaseReset(),
ex4(),
ex5(),
ex6(),
ex7(),
ex8() {}
};
#endif