diff --git a/src/engine/instrument.cpp b/src/engine/instrument.cpp index b3e386b79..af6721711 100644 --- a/src/engine/instrument.cpp +++ b/src/engine/instrument.cpp @@ -97,13 +97,30 @@ void DivInstrument::writeFeatureX1(SafeWriter* w) { } -#define _C(x) x==a.x +#define _C(x) x==other.x -bool DivInstrumentFM::operator==(const DivInstrumentFM& a) { - return true; +bool DivInstrumentFM::operator==(const DivInstrumentFM& other) { + return ( + _C(alg) && + _C(fb) && + _C(fms) && + _C(ams) && + _C(fms2) && + _C(ams2) && + _C(ops) && + _C(opllPreset) && + _C(fixedDrums) && + _C(kickFreq) && + _C(snareHatFreq) && + _C(tomTopFreq) && + _C(op[0]) && + _C(op[1]) && + _C(op[2]) && + _C(op[3]) + ); } -bool DivInstrumentFM::Operator::operator==(const DivInstrumentFM::Operator& a) { +bool DivInstrumentFM::Operator::operator==(const DivInstrumentFM::Operator& other) { return ( _C(enable) && _C(am) && @@ -130,48 +147,139 @@ bool DivInstrumentFM::Operator::operator==(const DivInstrumentFM::Operator& a) { ); } -bool DivInstrumentGB::operator==(const DivInstrumentGB& a) { - return true; +bool DivInstrumentGB::operator==(const DivInstrumentGB& other) { + return ( + _C(envVol) && + _C(envDir) && + _C(envLen) && + _C(soundLen) && + _C(hwSeqLen) && + _C(softEnv) && + _C(alwaysInit) + ); } -bool DivInstrumentC64::operator==(const DivInstrumentC64& a) { - return true; +bool DivInstrumentC64::operator==(const DivInstrumentC64& other) { + return ( + _C(triOn) && + _C(sawOn) && + _C(pulseOn) && + _C(noiseOn) && + _C(a) && + _C(d) && + _C(s) && + _C(r) && + _C(duty) && + _C(ringMod) && + _C(oscSync) && + _C(toFilter) && + _C(volIsCutoff) && + _C(initFilter) && + _C(dutyIsAbs) && + _C(filterIsAbs) && + _C(noTest) && + _C(res) && + _C(cut) && + _C(hp) && + _C(lp) && + _C(bp) && + _C(ch3off) + ); } -bool DivInstrumentAmiga::operator==(const DivInstrumentAmiga& a) { - return true; +bool DivInstrumentAmiga::operator==(const DivInstrumentAmiga& other) { + return ( + _C(initSample) && + _C(useNoteMap) && + _C(useSample) && + _C(useWave) && + _C(waveLen) + ); } -bool DivInstrumentX1_010::operator==(const DivInstrumentX1_010& a) { - return true; +bool DivInstrumentX1_010::operator==(const DivInstrumentX1_010& other) { + return _C(bankSlot); } -bool DivInstrumentN163::operator==(const DivInstrumentN163& a) { - return true; +bool DivInstrumentN163::operator==(const DivInstrumentN163& other) { + return ( + _C(wave) && + _C(wavePos) && + _C(waveLen) && + _C(waveMode) + ); } -bool DivInstrumentFDS::operator==(const DivInstrumentFDS& a) { - return true; +bool DivInstrumentFDS::operator==(const DivInstrumentFDS& other) { + return ( + (memcmp(modTable,other.modTable,32)==0) && + _C(modSpeed) && + _C(modDepth) && + _C(initModTableWithFirstWave) + ); } -bool DivInstrumentMultiPCM::operator==(const DivInstrumentMultiPCM& a) { - return true; +bool DivInstrumentMultiPCM::operator==(const DivInstrumentMultiPCM& other) { + return ( + _C(ar) && + _C(d1r) && + _C(dl) && + _C(d2r) && + _C(rr) && + _C(rc) && + _C(lfo) && + _C(vib) && + _C(am) + ); } -bool DivInstrumentWaveSynth::operator==(const DivInstrumentWaveSynth& a) { - return true; +bool DivInstrumentWaveSynth::operator==(const DivInstrumentWaveSynth& other) { + return ( + _C(wave1) && + _C(wave2) && + _C(rateDivider) && + _C(effect) && + _C(oneShot) && + _C(enabled) && + _C(global) && + _C(speed) && + _C(param1) && + _C(param2) && + _C(param3) && + _C(param4) + ); } -bool DivInstrumentSoundUnit::operator==(const DivInstrumentSoundUnit& a) { - return true; +bool DivInstrumentSoundUnit::operator==(const DivInstrumentSoundUnit& other) { + return _C(switchRoles); } -bool DivInstrumentES5506::operator==(const DivInstrumentES5506& a) { - return true; +bool DivInstrumentES5506::operator==(const DivInstrumentES5506& other) { + return ( + _C(filter.mode) && + _C(filter.k1) && + _C(filter.k2) && + _C(envelope.ecount) && + _C(envelope.lVRamp) && + _C(envelope.rVRamp) && + _C(envelope.k1Ramp) && + _C(envelope.k2Ramp) && + _C(envelope.k1Slow) && + _C(envelope.k2Slow) + ); } -bool DivInstrumentSNES::operator==(const DivInstrumentSNES& a) { - return true; +bool DivInstrumentSNES::operator==(const DivInstrumentSNES& other) { + return ( + _C(useEnv) && + _C(sus) && + _C(gainMode) && + _C(gain) && + _C(a) && + _C(d) && + _C(s) && + _C(r) + ); } void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song) { diff --git a/src/engine/instrument.h b/src/engine/instrument.h index db9221fcc..feab69c10 100644 --- a/src/engine/instrument.h +++ b/src/engine/instrument.h @@ -98,9 +98,9 @@ struct DivInstrumentFM { bool fixedDrums; unsigned short kickFreq, snareHatFreq, tomTopFreq; - bool operator==(const DivInstrumentFM& a); - bool operator!=(const DivInstrumentFM& a) { - return !(*this==a); + bool operator==(const DivInstrumentFM& other); + bool operator!=(const DivInstrumentFM& other) { + return !(*this==other); } struct Operator { bool enable; @@ -108,9 +108,9 @@ struct DivInstrumentFM { unsigned char dam, dvb, egt, ksl, sus, vib, ws, ksr; // YMU759/OPL/OPZ unsigned char kvs; - bool operator==(const Operator& a); - bool operator!=(const Operator& a) { - return !(*this==a); + bool operator==(const Operator& other); + bool operator!=(const Operator& other) { + return !(*this==other); } Operator(): enable(true), @@ -307,9 +307,9 @@ struct DivInstrumentGB { unsigned short data; } hwSeq[256]; - bool operator==(const DivInstrumentGB& a); - bool operator!=(const DivInstrumentGB& a) { - return !(*this==a); + bool operator==(const DivInstrumentGB& other); + bool operator!=(const DivInstrumentGB& other) { + return !(*this==other); } DivInstrumentGB(): @@ -334,9 +334,9 @@ struct DivInstrumentC64 { unsigned short cut; bool hp, lp, bp, ch3off; - bool operator==(const DivInstrumentC64& a); - bool operator!=(const DivInstrumentC64& a) { - return !(*this==a); + bool operator==(const DivInstrumentC64& other); + bool operator!=(const DivInstrumentC64& other) { + return !(*this==other); } DivInstrumentC64(): @@ -380,9 +380,9 @@ struct DivInstrumentAmiga { unsigned char waveLen; SampleMap noteMap[120]; - bool operator==(const DivInstrumentAmiga& a); - bool operator!=(const DivInstrumentAmiga& a) { - return !(*this==a); + bool operator==(const DivInstrumentAmiga& other); + bool operator!=(const DivInstrumentAmiga& other) { + return !(*this==other); } /** @@ -426,9 +426,9 @@ struct DivInstrumentAmiga { struct DivInstrumentX1_010 { int bankSlot; - bool operator==(const DivInstrumentX1_010& a); - bool operator!=(const DivInstrumentX1_010& a) { - return !(*this==a); + bool operator==(const DivInstrumentX1_010& other); + bool operator!=(const DivInstrumentX1_010& other) { + return !(*this==other); } DivInstrumentX1_010(): @@ -439,9 +439,9 @@ struct DivInstrumentN163 { int wave, wavePos, waveLen; unsigned char waveMode; - bool operator==(const DivInstrumentN163& a); - bool operator!=(const DivInstrumentN163& a) { - return !(*this==a); + bool operator==(const DivInstrumentN163& other); + bool operator!=(const DivInstrumentN163& other) { + return !(*this==other); } DivInstrumentN163(): @@ -457,9 +457,9 @@ struct DivInstrumentFDS { // this is here for compatibility. bool initModTableWithFirstWave; - bool operator==(const DivInstrumentFDS& a); - bool operator!=(const DivInstrumentFDS& a) { - return !(*this==a); + bool operator==(const DivInstrumentFDS& other); + bool operator!=(const DivInstrumentFDS& other) { + return !(*this==other); } DivInstrumentFDS(): @@ -474,9 +474,9 @@ struct DivInstrumentMultiPCM { unsigned char ar, d1r, dl, d2r, rr, rc; unsigned char lfo, vib, am; - bool operator==(const DivInstrumentMultiPCM& a); - bool operator!=(const DivInstrumentMultiPCM& a) { - return !(*this==a); + bool operator==(const DivInstrumentMultiPCM& other); + bool operator!=(const DivInstrumentMultiPCM& other) { + return !(*this==other); } DivInstrumentMultiPCM(): @@ -518,9 +518,9 @@ struct DivInstrumentWaveSynth { bool oneShot, enabled, global; unsigned char speed, param1, param2, param3, param4; - bool operator==(const DivInstrumentWaveSynth& a); - bool operator!=(const DivInstrumentWaveSynth& a) { - return !(*this==a); + bool operator==(const DivInstrumentWaveSynth& other); + bool operator!=(const DivInstrumentWaveSynth& other) { + return !(*this==other); } DivInstrumentWaveSynth(): @@ -541,9 +541,9 @@ struct DivInstrumentWaveSynth { struct DivInstrumentSoundUnit { bool switchRoles; - bool operator==(const DivInstrumentSoundUnit& a); - bool operator!=(const DivInstrumentSoundUnit& a) { - return !(*this==a); + bool operator==(const DivInstrumentSoundUnit& other); + bool operator!=(const DivInstrumentSoundUnit& other) { + return !(*this==other); } DivInstrumentSoundUnit(): @@ -582,9 +582,9 @@ struct DivInstrumentES5506 { Filter filter; Envelope envelope; - bool operator==(const DivInstrumentES5506& a); - bool operator!=(const DivInstrumentES5506& a) { - return !(*this==a); + bool operator==(const DivInstrumentES5506& other); + bool operator!=(const DivInstrumentES5506& other) { + return !(*this==other); } DivInstrumentES5506(): @@ -605,9 +605,9 @@ struct DivInstrumentSNES { unsigned char gain; unsigned char a, d, s, r; - bool operator==(const DivInstrumentSNES& a); - bool operator!=(const DivInstrumentSNES& a) { - return !(*this==a); + bool operator==(const DivInstrumentSNES& other); + bool operator!=(const DivInstrumentSNES& other) { + return !(*this==other); } DivInstrumentSNES():