Implement ES5506 instrument type

ES5506 has these features:
- 16 bit independent volume register per left/right output (Logarithmic, 4 LSB is for envelope)
- Programmable filter per each channels, 4 pole, 4 filter mode and 2 16 bit coefficient register (4 LSB is for envelope)
- Hardware envelope

Add more than 2 macro type support
"Delta" macro type: Use delta from previous value
This commit is contained in:
cam900 2022-08-18 21:20:10 +09:00
parent 7c42453422
commit 5190c6daab
5 changed files with 219 additions and 49 deletions

View file

@ -465,6 +465,43 @@ struct DivInstrumentSoundUnit {
switchRoles(false) {}
};
struct DivInstrumentES5506 {
struct Filter {
enum FilterMode: unsigned char { // filter mode for pole 4,3
FILTER_MODE_HPK2_HPK2,
FILTER_MODE_HPK2_LPK1,
FILTER_MODE_LPK2_LPK2,
FILTER_MODE_LPK2_LPK1,
};
FilterMode mode;
unsigned short k1, k2;
Filter():
mode(FILTER_MODE_LPK2_LPK1),
k1(0xffff),
k2(0xffff) {}
};
struct Envelope {
unsigned short ecount;
signed char lVRamp, rVRamp;
signed char k1Ramp, k2Ramp;
bool k1Slow, k2Slow;
Envelope():
ecount(0),
lVRamp(0),
rVRamp(0),
k1Ramp(0),
k2Ramp(0),
k1Slow(false),
k2Slow(false) {}
};
signed int lVol, rVol;
Filter filter;
Envelope envelope;
DivInstrumentES5506():
lVol(0xffff),
rVol(0xffff) {}
};
struct DivInstrument {
String name;
bool mode;
@ -479,6 +516,7 @@ struct DivInstrument {
DivInstrumentMultiPCM multipcm;
DivInstrumentWaveSynth ws;
DivInstrumentSoundUnit su;
DivInstrumentES5506 es5506;
/**
* save the instrument to a SafeWriter.