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

@ -291,7 +291,7 @@ void DivInstrument::writeFeatureFM(SafeWriter* w, bool fui) {
FEATURE_END;
}
void DivInstrument::writeMacro(SafeWriter* w, const DivInstrumentMacro& m, unsigned char macroCode) {
void DivInstrument::writeMacro(SafeWriter* w, const DivInstrumentMacro& m) {
if (!m.len) return;
// determine word size
@ -314,7 +314,7 @@ void DivInstrument::writeMacro(SafeWriter* w, const DivInstrumentMacro& m, unsig
wordSize=192; // 32-bit signed
}
w->writeC(macroCode);
w->writeC(m.macroType&31);
w->writeC(m.len);
w->writeC(m.loop);
w->writeC(m.rel);
@ -355,26 +355,26 @@ void DivInstrument::writeFeatureMA(SafeWriter* w) {
w->writeS(8);
// write macros
writeMacro(w,std.volMacro,0);
writeMacro(w,std.arpMacro,1);
writeMacro(w,std.dutyMacro,2);
writeMacro(w,std.waveMacro,3);
writeMacro(w,std.pitchMacro,4);
writeMacro(w,std.ex1Macro,5);
writeMacro(w,std.ex2Macro,6);
writeMacro(w,std.ex3Macro,7);
writeMacro(w,std.algMacro,8);
writeMacro(w,std.fbMacro,9);
writeMacro(w,std.fmsMacro,10);
writeMacro(w,std.amsMacro,11);
writeMacro(w,std.panLMacro,12);
writeMacro(w,std.panRMacro,13);
writeMacro(w,std.phaseResetMacro,14);
writeMacro(w,std.ex4Macro,15);
writeMacro(w,std.ex5Macro,16);
writeMacro(w,std.ex6Macro,17);
writeMacro(w,std.ex7Macro,18);
writeMacro(w,std.ex8Macro,19);
writeMacro(w,std.volMacro);
writeMacro(w,std.arpMacro);
writeMacro(w,std.dutyMacro);
writeMacro(w,std.waveMacro);
writeMacro(w,std.pitchMacro);
writeMacro(w,std.ex1Macro);
writeMacro(w,std.ex2Macro);
writeMacro(w,std.ex3Macro);
writeMacro(w,std.algMacro);
writeMacro(w,std.fbMacro);
writeMacro(w,std.fmsMacro);
writeMacro(w,std.amsMacro);
writeMacro(w,std.panLMacro);
writeMacro(w,std.panRMacro);
writeMacro(w,std.phaseResetMacro);
writeMacro(w,std.ex4Macro);
writeMacro(w,std.ex5Macro);
writeMacro(w,std.ex6Macro);
writeMacro(w,std.ex7Macro);
writeMacro(w,std.ex8Macro);
// "stop reading" code
w->writeC(-1);
@ -471,26 +471,26 @@ void DivInstrument::writeFeatureOx(SafeWriter* w, int ope) {
// write macros
const DivInstrumentSTD::OpMacro& o=std.opMacros[ope];
writeMacro(w,o.amMacro,0);
writeMacro(w,o.arMacro,1);
writeMacro(w,o.drMacro,2);
writeMacro(w,o.multMacro,3);
writeMacro(w,o.rrMacro,4);
writeMacro(w,o.slMacro,5);
writeMacro(w,o.tlMacro,6);
writeMacro(w,o.dt2Macro,7);
writeMacro(w,o.rsMacro,8);
writeMacro(w,o.dtMacro,9);
writeMacro(w,o.d2rMacro,10);
writeMacro(w,o.ssgMacro,11);
writeMacro(w,o.damMacro,12);
writeMacro(w,o.dvbMacro,13);
writeMacro(w,o.egtMacro,14);
writeMacro(w,o.kslMacro,15);
writeMacro(w,o.susMacro,16);
writeMacro(w,o.vibMacro,17);
writeMacro(w,o.wsMacro,18);
writeMacro(w,o.ksrMacro,19);
writeMacro(w,o.amMacro);
writeMacro(w,o.arMacro);
writeMacro(w,o.drMacro);
writeMacro(w,o.multMacro);
writeMacro(w,o.rrMacro);
writeMacro(w,o.slMacro);
writeMacro(w,o.tlMacro);
writeMacro(w,o.dt2Macro);
writeMacro(w,o.rsMacro);
writeMacro(w,o.dtMacro);
writeMacro(w,o.d2rMacro);
writeMacro(w,o.ssgMacro);
writeMacro(w,o.damMacro);
writeMacro(w,o.dvbMacro);
writeMacro(w,o.egtMacro);
writeMacro(w,o.kslMacro);
writeMacro(w,o.susMacro);
writeMacro(w,o.vibMacro);
writeMacro(w,o.wsMacro);
writeMacro(w,o.ksrMacro);
// "stop reading" code
w->writeC(-1);

View file

@ -89,6 +89,52 @@ enum DivInstrumentType: unsigned short {
DIV_INS_NULL
};
enum DivMacroType: unsigned char {
DIV_MACRO_VOL=0,
DIV_MACRO_ARP,
DIV_MACRO_DUTY,
DIV_MACRO_WAVE,
DIV_MACRO_PITCH,
DIV_MACRO_EX1,
DIV_MACRO_EX2,
DIV_MACRO_EX3,
DIV_MACRO_ALG,
DIV_MACRO_FB,
DIV_MACRO_FMS,
DIV_MACRO_AMS,
DIV_MACRO_PAN_LEFT,
DIV_MACRO_PAN_RIGHT,
DIV_MACRO_PHASE_RESET,
DIV_MACRO_EX4,
DIV_MACRO_EX5,
DIV_MACRO_EX6,
DIV_MACRO_EX7,
DIV_MACRO_EX8
};
enum DivMacroTypeOp: unsigned char {
DIV_MACRO_OP_AM=32,
DIV_MACRO_OP_AR,
DIV_MACRO_OP_DR,
DIV_MACRO_OP_MULT,
DIV_MACRO_OP_RR,
DIV_MACRO_OP_SL,
DIV_MACRO_OP_TL,
DIV_MACRO_OP_DT2,
DIV_MACRO_OP_RS,
DIV_MACRO_OP_DT,
DIV_MACRO_OP_D2R,
DIV_MACRO_OP_SSG,
DIV_MACRO_OP_DAM,
DIV_MACRO_OP_DVB,
DIV_MACRO_OP_EGT,
DIV_MACRO_OP_KSL,
DIV_MACRO_OP_SUS,
DIV_MACRO_OP_VIB,
DIV_MACRO_OP_WS,
DIV_MACRO_OP_KSR,
};
// FM operator structure:
// - OPN:
// - AM, AR, DR, MULT, RR, SL, TL, RS, DT, D2R, SSG-EG
@ -198,7 +244,9 @@ struct DivInstrumentFM {
// this is getting out of hand
struct DivInstrumentMacro {
String name;
// 0-31: normal
// 32+: operator (top 3 bits select operator, starting from 1)
unsigned char macroType;
int val[256];
unsigned int mode;
unsigned char open;
@ -209,8 +257,8 @@ struct DivInstrumentMacro {
int typeMemory[16];
unsigned char lenMemory;
explicit DivInstrumentMacro(const String& n, bool initOpen=false):
name(n),
explicit DivInstrumentMacro(unsigned char initType, bool initOpen=false):
macroType(initType),
mode(0),
open(initOpen),
len(0),
@ -271,33 +319,57 @@ struct DivInstrumentSTD {
DivInstrumentMacro wsMacro;
DivInstrumentMacro ksrMacro;
OpMacro():
amMacro("am"), arMacro("ar"), drMacro("dr"), multMacro("mult"),
rrMacro("rr"), slMacro("sl"), tlMacro("tl",true), dt2Macro("dt2"),
rsMacro("rs"), dtMacro("dt"), d2rMacro("d2r"), ssgMacro("ssg"),
damMacro("dam"), dvbMacro("dvb"), egtMacro("egt"), kslMacro("ksl"),
susMacro("sus"), vibMacro("vib"), wsMacro("ws"), ksrMacro("ksr") {}
amMacro(DIV_MACRO_OP_AM), arMacro(DIV_MACRO_OP_AR), drMacro(DIV_MACRO_OP_DR), multMacro(DIV_MACRO_OP_MULT),
rrMacro(DIV_MACRO_OP_RR), slMacro(DIV_MACRO_OP_SL), tlMacro(DIV_MACRO_OP_TL,true), dt2Macro(DIV_MACRO_OP_DT2),
rsMacro(DIV_MACRO_OP_RS), dtMacro(DIV_MACRO_OP_DT), d2rMacro(DIV_MACRO_OP_D2R), ssgMacro(DIV_MACRO_OP_SSG),
damMacro(DIV_MACRO_OP_DAM), dvbMacro(DIV_MACRO_OP_DVB), egtMacro(DIV_MACRO_OP_EGT), kslMacro(DIV_MACRO_OP_KSL),
susMacro(DIV_MACRO_OP_SUS), vibMacro(DIV_MACRO_OP_VIB), wsMacro(DIV_MACRO_OP_WS), ksrMacro(DIV_MACRO_OP_KSR) {}
} opMacros[4];
DivInstrumentSTD():
volMacro("vol",true),
arpMacro("arp"),
dutyMacro("duty"),
waveMacro("wave"),
pitchMacro("pitch"),
ex1Macro("ex1"),
ex2Macro("ex2"),
ex3Macro("ex3"),
algMacro("alg"),
fbMacro("fb"),
fmsMacro("fms"),
amsMacro("ams"),
panLMacro("panL"),
panRMacro("panR"),
phaseResetMacro("phaseReset"),
ex4Macro("ex4"),
ex5Macro("ex5"),
ex6Macro("ex6"),
ex7Macro("ex7"),
ex8Macro("ex8") {}
volMacro(DIV_MACRO_VOL,true),
arpMacro(DIV_MACRO_ARP),
dutyMacro(DIV_MACRO_DUTY),
waveMacro(DIV_MACRO_WAVE),
pitchMacro(DIV_MACRO_PITCH),
ex1Macro(DIV_MACRO_EX1),
ex2Macro(DIV_MACRO_EX2),
ex3Macro(DIV_MACRO_EX3),
algMacro(DIV_MACRO_ALG),
fbMacro(DIV_MACRO_FB),
fmsMacro(DIV_MACRO_FMS),
amsMacro(DIV_MACRO_AMS),
panLMacro(DIV_MACRO_PAN_LEFT),
panRMacro(DIV_MACRO_PAN_RIGHT),
phaseResetMacro(DIV_MACRO_PHASE_RESET),
ex4Macro(DIV_MACRO_EX4),
ex5Macro(DIV_MACRO_EX5),
ex6Macro(DIV_MACRO_EX6),
ex7Macro(DIV_MACRO_EX7),
ex8Macro(DIV_MACRO_EX8) {
for (int i=0; i<4; i++) {
opMacros[i].amMacro.macroType=DIV_MACRO_OP_AM+(i<<5);
opMacros[i].arMacro.macroType=DIV_MACRO_OP_AR+(i<<5);
opMacros[i].drMacro.macroType=DIV_MACRO_OP_DR+(i<<5);
opMacros[i].multMacro.macroType=DIV_MACRO_OP_MULT+(i<<5);
opMacros[i].rrMacro.macroType=DIV_MACRO_OP_RR+(i<<5);
opMacros[i].slMacro.macroType=DIV_MACRO_OP_SL+(i<<5);
opMacros[i].tlMacro.macroType=DIV_MACRO_OP_TL+(i<<5);
opMacros[i].dt2Macro.macroType=DIV_MACRO_OP_DT2+(i<<5);
opMacros[i].rsMacro.macroType=DIV_MACRO_OP_RS+(i<<5);
opMacros[i].dtMacro.macroType=DIV_MACRO_OP_DT+(i<<5);
opMacros[i].d2rMacro.macroType=DIV_MACRO_OP_D2R+(i<<5);
opMacros[i].ssgMacro.macroType=DIV_MACRO_OP_SSG+(i<<5);
opMacros[i].damMacro.macroType=DIV_MACRO_OP_DAM+(i<<5);
opMacros[i].dvbMacro.macroType=DIV_MACRO_OP_DVB+(i<<5);
opMacros[i].egtMacro.macroType=DIV_MACRO_OP_EGT+(i<<5);
opMacros[i].kslMacro.macroType=DIV_MACRO_OP_KSL+(i<<5);
opMacros[i].susMacro.macroType=DIV_MACRO_OP_SUS+(i<<5);
opMacros[i].vibMacro.macroType=DIV_MACRO_OP_VIB+(i<<5);
opMacros[i].wsMacro.macroType=DIV_MACRO_OP_WS+(i<<5);
opMacros[i].ksrMacro.macroType=DIV_MACRO_OP_KSR+(i<<5);
}
}
};
struct DivInstrumentGB {
@ -668,7 +740,7 @@ struct DivInstrument {
/**
* these are internal functions.
*/
void writeMacro(SafeWriter* w, const DivInstrumentMacro& m, unsigned char macroCode);
void writeMacro(SafeWriter* w, const DivInstrumentMacro& m);
void writeFeatureNA(SafeWriter* w);
void writeFeatureFM(SafeWriter* w, bool fui);
void writeFeatureMA(SafeWriter* w);

View file

@ -42,7 +42,7 @@ void DivMacroStruct::prepare(DivInstrumentMacro& source, DivEngine* e) {
has=had=actualHad=will=true;
mode=source.mode;
type=(source.open>>1)&3;
linger=(source.name=="vol" && e->song.volMacroLinger);
linger=(source.macroType==DIV_MACRO_VOL && e->song.volMacroLinger);
lfoPos=LFO_PHASE;
}
@ -419,108 +419,58 @@ void DivMacroInt::notifyInsDeletion(DivInstrument* which) {
}
}
// randomly-generated
constexpr unsigned int hashTable[256]={
0x0718657, 0xe904eb33, 0x14b2da2b, 0x0ef67ca9,
0x0f0559a, 0x4142065a, 0x4d9ab4ba, 0x3cdd601a,
0x6635aca, 0x2c41ab72, 0xf98e8d31, 0x1003ee63,
0x3fd9fb5, 0x30734d16, 0xe8964431, 0x29bb9b79,
0x817f580, 0xfe083b9e, 0x974b5e85, 0x3b5729c2,
0x2afea96, 0xf1573b4b, 0x308a1024, 0xaa94b92d,
0x693fa93, 0x547ba3da, 0xac4f206c, 0x93f72ea9,
0xcc44001, 0x37e27670, 0xf35a63d0, 0xd1cdbb92,
0x7c7ee24, 0xfa267ee9, 0xf9cd9956, 0x6a6768d4,
0x9e6a108, 0xf6ca4bd0, 0xa53cba9f, 0x526a523a,
0xf46f0c8, 0xf131bd4c, 0x82800d48, 0xabff9214,
0x40eabd4, 0xea0ef8f7, 0xdc3968d6, 0x54c3cb63,
0x8855023, 0xaab73861, 0xff0bea2c, 0x139b9765,
0x4a21279, 0x6b2aa29a, 0xf147cc3f, 0xc42edc1a,
0xfe2f86f, 0x6d352047, 0xd3cac3e4, 0x35e5c389,
0xe923727, 0x12fe3b32, 0x204295c5, 0x254a8b7a,
0xc1d995d, 0x26a512d2, 0xa3e34033, 0x9a968df0,
0x53447ed, 0x36cf4077, 0x189b03a7, 0x558790e8,
0x01f921a, 0x840f260c, 0x93dd2b86, 0x12f69cb0,
0x117d93a, 0xcb2cbc2b, 0xd41e3aed, 0x5ff6ec75,
0x607290d, 0xd41adb92, 0x64f94ba7, 0xaff720f7,
0x6bf1d5d, 0xc8e36c6d, 0x7095bab5, 0xdfbf7b0d,
0x01ddeea, 0xe8f262da, 0xf589512f, 0xc2ecac5d,
0xbe29d98, 0xff8b5a2e, 0x18e7279e, 0x6ad24dcb,
0x2b3b9b1, 0x6f5227d8, 0x076d7553, 0x6c5856e2,
0x995f655, 0xe9fcf5a6, 0x83671b70, 0xaf3aed1e,
0xac340f0, 0x5c7008b4, 0x14651282, 0x8bf855b9,
0x4a933af, 0x829b87f1, 0x9a673070, 0xb19da64f,
0x77d8f36, 0x584c9fdc, 0xa9e52c0d, 0x6da5e13d,
0xae1051f, 0xe85e976f, 0xfeac2d9a, 0x19c46754,
0x1cba6f3, 0xaf21bc31, 0x16b6a8d4, 0xe08b0fdb,
0x97e6e54, 0x5da499ae, 0xab472e19, 0xc2491f2e,
0xc08c563, 0xe91b131b, 0xc8e22451, 0x6995c8fe,
0x7042718, 0x01043738, 0xc7d88b28, 0x2d9f330f,
0x4b3aae5, 0xf1e705ba, 0xc5b8ee59, 0xa8ba4e8f,
0x55f65a2, 0xa1899e41, 0x296243c8, 0x1e502bf2,
0x20080de, 0x841d2239, 0x37b082af, 0xbdd7f7da,
0x4075090, 0x1dc7dc49, 0x5cd3c69a, 0x7fb13b62,
0xb382bf1, 0xa0cfbc2f, 0x9eca4dc1, 0xb9355453,
0x5d0dd24, 0x834f4d8e, 0xe9b136b2, 0xe7b8738d,
0x1c91d41, 0x8cb3ddb5, 0xdc600590, 0x607cff55,
0x2ca7675, 0x4622a8e4, 0x9340e414, 0xcb44928a,
0xa9e791c, 0x68849920, 0xc5b5fcd8, 0xbc352269,
0x3ab13cf, 0xaa3cbbd0, 0x1abacc64, 0x623b5b49,
0xcc8c4c3, 0x3c8f2f70, 0x3e584a28, 0x9316d24d,
0xfe315a2, 0x10f0ba7a, 0xed15a523, 0x4f987369,
0x7aa4a4a, 0x90eaf98f, 0xcf0af610, 0x1b38f4e7,
0x19df72d, 0xd8306808, 0xd54e25ac, 0x76b79c6d,
0x58110cf, 0x06a3e5f2, 0x873a6039, 0xf52684e3,
0xecf39c3, 0x7cbb2759, 0xe280d361, 0x91e8471a,
0xa67cdd3, 0x17cac3be, 0xfc9eff1f, 0x71abdf49,
0x6168624, 0xb68f86f7, 0x67a8e72a, 0xe746911d,
0xca48fd7, 0x8f3cc436, 0x3a3851a8, 0x30a7e26e,
0xca49308, 0xb598ef74, 0x49ef167a, 0xa9e17632,
0x0f7308a, 0xf156efed, 0xcf799645, 0xbae4b85a,
0xecba3fe, 0xd97f861d, 0xc164af62, 0xb1aca42f,
0xf249576, 0x83d1bf4e, 0x2f486a9c, 0xd3b53cc2,
0x17d7c26, 0xd95ddae1, 0x76c1a2f5, 0xf8af6782,
0xdbaece4, 0x010b2b53, 0x049be200, 0xd9fd0d1a,
0x37d7e6c, 0x5b848651, 0x203c98c7, 0x669681b0,
0x683086f, 0xdd0ee8ab, 0x5dbe008b, 0xe5d0690d,
0x23dd758, 0x6b34acbc, 0x4b2b3e65, 0xcc7b56c1,
0x196b0a0, 0x7b065105, 0xb731b01a, 0xd37daa16,
0xf77816b, 0x3c9fa546, 0x81dfadb8, 0x39b1fb8b
};
#define CONSIDER(x,y) case (y&0x1f): return &x; break;
constexpr unsigned int NAME_HASH(const char* name) {
unsigned int nameHash=0xffffffff;
for (const char* i=name; *i; i++) {
nameHash=(nameHash>>8)^hashTable[(unsigned char)*i];
DivMacroStruct* DivMacroInt::structByType(unsigned char type) {
if (type>=0x20) {
unsigned char o=((type>>5)-1)&3;
switch (type&0x1f) {
CONSIDER(op[o].am,DIV_MACRO_OP_AM)
CONSIDER(op[o].ar,DIV_MACRO_OP_AR)
CONSIDER(op[o].dr,DIV_MACRO_OP_DR)
CONSIDER(op[o].mult,DIV_MACRO_OP_MULT)
CONSIDER(op[o].rr,DIV_MACRO_OP_RR)
CONSIDER(op[o].sl,DIV_MACRO_OP_SL)
CONSIDER(op[o].tl,DIV_MACRO_OP_TL)
CONSIDER(op[o].dt2,DIV_MACRO_OP_DT2)
CONSIDER(op[o].rs,DIV_MACRO_OP_RS)
CONSIDER(op[o].dt,DIV_MACRO_OP_DT)
CONSIDER(op[o].d2r,DIV_MACRO_OP_D2R)
CONSIDER(op[o].ssg,DIV_MACRO_OP_SSG)
CONSIDER(op[o].dam,DIV_MACRO_OP_DAM)
CONSIDER(op[o].dvb,DIV_MACRO_OP_DVB)
CONSIDER(op[o].egt,DIV_MACRO_OP_EGT)
CONSIDER(op[o].ksl,DIV_MACRO_OP_KSL)
CONSIDER(op[o].sus,DIV_MACRO_OP_SUS)
CONSIDER(op[o].vib,DIV_MACRO_OP_VIB)
CONSIDER(op[o].ws,DIV_MACRO_OP_WS)
CONSIDER(op[o].ksr,DIV_MACRO_OP_KSR)
}
return NULL;
}
return nameHash;
}
#define CONSIDER(x) case NAME_HASH(#x): return &x; break;
DivMacroStruct* DivMacroInt::structByName(const String& name) {
unsigned int hash=NAME_HASH(name.c_str());
switch (hash) {
CONSIDER(vol)
CONSIDER(arp)
CONSIDER(duty)
CONSIDER(wave)
CONSIDER(pitch)
CONSIDER(ex1)
CONSIDER(ex2)
CONSIDER(ex3)
CONSIDER(alg)
CONSIDER(fb)
CONSIDER(fms)
CONSIDER(ams)
CONSIDER(panL)
CONSIDER(panR)
CONSIDER(phaseReset)
CONSIDER(ex4)
CONSIDER(ex5)
CONSIDER(ex6)
CONSIDER(ex7)
CONSIDER(ex8)
switch (type) {
CONSIDER(vol,DIV_MACRO_VOL)
CONSIDER(arp,DIV_MACRO_ARP)
CONSIDER(duty,DIV_MACRO_DUTY)
CONSIDER(wave,DIV_MACRO_WAVE)
CONSIDER(pitch,DIV_MACRO_PITCH)
CONSIDER(ex1,DIV_MACRO_EX1)
CONSIDER(ex2,DIV_MACRO_EX2)
CONSIDER(ex3,DIV_MACRO_EX3)
CONSIDER(alg,DIV_MACRO_ALG)
CONSIDER(fb,DIV_MACRO_FB)
CONSIDER(fms,DIV_MACRO_FMS)
CONSIDER(ams,DIV_MACRO_AMS)
CONSIDER(panL,DIV_MACRO_PAN_LEFT)
CONSIDER(panR,DIV_MACRO_PAN_RIGHT)
CONSIDER(phaseReset,DIV_MACRO_PHASE_RESET)
CONSIDER(ex4,DIV_MACRO_EX4)
CONSIDER(ex5,DIV_MACRO_EX5)
CONSIDER(ex6,DIV_MACRO_EX6)
CONSIDER(ex7,DIV_MACRO_EX7)
CONSIDER(ex8,DIV_MACRO_EX8)
}
return NULL;

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*));

View file

@ -1387,10 +1387,10 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0.0f,0.0f));
if (i.macro->vZoom<1) {
if (i.macro->name=="arp") {
if (i.macro->macroType==DIV_MACRO_ARP) {
i.macro->vZoom=24;
i.macro->vScroll=120-12;
} else if (i.macro->name=="pitch") {
} else if (i.macro->macroType==DIV_MACRO_PITCH) {
i.macro->vZoom=128;
i.macro->vScroll=2048-64;
} else {
@ -1413,7 +1413,7 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail
DivMacroInt* macroInt=e->getMacroInt(j);
if (macroInt==NULL) continue;
DivMacroStruct* macroStruct=macroInt->structByName(i.macro->name);
DivMacroStruct* macroStruct=macroInt->structByType(i.macro->macroType);
if (macroStruct==NULL) continue;
if (macroStruct->lastPos>i.macro->len) continue;