diff options
author | Paul Gilbert | 2014-09-05 22:21:24 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-09-05 22:21:24 -0400 |
commit | efcf87a6e5d9be34839cb60e3b257fe330a3b103 (patch) | |
tree | 1301e1cef4e738efed0651c66c8802caa3aef67b /engines/mads/nebular | |
parent | 2942f93ed5c884fdd3843ff56b6a2688fdb780dc (diff) | |
download | scummvm-rg350-efcf87a6e5d9be34839cb60e3b257fe330a3b103.tar.gz scummvm-rg350-efcf87a6e5d9be34839cb60e3b257fe330a3b103.tar.bz2 scummvm-rg350-efcf87a6e5d9be34839cb60e3b257fe330a3b103.zip |
MADS: Fix OPL init error when showing credits multiple times
Diffstat (limited to 'engines/mads/nebular')
-rw-r--r-- | engines/mads/nebular/sound_nebular.cpp | 27 | ||||
-rw-r--r-- | engines/mads/nebular/sound_nebular.h | 22 |
2 files changed, 24 insertions, 25 deletions
diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index b46863cea3..5ce362e053 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -149,7 +149,7 @@ AdlibSample::AdlibSample(Common::SeekableReadStream &s) { /*-----------------------------------------------------------------------*/ -ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffset) { +ASound::ASound(Audio::Mixer *mixer, FM_OPL *opl, const Common::String &filename, int dataOffset) { // Open up the appropriate sound file if (!_soundFile.open(filename)) error("Could not open file - %s", filename.c_str()); @@ -197,8 +197,7 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs // Store passed parameters, and setup OPL _dataOffset = dataOffset; _mixer = mixer; - _opl = OPL::Config::create(); - assert(_opl); + _opl = opl; _opl->init(getRate()); _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, @@ -217,8 +216,6 @@ ASound::~ASound() { delete[] (*i)._data; _mixer->stopHandle(_soundHandle); - _opl->reset(); - delete _opl; } void ASound::adlibInit() { @@ -942,8 +939,8 @@ const ASound1::CommandPtr ASound1::_commandList[42] = { &ASound1::command40, &ASound1::command41 }; -ASound1::ASound1(Audio::Mixer *mixer) - : ASound(mixer, "asound.001", 0x1520) { +ASound1::ASound1(Audio::Mixer *mixer, FM_OPL *opl) + : ASound(mixer, opl, "asound.001", 0x1520) { _cmd23Toggle = false; // Load sound samples @@ -1243,7 +1240,7 @@ const ASound2::CommandPtr ASound2::_commandList[44] = { &ASound2::command40, &ASound2::command41, &ASound2::command42, &ASound2::command43 }; -ASound2::ASound2(Audio::Mixer *mixer) : ASound(mixer, "asound.002", 0x15E0) { +ASound2::ASound2(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.002", 0x15E0) { _command12Param = 0xFD; // Load sound samples @@ -1614,7 +1611,7 @@ const ASound3::CommandPtr ASound3::_commandList[61] = { &ASound3::command60 }; -ASound3::ASound3(Audio::Mixer *mixer) : ASound(mixer, "asound.003", 0x15B0) { +ASound3::ASound3(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.003", 0x15B0) { _command39Flag = false; // Load sound samples @@ -2018,7 +2015,7 @@ const ASound4::CommandPtr ASound4::_commandList[61] = { &ASound4::command60 }; -ASound4::ASound4(Audio::Mixer *mixer) : ASound(mixer, "asound.004", 0x14F0) { +ASound4::ASound4(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.004", 0x14F0) { // Load sound samples _soundFile.seek(_dataOffset + 0x122); for (int i = 0; i < 210; ++i) @@ -2274,7 +2271,7 @@ const ASound5::CommandPtr ASound5::_commandList[42] = { &ASound5::command40, &ASound5::command41 }; -ASound5::ASound5(Audio::Mixer *mixer) : ASound(mixer, "asound.002", 0x15E0) { +ASound5::ASound5(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.002", 0x15E0) { // Load sound samples _soundFile.seek(_dataOffset + 0x144); for (int i = 0; i < 164; ++i) @@ -2515,7 +2512,7 @@ const ASound6::CommandPtr ASound6::_commandList[30] = { &ASound6::nullCommand, &ASound6::command29 }; -ASound6::ASound6(Audio::Mixer *mixer) : ASound(mixer, "asound.006", 0x1390) { +ASound6::ASound6(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.006", 0x1390) { // Load sound samples _soundFile.seek(_dataOffset + 0x122); for (int i = 0; i < 200; ++i) @@ -2671,7 +2668,7 @@ const ASound7::CommandPtr ASound7::_commandList[38] = { &ASound7::command36, &ASound7::command37 }; -ASound7::ASound7(Audio::Mixer *mixer) : ASound(mixer, "asound.007", 0x1460) { +ASound7::ASound7(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.007", 0x1460) { // Load sound samples _soundFile.seek(_dataOffset + 0x122); for (int i = 0; i < 214; ++i) @@ -2877,7 +2874,7 @@ const ASound8::CommandPtr ASound8::_commandList[38] = { &ASound8::command36, &ASound8::command37 }; -ASound8::ASound8(Audio::Mixer *mixer) : ASound(mixer, "asound.008", 0x1490) { +ASound8::ASound8(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.008", 0x1490) { // Load sound samples _soundFile.seek(_dataOffset + 0x122); for (int i = 0; i < 174; ++i) @@ -3133,7 +3130,7 @@ const ASound9::CommandPtr ASound9::_commandList[52] = { &ASound9::command48, &ASound9::command49, &ASound9::command50, &ASound9::command51 }; -ASound9::ASound9(Audio::Mixer *mixer) : ASound(mixer, "asound.009", 0x16F0) { +ASound9::ASound9(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.009", 0x16F0) { _v1 = _v2 = 0; _soundPtr = nullptr; diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 744467b45e..abb6516030 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -305,10 +305,12 @@ public: public: /** * Constructor + * @param mixer Mixer + * @param opl OPL * @param filename Specifies the adlib sound player file to use * @param dataOffset Offset in the file of the data segment */ - ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffset); + ASound(Audio::Mixer *mixer, FM_OPL *opl, const Common::String &filename, int dataOffset); /** * Destructor @@ -408,7 +410,7 @@ private: void command111213(); int command2627293032(); public: - ASound1(Audio::Mixer *mixer); + ASound1(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; @@ -460,7 +462,7 @@ private: void command9Randomize(); void command9Apply(byte *data, int val, int incr); public: - ASound2(Audio::Mixer *mixer); + ASound2(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; @@ -520,7 +522,7 @@ private: void command9Randomize(); void command9Apply(byte *data, int val, int incr); public: - ASound3(Audio::Mixer *mixer); + ASound3(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; @@ -558,7 +560,7 @@ private: void method1(); public: - ASound4(Audio::Mixer *mixer); + ASound4(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; @@ -604,7 +606,7 @@ private: int command42(); int command43(); public: - ASound5(Audio::Mixer *mixer); + ASound5(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; @@ -633,7 +635,7 @@ private: int command25(); int command29(); public: - ASound6(Audio::Mixer *mixer); + ASound6(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; @@ -665,7 +667,7 @@ private: int command36(); int command37(); public: - ASound7(Audio::Mixer *mixer); + ASound7(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; @@ -708,7 +710,7 @@ private: void method1(byte *pData); void adjustRange(byte *pData, byte v, int incr); public: - ASound8(Audio::Mixer *mixer); + ASound8(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; @@ -767,7 +769,7 @@ private: int command59(); int command60(); public: - ASound9(Audio::Mixer *mixer); + ASound9(Audio::Mixer *mixer, FM_OPL *opl); virtual int command(int commandId, int param); }; |