From c72d421659892a5e29390120466e09c9b9f53c9c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 Sep 2016 21:25:06 -0400 Subject: XEEN: Fix setting up music, musPlayInstrument command --- engines/xeen/music.cpp | 9 ++++----- engines/xeen/music.h | 11 ++++++++--- engines/xeen/sound.cpp | 7 +------ engines/xeen/sound.h | 11 ++--------- engines/xeen/worldofxeen/darkside_cutscenes.cpp | 16 +++++++++++++++- 5 files changed, 30 insertions(+), 24 deletions(-) (limited to 'engines/xeen') diff --git a/engines/xeen/music.cpp b/engines/xeen/music.cpp index ae3d5aba83..c4e4f7b4c3 100644 --- a/engines/xeen/music.cpp +++ b/engines/xeen/music.cpp @@ -179,7 +179,7 @@ void MusicDriver::playFX(uint effectId, const byte *data) { } void MusicDriver::playSong(const byte *data) { - _musDataPtr = data; + _musDataPtr = _musStartPtr = data; _musSubroutines.clear(); _musCountdownTimer = 0; _field1E = true; @@ -473,8 +473,9 @@ bool AdlibMusicDriver::musInjectMidi(const byte *&srcP, byte param) { } bool AdlibMusicDriver::musPlayInstrument(const byte *&srcP, byte param) { + byte instrument = *srcP++; if (param < 7) - playInstrument(param, _musInstrumentPtrs[param]); + playInstrument(param, _musInstrumentPtrs[instrument]); return false; } @@ -576,9 +577,7 @@ const uint AdlibMusicDriver::WAVEFORMS[24] = { /*------------------------------------------------------------------------*/ -Music::Music(Audio::Mixer *mixer) : _mixer(mixer), _musicDriver(nullptr), - _songData(nullptr) { - _mixer = mixer; +Music::Music() : _musicDriver(nullptr), _songData(nullptr) { _musicDriver = new AdlibMusicDriver(); loadEffectsData(); } diff --git a/engines/xeen/music.h b/engines/xeen/music.h index a715471088..f09f96ff79 100644 --- a/engines/xeen/music.h +++ b/engines/xeen/music.h @@ -308,11 +308,9 @@ private: * Updates any playing music */ void update(); - protected: - Audio::Mixer *_mixer; public: - Music(Audio::Mixer *mixer); + Music(); ~Music(); /** @@ -344,6 +342,13 @@ public: * Plays a song */ void playSong(const Common::String &name); + + /** + * Plays a song + */ + void playSong(const byte *data) { + _musicDriver->playSong(data); + } }; } // End of namespace Xeen diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp index 46532fa887..f3d3a3e75b 100644 --- a/engines/xeen/sound.cpp +++ b/engines/xeen/sound.cpp @@ -47,8 +47,7 @@ void Voc::stop() { /*------------------------------------------------------------------------*/ -Sound::Sound(XeenEngine *vm, Audio::Mixer *mixer): Music(mixer) { - +Sound::Sound(XeenEngine *vm, Audio::Mixer *mixer): Music(), _mixer(mixer) { } void Sound::proc2(Common::SeekableReadStream &f) { @@ -69,10 +68,6 @@ void Sound::playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHa _mixer->playStream(soundType, &soundHandle, stream); } -void Sound::playMusic(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle) { - // TODO -} - void Sound::stopSound(Audio::SoundHandle &soundHandle) { _mixer->stopHandle(soundHandle); } diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index 5dd80c0e55..aba38c81b2 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -56,6 +56,8 @@ public: }; class Sound : public Music { +private: + Audio::Mixer *_mixer; public: Sound(XeenEngine *vm, Audio::Mixer *mixer); @@ -67,19 +69,12 @@ public: void stopMusic(int id); - void playSong(Common::SeekableReadStream &f) {} - /** * Play a given sound */ void playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle, Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType); - /** - * Play a given music - */ - void playMusic(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle); - /** * Stop playing a sound */ @@ -88,8 +83,6 @@ public: void playSample(const Common::SeekableReadStream *stream, int v2 = 1) {} bool playSample(int v1, int v2) { return false; } - - void playFX(int id) {} }; } // End of namespace Xeen diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp index 514bcac901..6dd4bd20f6 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp +++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp @@ -55,6 +55,19 @@ bool DarkSideCutscenes::showDarkSideTitle() { screen.draw(); screen.fadeIn(4); + // **DEBUG**: Testing music + File f("bigtheme.m", *_vm->_files->_sideArchives[1]); + byte *data = new byte[f.size()]; + f.read(data, f.size()); + f.close(); + + sound.playSong(data); + + events.updateGameCounter(); + events.wait(1000, true); + + delete[] data; + /* // Initial loop for dragon roaring int nwcIndex = 0, nwcFrame = 0; for (int idx = 0; idx < 55 && !_vm->shouldQuit(); ++idx) { @@ -128,9 +141,10 @@ bool DarkSideCutscenes::showDarkSideTitle() { screen.fadeOut(8); screen.draw(); screen.fadeIn(4); - + events.updateGameCounter(); events.wait(60, true); + */ return true; } -- cgit v1.2.3