diff options
author | Wohlstand <admin@wohlnet.ru> | 2016-12-07 18:56:26 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2016-12-07 18:56:26 +0300 |
commit | fb22d6c8bb89a398b36496ecdc29fbb80f8ec77c (patch) | |
tree | c1f697b9c45031b4d588854012bd723bb20078fb | |
parent | d538d57803c7651a36a720eb4ae4d53fb0efacab (diff) | |
download | libADLMIDI-fb22d6c8bb89a398b36496ecdc29fbb80f8ec77c.tar.gz libADLMIDI-fb22d6c8bb89a398b36496ecdc29fbb80f8ec77c.tar.bz2 libADLMIDI-fb22d6c8bb89a398b36496ecdc29fbb80f8ec77c.zip |
Ooops
Fixed wrong generated sound in some cases.
DBOPL has own constructors to initialize it's fields. memset no need here
-rw-r--r-- | src/adlmidi.cpp | 3 | ||||
-rw-r--r-- | src/dbopl.cpp | 17 | ||||
-rw-r--r-- | src/dbopl.h | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index 6372f55..265208b 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -429,8 +429,7 @@ struct OPL3 { LogarithmicVolumes = false; #ifdef ADLMIDI_USE_DOSBOX_OPL - DBOPL::Handler emptyChip; - memset(&emptyChip, 0, sizeof(DBOPL::Handler)); + DBOPL::Handler emptyChip; //Constructors inside are will initialize necessary fields #else _opl3_chip emptyChip; memset(&emptyChip, 0, sizeof(_opl3_chip)); diff --git a/src/dbopl.cpp b/src/dbopl.cpp index 1f2f397..e534c99 100644 --- a/src/dbopl.cpp +++ b/src/dbopl.cpp @@ -1203,6 +1203,23 @@ namespace DBOPL regBD = 0; reg104 = 0; opl3Active = 0; + //Extra zeros! + vibratoIndex = 0; + tremoloIndex = 0; + vibratoSign = 0; + vibratoShift = 0; + tremoloValue = 0; + vibratoStrength = 0; + tremoloStrength = 0; + waveFormMask = 0; + lfoCounter = 0; + lfoAdd = 0; + noiseCounter = 0; + noiseAdd = 0; + noiseValue = 0; + memset(freqMul, 0, sizeof(Bit32u) * 16); + memset(linearRates, 0, sizeof(Bit32u) * 76); + memset(attackRates, 0, sizeof(Bit32u) * 76); } INLINE Bit32u Chip::ForwardNoise() diff --git a/src/dbopl.h b/src/dbopl.h index 5dfe7fe..bdd439d 100644 --- a/src/dbopl.h +++ b/src/dbopl.h @@ -173,6 +173,7 @@ namespace DBOPL Bits GetWave(Bitu index, Bitu vol); public: Operator(); + char ____padding[5]; }; struct Channel @@ -211,6 +212,7 @@ namespace DBOPL template<SynthMode mode> Channel *BlockTemplate(Chip *chip, Bit32u samples, Bit32s *output); Channel(); + char ____padding[6]; }; struct Chip |