furnace/src/engine/instrument.h

199 lines
3.9 KiB
C
Raw Normal View History

#ifndef _INSTRUMENT_H
#define _INSTRUMENT_H
2021-05-12 22:19:18 +00:00
#include "../ta-utils.h"
enum DivInstrumentType {
DIV_INS_STD=0,
DIV_INS_FM=1,
DIV_INS_GB=2,
DIV_INS_C64=3,
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
};
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) {}
} 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;
}
};
struct DivInstrumentSTD {
int volMacro[256];
int arpMacro[256];
int dutyMacro[256];
int waveMacro[256];
int pitchMacro[256];
int ex1Macro[256];
int ex2Macro[256];
int ex3Macro[256];
bool arpMacroMode;
2022-01-10 22:30:36 +00:00
unsigned char volMacroHeight, dutyMacroHeight, waveMacroHeight;
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),
pitchMacroLen(0),
ex1MacroLen(0),
ex2MacroLen(0),
ex3MacroLen(0),
2021-12-12 23:19:43 +00:00
volMacroLoop(-1),
arpMacroLoop(-1),
dutyMacroLoop(-1),
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));
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
}
};
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) {}
};
struct DivInstrumentC64 {
bool triOn, sawOn, pulseOn, noiseOn;
unsigned char a, d, s, r;
unsigned short duty;
unsigned char ringMod, oscSync;
bool toFilter, volIsCutoff, initFilter, dutyIsAbs, filterIsAbs;
unsigned char res;
unsigned short cut;
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),
duty(2048),
2021-12-12 23:19:43 +00:00
ringMod(0),
oscSync(0),
toFilter(false),
volIsCutoff(false),
initFilter(false),
dutyIsAbs(false),
filterIsAbs(false),
2021-12-12 23:19:43 +00:00
res(0),
cut(0),
hp(false),
lp(false),
bp(false),
ch3off(false) {}
};
struct DivInstrumentAmiga {
short initSample;
DivInstrumentAmiga():
initSample(0) {}
};
struct DivInstrument {
String name;
bool mode;
DivInstrumentType type;
DivInstrumentFM fm;
DivInstrumentSTD std;
DivInstrumentGB gb;
DivInstrumentC64 c64;
DivInstrumentAmiga amiga;
DivInstrument():
name(""),
mode(false),
2021-12-12 23:19:43 +00:00
type(DIV_INS_STD) {
}
};
#endif