dev109 - define SNES instrument params

This commit is contained in:
tildearrow 2022-08-19 19:42:01 -05:00
parent c74d7fab37
commit 4d057d3328
4 changed files with 142 additions and 2 deletions

View file

@ -46,8 +46,8 @@
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
#define BUSY_END isBusy.unlock(); softLocked=false;
#define DIV_VERSION "dev108"
#define DIV_ENGINE_VERSION 108
#define DIV_VERSION "dev109"
#define DIV_ENGINE_VERSION 109
// for imports
#define DIV_VERSION_MOD 0xff01

View file

@ -554,6 +554,15 @@ void DivInstrument::putInsData(SafeWriter* w) {
w->writeC(es5506.envelope.k2Ramp);
w->writeC(es5506.envelope.k1Slow);
w->writeC(es5506.envelope.k2Slow);
// SNES
w->writeC(snes.useEnv);
w->writeC(snes.gainMode);
w->writeC(snes.gain);
w->writeC(snes.a);
w->writeC(snes.d);
w->writeC(snes.s);
w->writeC(snes.r);
blockEndSeek=w->tell();
w->seek(blockStartSeek,SEEK_SET);
@ -1140,6 +1149,17 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
es5506.envelope.k2Slow=reader.readC();
}
// SNES
if (version>=109) {
snes.useEnv=reader.readC();
snes.gainMode=(DivInstrumentSNES::GainMode)reader.readC();
snes.gain=reader.readC();
snes.a=reader.readC();
snes.d=reader.readC();
snes.s=reader.readC();
snes.r=reader.readC();
}
return DIV_DATA_SUCCESS;
}

View file

@ -501,6 +501,28 @@ struct DivInstrumentES5506 {
envelope(Envelope()) {}
};
struct DivInstrumentSNES {
enum GainMode: unsigned char {
GAIN_MODE_DIRECT=0,
GAIN_MODE_DEC_LINEAR=4,
GAIN_MODE_DEC_LOG=5,
GAIN_MODE_INC_LINEAR=6,
GAIN_MODE_INC_INVLOG=7
};
bool useEnv;
GainMode gainMode;
unsigned char gain;
unsigned char a, d, s, r;
DivInstrumentSNES():
useEnv(true),
gainMode(GAIN_MODE_DIRECT),
gain(127),
a(15),
d(7),
s(7),
r(0) {}
};
struct DivInstrument {
String name;
bool mode;
@ -516,6 +538,7 @@ struct DivInstrument {
DivInstrumentWaveSynth ws;
DivInstrumentSoundUnit su;
DivInstrumentES5506 es5506;
DivInstrumentSNES snes;
/**
* save the instrument to a SafeWriter.