2021-05-15 21:42:48 +00:00
|
|
|
#ifndef _INSTRUMENT_H
|
|
|
|
#define _INSTRUMENT_H
|
2021-05-12 22:19:18 +00:00
|
|
|
#include "../ta-utils.h"
|
|
|
|
|
2021-05-11 20:08:08 +00:00
|
|
|
enum DivInstrumentType {
|
2022-01-09 08:52:41 +00:00
|
|
|
DIV_INS_STD=0,
|
|
|
|
DIV_INS_FM=1,
|
|
|
|
DIV_INS_GB=2,
|
|
|
|
DIV_INS_C64=3,
|
2022-01-13 18:55:33 +00:00
|
|
|
DIV_INS_AMIGA=4,
|
|
|
|
DIV_INS_PCE=5,
|
2022-01-14 05:02:10 +00:00
|
|
|
DIV_INS_AY=6,
|
2022-01-14 20:21:57 +00:00
|
|
|
DIV_INS_AY8930=7,
|
2022-01-15 04:26:22 +00:00
|
|
|
DIV_INS_TIA=8,
|
|
|
|
DIV_INS_SAA1099=9
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct DivInstrumentFM {
|
2021-05-11 20:26:38 +00:00
|
|
|
unsigned char alg, fb, fms, ams, ops;
|
2021-05-12 22:19:18 +00:00
|
|
|
struct Operator {
|
2021-05-11 20:26:38 +00:00
|
|
|
unsigned char am, ar, dr, mult, rr, sl, tl, dt2, rs, dt, d2r, ssgEnv;
|
|
|
|
unsigned char dam, dvb, egt, ksl, sus, vib, ws, ksr; // YMU759
|
2021-12-12 23:19:43 +00:00
|
|
|
Operator():
|
|
|
|
am(0),
|
|
|
|
ar(0),
|
|
|
|
dr(0),
|
|
|
|
mult(0),
|
|
|
|
rr(0),
|
|
|
|
sl(0),
|
|
|
|
tl(0),
|
|
|
|
dt2(0),
|
|
|
|
rs(0),
|
|
|
|
dt(0),
|
|
|
|
d2r(0),
|
|
|
|
ssgEnv(0),
|
|
|
|
dam(0),
|
|
|
|
dvb(0),
|
|
|
|
egt(0),
|
|
|
|
ksl(0),
|
|
|
|
sus(0),
|
|
|
|
vib(0),
|
|
|
|
ws(0),
|
|
|
|
ksr(0) {}
|
2021-05-11 20:08:08 +00:00
|
|
|
} op[4];
|
2021-12-12 23:19:43 +00:00
|
|
|
DivInstrumentFM():
|
|
|
|
alg(0),
|
|
|
|
fb(0),
|
|
|
|
fms(0),
|
|
|
|
ams(0),
|
2021-12-27 22:21:43 +00:00
|
|
|
ops(4) {
|
|
|
|
// default instrument
|
|
|
|
fb=4;
|
|
|
|
op[0].tl=42;
|
|
|
|
op[0].ar=31;
|
|
|
|
op[0].dr=8;
|
|
|
|
op[0].sl=15;
|
|
|
|
op[0].rr=3;
|
|
|
|
op[0].mult=5;
|
|
|
|
op[0].dt=5;
|
|
|
|
|
|
|
|
op[2].tl=18;
|
|
|
|
op[2].ar=31;
|
|
|
|
op[2].dr=10;
|
|
|
|
op[2].sl=15;
|
|
|
|
op[2].rr=4;
|
|
|
|
op[2].mult=1;
|
|
|
|
op[2].dt=0;
|
|
|
|
|
|
|
|
op[1].tl=48;
|
|
|
|
op[1].ar=31;
|
|
|
|
op[1].dr=4;
|
|
|
|
op[1].sl=11;
|
|
|
|
op[1].rr=1;
|
|
|
|
op[1].mult=1;
|
|
|
|
op[1].dt=5;
|
|
|
|
|
|
|
|
op[3].tl=2;
|
|
|
|
op[3].ar=31;
|
|
|
|
op[3].dr=9;
|
|
|
|
op[3].sl=15;
|
|
|
|
op[3].rr=9;
|
|
|
|
op[3].mult=1;
|
|
|
|
op[3].dt=0;
|
|
|
|
}
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct DivInstrumentSTD {
|
|
|
|
int volMacro[256];
|
|
|
|
int arpMacro[256];
|
|
|
|
int dutyMacro[256];
|
|
|
|
int waveMacro[256];
|
2022-01-13 18:55:33 +00:00
|
|
|
int pitchMacro[256];
|
|
|
|
int ex1Macro[256];
|
|
|
|
int ex2Macro[256];
|
|
|
|
int ex3Macro[256];
|
2021-05-11 20:08:08 +00:00
|
|
|
bool arpMacroMode;
|
2022-01-10 22:30:36 +00:00
|
|
|
unsigned char volMacroHeight, dutyMacroHeight, waveMacroHeight;
|
2022-01-13 18:55:33 +00:00
|
|
|
unsigned char volMacroLen, arpMacroLen, dutyMacroLen, waveMacroLen, pitchMacroLen, ex1MacroLen, ex2MacroLen, ex3MacroLen;
|
|
|
|
signed char volMacroLoop, arpMacroLoop, dutyMacroLoop, waveMacroLoop, pitchMacroLoop, ex1MacroLoop, ex2MacroLoop, ex3MacroLoop;
|
2021-12-12 23:19:43 +00:00
|
|
|
DivInstrumentSTD():
|
|
|
|
arpMacroMode(false),
|
2022-01-10 22:30:36 +00:00
|
|
|
volMacroHeight(15),
|
|
|
|
dutyMacroHeight(3),
|
|
|
|
waveMacroHeight(63),
|
2021-12-12 23:19:43 +00:00
|
|
|
volMacroLen(0),
|
|
|
|
arpMacroLen(0),
|
|
|
|
dutyMacroLen(0),
|
|
|
|
waveMacroLen(0),
|
2022-01-13 18:55:33 +00:00
|
|
|
pitchMacroLen(0),
|
|
|
|
ex1MacroLen(0),
|
|
|
|
ex2MacroLen(0),
|
|
|
|
ex3MacroLen(0),
|
2021-12-12 23:19:43 +00:00
|
|
|
volMacroLoop(-1),
|
|
|
|
arpMacroLoop(-1),
|
|
|
|
dutyMacroLoop(-1),
|
2022-01-13 18:55:33 +00:00
|
|
|
waveMacroLoop(-1),
|
|
|
|
pitchMacroLoop(-1),
|
|
|
|
ex1MacroLoop(-1),
|
|
|
|
ex2MacroLoop(-1),
|
|
|
|
ex3MacroLoop(-1) {
|
2021-12-12 23:19:43 +00:00
|
|
|
memset(volMacro,0,256*sizeof(int));
|
|
|
|
memset(arpMacro,0,256*sizeof(int));
|
|
|
|
memset(dutyMacro,0,256*sizeof(int));
|
|
|
|
memset(waveMacro,0,256*sizeof(int));
|
2022-01-13 18:55:33 +00:00
|
|
|
memset(pitchMacro,0,256*sizeof(int));
|
|
|
|
memset(ex1Macro,0,256*sizeof(int));
|
|
|
|
memset(ex2Macro,0,256*sizeof(int));
|
|
|
|
memset(ex3Macro,0,256*sizeof(int));
|
2021-12-12 23:19:43 +00:00
|
|
|
}
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct DivInstrumentGB {
|
|
|
|
unsigned char envVol, envDir, envLen, soundLen;
|
2021-12-12 23:19:43 +00:00
|
|
|
DivInstrumentGB():
|
2021-12-18 03:14:41 +00:00
|
|
|
envVol(15),
|
2021-12-12 23:19:43 +00:00
|
|
|
envDir(0),
|
2021-12-18 03:14:41 +00:00
|
|
|
envLen(2),
|
|
|
|
soundLen(64) {}
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct DivInstrumentC64 {
|
|
|
|
bool triOn, sawOn, pulseOn, noiseOn;
|
|
|
|
unsigned char a, d, s, r;
|
2022-01-09 22:00:52 +00:00
|
|
|
unsigned short duty;
|
2021-05-11 20:08:08 +00:00
|
|
|
unsigned char ringMod, oscSync;
|
2022-01-09 08:52:41 +00:00
|
|
|
bool toFilter, volIsCutoff, initFilter, dutyIsAbs, filterIsAbs;
|
2022-01-09 22:00:52 +00:00
|
|
|
unsigned char res;
|
|
|
|
unsigned short cut;
|
2021-05-11 20:08:08 +00:00
|
|
|
bool hp, lp, bp, ch3off;
|
2021-12-12 23:19:43 +00:00
|
|
|
|
|
|
|
DivInstrumentC64():
|
|
|
|
triOn(false),
|
|
|
|
sawOn(true),
|
|
|
|
pulseOn(false),
|
|
|
|
noiseOn(false),
|
|
|
|
a(0),
|
|
|
|
d(8),
|
|
|
|
s(0),
|
|
|
|
r(0),
|
2022-01-09 22:00:52 +00:00
|
|
|
duty(2048),
|
2021-12-12 23:19:43 +00:00
|
|
|
ringMod(0),
|
|
|
|
oscSync(0),
|
|
|
|
toFilter(false),
|
|
|
|
volIsCutoff(false),
|
|
|
|
initFilter(false),
|
2022-01-09 08:52:41 +00:00
|
|
|
dutyIsAbs(false),
|
|
|
|
filterIsAbs(false),
|
2021-12-12 23:19:43 +00:00
|
|
|
res(0),
|
|
|
|
cut(0),
|
|
|
|
hp(false),
|
|
|
|
lp(false),
|
|
|
|
bp(false),
|
|
|
|
ch3off(false) {}
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
|
|
|
|
2022-01-09 08:52:41 +00:00
|
|
|
struct DivInstrumentAmiga {
|
|
|
|
short initSample;
|
|
|
|
|
|
|
|
DivInstrumentAmiga():
|
|
|
|
initSample(0) {}
|
|
|
|
};
|
|
|
|
|
2021-05-11 20:08:08 +00:00
|
|
|
struct DivInstrument {
|
|
|
|
String name;
|
|
|
|
bool mode;
|
|
|
|
DivInstrumentType type;
|
|
|
|
DivInstrumentFM fm;
|
|
|
|
DivInstrumentSTD std;
|
|
|
|
DivInstrumentGB gb;
|
|
|
|
DivInstrumentC64 c64;
|
2022-01-09 08:52:41 +00:00
|
|
|
DivInstrumentAmiga amiga;
|
2021-05-17 01:49:54 +00:00
|
|
|
DivInstrument():
|
|
|
|
name(""),
|
|
|
|
mode(false),
|
2021-12-12 23:19:43 +00:00
|
|
|
type(DIV_INS_STD) {
|
2021-05-17 01:49:54 +00:00
|
|
|
}
|
2021-05-11 20:08:08 +00:00
|
|
|
};
|
2021-05-15 21:42:48 +00:00
|
|
|
#endif
|