Re-split OPL4 PCM instruments due to hardware differences
- MultiPCM also has level direct, so it's remained in DivInstrumentMultiPCM. everything else don't support at MultiPCM is moved into DivInstrumentOPL4PCM. - MultiPCM can't modify ADSR envelope unless reading instrument from ROM, so I decided to remove ADSR envelope macros. these are moved into OPL4 PCM instrument. - Save/Load of MultiPCM level direct parameter is still disabled until main version update (for disallow crash). - Also, this PR fixes OPL4 VGM output.
This commit is contained in:
parent
ec5879f10b
commit
87ac12e143
11 changed files with 201 additions and 50 deletions
|
|
@ -175,9 +175,6 @@ bool DivInstrumentMultiPCM::operator==(const DivInstrumentMultiPCM& other) {
|
|||
_C(lfo) &&
|
||||
_C(vib) &&
|
||||
_C(am) &&
|
||||
_C(damp) &&
|
||||
_C(pseudoReverb) &&
|
||||
_C(lfoReset) &&
|
||||
_C(levelDirect)
|
||||
);
|
||||
}
|
||||
|
|
@ -270,6 +267,14 @@ bool DivInstrumentSID2::operator==(const DivInstrumentSID2& other) {
|
|||
);
|
||||
}
|
||||
|
||||
bool DivInstrumentOPL4PCM::operator==(const DivInstrumentOPL4PCM& other) {
|
||||
return (
|
||||
_C(damp) &&
|
||||
_C(pseudoReverb) &&
|
||||
_C(lfoReset)
|
||||
);
|
||||
}
|
||||
|
||||
#undef _C
|
||||
|
||||
#define CONSIDER(x,t) \
|
||||
|
|
@ -762,9 +767,6 @@ void DivInstrument::writeFeatureMP(SafeWriter* w) {
|
|||
w->writeC(multipcm.am);
|
||||
|
||||
/*
|
||||
w->writeC(multipcm.damp);
|
||||
w->writeC(multipcm.pseudoReverb);
|
||||
w->writeC(multipcm.lfoReset);
|
||||
w->writeC(multipcm.levelDirect);
|
||||
*/
|
||||
|
||||
|
|
@ -859,6 +861,16 @@ void DivInstrument::writeFeatureS2(SafeWriter* w) {
|
|||
FEATURE_END;
|
||||
}
|
||||
|
||||
void DivInstrument::writeFeatureOP(SafeWriter* w) {
|
||||
FEATURE_BEGIN("OP");
|
||||
|
||||
w->writeC(opl4pcm.damp);
|
||||
w->writeC(opl4pcm.pseudoReverb);
|
||||
w->writeC(opl4pcm.lfoReset);
|
||||
|
||||
FEATURE_END;
|
||||
}
|
||||
|
||||
void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bool insName) {
|
||||
size_t blockStartSeek=0;
|
||||
size_t blockEndSeek=0;
|
||||
|
|
@ -905,6 +917,7 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
|
|||
bool featureEF=false;
|
||||
bool featurePN=false;
|
||||
bool featureS2=false;
|
||||
bool featureOP=false;
|
||||
|
||||
bool checkForWL=false;
|
||||
|
||||
|
|
@ -1148,6 +1161,12 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
|
|||
feature64=true;
|
||||
featureS2=true;
|
||||
break;
|
||||
case DIV_INS_OPL4_PCM:
|
||||
featureSM=true;
|
||||
featureSL=true;
|
||||
featureMP=true;
|
||||
featureOP=true;
|
||||
break;
|
||||
case DIV_INS_MAX:
|
||||
break;
|
||||
case DIV_INS_NULL:
|
||||
|
|
@ -1204,6 +1223,9 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
|
|||
if (sid2!=defaultIns.sid2) {
|
||||
featureS2=true;
|
||||
}
|
||||
if (opl4pcm!=defaultIns.opl4pcm) {
|
||||
featureOP=true;
|
||||
}
|
||||
}
|
||||
|
||||
// check ins name
|
||||
|
|
@ -1355,6 +1377,9 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bo
|
|||
if (featureS2) {
|
||||
writeFeatureS2(w);
|
||||
}
|
||||
if (featureOP) {
|
||||
writeFeatureOP(w);
|
||||
}
|
||||
|
||||
if (fui && (featureSL || featureWL)) {
|
||||
w->write("EN",2);
|
||||
|
|
@ -2077,9 +2102,6 @@ void DivInstrument::readFeatureMP(SafeReader& reader, short version) {
|
|||
multipcm.am=reader.readC();
|
||||
|
||||
/*
|
||||
multipcm.damp=reader.readC();
|
||||
multipcm.pseudoReverb=reader.readC();
|
||||
multipcm.lfoReset=reader.readC();
|
||||
multipcm.levelDirect=reader.readC();
|
||||
*/
|
||||
|
||||
|
|
@ -2190,6 +2212,16 @@ void DivInstrument::readFeatureS2(SafeReader& reader, short version) {
|
|||
READ_FEAT_END;
|
||||
}
|
||||
|
||||
void DivInstrument::readFeatureOP(SafeReader& reader, short version) {
|
||||
READ_FEAT_BEGIN;
|
||||
|
||||
opl4pcm.damp=reader.readC();
|
||||
opl4pcm.pseudoReverb=reader.readC();
|
||||
opl4pcm.lfoReset=reader.readC();
|
||||
|
||||
READ_FEAT_END;
|
||||
}
|
||||
|
||||
|
||||
DivDataErrors DivInstrument::readInsDataNew(SafeReader& reader, short version, bool fui, DivSong* song) {
|
||||
unsigned char featCode[2];
|
||||
|
|
@ -2265,6 +2297,8 @@ DivDataErrors DivInstrument::readInsDataNew(SafeReader& reader, short version, b
|
|||
readFeaturePN(reader,version);
|
||||
} else if (memcmp(featCode,"S2",2)==0) { // SID2
|
||||
readFeatureS2(reader,version);
|
||||
} else if (memcmp(featCode,"OP",2)==0) { // OPL4 PCM
|
||||
readFeatureOP(reader,version);
|
||||
} else {
|
||||
if (song==NULL && (memcmp(featCode,"SL",2)==0 || (memcmp(featCode,"WL",2)==0))) {
|
||||
// nothing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue