mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-01 00:43:02 +00:00
Fix 2x2op WOPL load
This commit is contained in:
parent
87ffcf2b27
commit
da6a6f514c
1 changed files with 26 additions and 27 deletions
|
@ -525,7 +525,7 @@ void DivEngine::loadS3I(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivEngine::loadSBI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath) {
|
void DivEngine::loadSBI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath) {
|
||||||
std::vector<DivInstrument*> insList;
|
std::vector<DivInstrument*> insList; // in case 2x2op
|
||||||
DivInstrument* ins=new DivInstrument;
|
DivInstrument* ins=new DivInstrument;
|
||||||
try {
|
try {
|
||||||
reader.seek(0, SEEK_SET);
|
reader.seek(0, SEEK_SET);
|
||||||
|
@ -654,9 +654,30 @@ void DivEngine::loadSBI(SafeReader& reader, std::vector<DivInstrument*>& ret, St
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivEngine::loadOPLI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath) {
|
void DivEngine::loadOPLI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath) {
|
||||||
std::vector<DivInstrument*> insList;
|
std::vector<DivInstrument*> insList; // in case 2x2op
|
||||||
DivInstrument* ins = new DivInstrument;
|
DivInstrument* ins = new DivInstrument;
|
||||||
|
|
||||||
|
auto readOpliOp = [](SafeReader& reader, DivInstrumentFM::Operator& op) {
|
||||||
|
uint8_t characteristics = reader.readC();
|
||||||
|
uint8_t keyScaleLevel = reader.readC();
|
||||||
|
uint8_t attackDecay = reader.readC();
|
||||||
|
uint8_t sustainRelease = reader.readC();
|
||||||
|
uint8_t waveSelect = reader.readC();
|
||||||
|
|
||||||
|
op.mult = characteristics & 0xF;
|
||||||
|
op.ksr = ((characteristics >> 4) & 0x1);
|
||||||
|
op.sus = ((characteristics >> 5) & 0x1);
|
||||||
|
op.vib = ((characteristics >> 6) & 0x1);
|
||||||
|
op.am = ((characteristics >> 7) & 0x1);
|
||||||
|
op.tl = keyScaleLevel & 0x3F;
|
||||||
|
op.ksl = ((keyScaleLevel >> 6) & 0x3);
|
||||||
|
op.ar = ((attackDecay >> 4) & 0xF);
|
||||||
|
op.dr = attackDecay & 0xF;
|
||||||
|
op.rr = sustainRelease & 0xF;
|
||||||
|
op.sl = ((sustainRelease >> 4) & 0xF);
|
||||||
|
op.ws = waveSelect;
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
reader.seek(0, SEEK_SET);
|
reader.seek(0, SEEK_SET);
|
||||||
String header = reader.readString(11);
|
String header = reader.readString(11);
|
||||||
|
@ -677,27 +698,6 @@ void DivEngine::loadOPLI(SafeReader& reader, std::vector<DivInstrument*>& ret, S
|
||||||
bool is_2x2op = (((instTypeFlags>>1) & 0x1) == 1);
|
bool is_2x2op = (((instTypeFlags>>1) & 0x1) == 1);
|
||||||
bool is_rhythm = (((instTypeFlags>>4) & 0x7) > 0);
|
bool is_rhythm = (((instTypeFlags>>4) & 0x7) > 0);
|
||||||
|
|
||||||
auto readOpliOp = [](SafeReader& reader, DivInstrumentFM::Operator& op) {
|
|
||||||
uint8_t characteristics = reader.readC();
|
|
||||||
uint8_t keyScaleLevel = reader.readC();
|
|
||||||
uint8_t attackDecay = reader.readC();
|
|
||||||
uint8_t sustainRelease = reader.readC();
|
|
||||||
uint8_t waveSelect = reader.readC();
|
|
||||||
|
|
||||||
op.mult = characteristics & 0xF;
|
|
||||||
op.ksr = ((characteristics >> 4) & 0x1);
|
|
||||||
op.sus = ((characteristics >> 5) & 0x1);
|
|
||||||
op.vib = ((characteristics >> 6) & 0x1);
|
|
||||||
op.am = ((characteristics >> 7) & 0x1);
|
|
||||||
op.tl = keyScaleLevel & 0x3F;
|
|
||||||
op.ksl = ((keyScaleLevel >> 6) & 0x3);
|
|
||||||
op.ar = ((attackDecay >> 4) & 0xF);
|
|
||||||
op.dr = attackDecay & 0xF;
|
|
||||||
op.rr = sustainRelease & 0xF;
|
|
||||||
op.sl = ((sustainRelease >> 4) & 0xF);
|
|
||||||
op.ws = waveSelect;
|
|
||||||
};
|
|
||||||
|
|
||||||
uint8_t feedConnect = reader.readC();
|
uint8_t feedConnect = reader.readC();
|
||||||
uint8_t feedConnect2nd = reader.readC();
|
uint8_t feedConnect2nd = reader.readC();
|
||||||
|
|
||||||
|
@ -1439,7 +1439,6 @@ void DivEngine::loadWOPL(SafeReader& reader, std::vector<DivInstrument*>& ret, S
|
||||||
|
|
||||||
auto doParseWoplInstrument = [&](bool isPerc, midibank_t*& metadata, int patchNum) {
|
auto doParseWoplInstrument = [&](bool isPerc, midibank_t*& metadata, int patchNum) {
|
||||||
DivInstrument* ins = new DivInstrument;
|
DivInstrument* ins = new DivInstrument;
|
||||||
DivInstrument* insPair = NULL;
|
|
||||||
try {
|
try {
|
||||||
long patchSum = 0;
|
long patchSum = 0;
|
||||||
ins->type = DIV_INS_OPL;
|
ins->type = DIV_INS_OPL;
|
||||||
|
@ -1483,9 +1482,9 @@ void DivEngine::loadWOPL(SafeReader& reader, std::vector<DivInstrument*>& ret, S
|
||||||
stripPath, metadata->name, (isPerc) ? "Drum" : "Melodic", patchNum);
|
stripPath, metadata->name, (isPerc) ? "Drum" : "Melodic", patchNum);
|
||||||
insList.push_back(ins);
|
insList.push_back(ins);
|
||||||
patchSum = 0;
|
patchSum = 0;
|
||||||
insPair = new DivInstrument;
|
ins = new DivInstrument;
|
||||||
insPair->type = DIV_INS_OPL;
|
ins->type = DIV_INS_OPL;
|
||||||
insPair->name = fmt::sprintf("%s (2)", insName);
|
ins->name = fmt::sprintf("%s (2)", insName);
|
||||||
for (int i : {1,0}) {
|
for (int i : {1,0}) {
|
||||||
patchSum += readWoplOp(reader, ins->fm.op[i]);
|
patchSum += readWoplOp(reader, ins->fm.op[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue