[Scummvm-cvs-logs] scummvm master -> f3ccc38e8d0f2ad310c522ee8e7a1de85e933263
bluegr
bluegr at gmail.com
Thu Dec 27 16:15:44 CET 2012
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
bf62205c73 MT32: Move the ROM file deletion code to the ScummVM MT32 driver
f3ccc38e8d MT32: Add missing initialization code
Commit: bf62205c737fe3904577d5e314b58cadba0c2789
https://github.com/scummvm/scummvm/commit/bf62205c737fe3904577d5e314b58cadba0c2789
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2012-12-27T07:12:26-08:00
Commit Message:
MT32: Move the ROM file deletion code to the ScummVM MT32 driver
This removes the custom ScummVM file deletion code in the munt code
Changed paths:
audio/softsynth/mt32.cpp
audio/softsynth/mt32/ROMInfo.cpp
diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp
index 3e87963..e2f1f36 100644
--- a/audio/softsynth/mt32.cpp
+++ b/audio/softsynth/mt32.cpp
@@ -110,8 +110,9 @@ private:
uint16 _channelMask;
MT32Emu::Synth *_synth;
MT32Emu::ReportHandlerScummVM *_reportHandler;
- const MT32Emu::ROMImage *_controlROM;
- const MT32Emu::ROMImage *_pcmROM;
+ const MT32Emu::ROMImage *_controlROM, *_pcmROM;
+ Common::File *_controlFile, *_pcmFile;
+ void deleteMuntStructures();
int _outputRate;
@@ -198,10 +199,26 @@ MidiDriver_MT32::MidiDriver_MT32(Audio::Mixer *mixer) : MidiDriver_Emulated(mixe
}
MidiDriver_MT32::~MidiDriver_MT32() {
+ deleteMuntStructures();
+}
+
+void MidiDriver_MT32::deleteMuntStructures() {
delete _synth;
+ _synth = NULL;
delete _reportHandler;
- MT32Emu::ROMImage::freeROMImage(_controlROM);
- MT32Emu::ROMImage::freeROMImage(_pcmROM);
+ _reportHandler = NULL;
+
+ if (_controlROM)
+ MT32Emu::ROMImage::freeROMImage(_controlROM);
+ _controlROM = NULL;
+ if (_pcmROM)
+ MT32Emu::ROMImage::freeROMImage(_pcmROM);
+ _pcmROM = NULL;
+
+ delete _controlFile;
+ _controlFile = NULL;
+ delete _pcmFile;
+ _pcmFile = NULL;
}
int MidiDriver_MT32::open() {
@@ -226,14 +243,14 @@ int MidiDriver_MT32::open() {
_initializing = true;
drawMessage(-1, _s("Initializing MT-32 Emulator"));
- Common::File *controlFile = new Common::File();
- if (!controlFile->open("MT32_CONTROL.ROM"))
+ _controlFile = new Common::File();
+ if (!_controlFile->open("MT32_CONTROL.ROM"))
error("Error opening MT32_CONTROL.ROM");
- Common::File *pcmFile = new Common::File();
- if (!pcmFile->open("MT32_PCM.ROM"))
+ _pcmFile = new Common::File();
+ if (!_pcmFile->open("MT32_PCM.ROM"))
error("Error opening MT32_PCM.ROM");
- _controlROM = MT32Emu::ROMImage::makeROMImage(controlFile);
- _pcmROM = MT32Emu::ROMImage::makeROMImage(pcmFile);
+ _controlROM = MT32Emu::ROMImage::makeROMImage(_controlFile);
+ _pcmROM = MT32Emu::ROMImage::makeROMImage(_pcmFile);
if (!_synth->open(*_controlROM, *_pcmROM))
return MERR_DEVICE_NOT_AVAILABLE;
@@ -295,12 +312,7 @@ void MidiDriver_MT32::close() {
_mixer->stopHandle(_mixerSoundHandle);
_synth->close();
- delete _synth;
- _synth = NULL;
- delete _reportHandler;
- _reportHandler = NULL;
- MT32Emu::ROMImage::freeROMImage(_controlROM);
- MT32Emu::ROMImage::freeROMImage(_pcmROM);
+ deleteMuntStructures();
}
void MidiDriver_MT32::generateSamples(int16 *data, int len) {
diff --git a/audio/softsynth/mt32/ROMInfo.cpp b/audio/softsynth/mt32/ROMInfo.cpp
index 5735409..514bc23 100644
--- a/audio/softsynth/mt32/ROMInfo.cpp
+++ b/audio/softsynth/mt32/ROMInfo.cpp
@@ -96,7 +96,6 @@ const ROMImage* ROMImage::makeROMImage(Common::File *file) {
void ROMImage::freeROMImage(const ROMImage *romImage) {
ROMInfo::freeROMInfo(romImage->romInfo);
- delete (romImage->file);
delete romImage;
}
Commit: f3ccc38e8d0f2ad310c522ee8e7a1de85e933263
https://github.com/scummvm/scummvm/commit/f3ccc38e8d0f2ad310c522ee8e7a1de85e933263
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2012-12-27T07:12:27-08:00
Commit Message:
MT32: Add missing initialization code
This code wasn't added when syncing with the official munt codebase
Changed paths:
audio/softsynth/mt32/TVA.cpp
diff --git a/audio/softsynth/mt32/TVA.cpp b/audio/softsynth/mt32/TVA.cpp
index fd442da..7aadd64 100644
--- a/audio/softsynth/mt32/TVA.cpp
+++ b/audio/softsynth/mt32/TVA.cpp
@@ -30,7 +30,7 @@ namespace MT32Emu {
static Bit8u biasLevelToAmpSubtractionCoeff[13] = {255, 187, 137, 100, 74, 54, 40, 29, 21, 15, 10, 5, 0};
TVA::TVA(const Partial *usePartial, LA32Ramp *useAmpRamp) :
- partial(usePartial), ampRamp(useAmpRamp), system_(&usePartial->getSynth()->mt32ram.system) {
+ partial(usePartial), ampRamp(useAmpRamp), system_(&usePartial->getSynth()->mt32ram.system), phase(TVA_PHASE_DEAD) {
}
void TVA::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) {
More information about the Scummvm-git-logs
mailing list