macro name refactor

This commit is contained in:
tildearrow 2023-10-05 23:51:34 -05:00
parent 2f9320ca7a
commit 687fbf5436
5 changed files with 243 additions and 219 deletions

View file

@ -29,6 +29,7 @@ struct DivMacroStruct {
int val;
bool has, had, actualHad, finished, will, linger, began, masked;
unsigned int mode, type;
unsigned char macroType;
void doMacro(DivInstrumentMacro& source, bool released, bool tick);
void init() {
pos=lastPos=lfoPos=mode=type=delay=0;
@ -39,7 +40,7 @@ struct DivMacroStruct {
val=0;
}
void prepare(DivInstrumentMacro& source, DivEngine* e);
DivMacroStruct():
DivMacroStruct(unsigned char mType):
pos(0),
lastPos(0),
lfoPos(0),
@ -54,7 +55,8 @@ struct DivMacroStruct {
began(true),
masked(false),
mode(0),
type(0) {}
type(0),
macroType(mType) {}
};
class DivMacroInt {
@ -81,26 +83,26 @@ class DivMacroInt {
DivMacroStruct dam, dvb, egt, ksl;
DivMacroStruct sus, vib, ws, ksr;
IntOp():
am(),
ar(),
dr(),
mult(),
rr(),
sl(),
tl(),
dt2(),
rs(),
dt(),
d2r(),
ssg(),
dam(),
dvb(),
egt(),
ksl(),
sus(),
vib(),
ws(),
ksr() {}
am(DIV_MACRO_OP_AM),
ar(DIV_MACRO_OP_AR),
dr(DIV_MACRO_OP_DR),
mult(DIV_MACRO_OP_MULT),
rr(DIV_MACRO_OP_RR),
sl(DIV_MACRO_OP_SL),
tl(DIV_MACRO_OP_TL),
dt2(DIV_MACRO_OP_DT2),
rs(DIV_MACRO_OP_RS),
dt(DIV_MACRO_OP_DT),
d2r(DIV_MACRO_OP_D2R),
ssg(DIV_MACRO_OP_SSG),
dam(DIV_MACRO_OP_DAM),
dvb(DIV_MACRO_OP_DVB),
egt(DIV_MACRO_OP_EGT),
ksl(DIV_MACRO_OP_KSL),
sus(DIV_MACRO_OP_SUS),
vib(DIV_MACRO_OP_VIB),
ws(DIV_MACRO_OP_WS),
ksr(DIV_MACRO_OP_KSR) {}
} op[4];
// state
@ -140,11 +142,11 @@ class DivMacroInt {
void notifyInsDeletion(DivInstrument* which);
/**
* get DivMacroStruct by macro name.
* @param which the macro name.
* get DivMacroStruct by macro type.
* @param which the macro type.
* @return a DivMacroStruct, or NULL if none found.
*/
DivMacroStruct* structByName(const String& name);
DivMacroStruct* structByType(unsigned char which);
DivMacroInt():
e(NULL),
@ -152,26 +154,26 @@ class DivMacroInt {
macroListLen(0),
subTick(1),
released(false),
vol(),
arp(),
duty(),
wave(),
pitch(),
ex1(),
ex2(),
ex3(),
alg(),
fb(),
fms(),
ams(),
panL(),
panR(),
phaseReset(),
ex4(),
ex5(),
ex6(),
ex7(),
ex8(),
vol(DIV_MACRO_VOL),
arp(DIV_MACRO_ARP),
duty(DIV_MACRO_DUTY),
wave(DIV_MACRO_WAVE),
pitch(DIV_MACRO_PITCH),
ex1(DIV_MACRO_EX1),
ex2(DIV_MACRO_EX2),
ex3(DIV_MACRO_EX3),
alg(DIV_MACRO_ALG),
fb(DIV_MACRO_FB),
fms(DIV_MACRO_FMS),
ams(DIV_MACRO_AMS),
panL(DIV_MACRO_PAN_LEFT),
panR(DIV_MACRO_PAN_RIGHT),
phaseReset(DIV_MACRO_PHASE_RESET),
ex4(DIV_MACRO_EX4),
ex5(DIV_MACRO_EX5),
ex6(DIV_MACRO_EX6),
ex7(DIV_MACRO_EX7),
ex8(DIV_MACRO_EX8),
hasRelease(false) {
memset(macroList,0,128*sizeof(void*));
memset(macroSource,0,128*sizeof(void*));