[Scummvm-git-logs] scummvm master -> c72d421659892a5e29390120466e09c9b9f53c9c

dreammaster dreammaster at scummvm.org
Fri Sep 16 03:25:15 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c72d421659 XEEN: Fix setting up music, musPlayInstrument command


Commit: c72d421659892a5e29390120466e09c9b9f53c9c
    https://github.com/scummvm/scummvm/commit/c72d421659892a5e29390120466e09c9b9f53c9c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-15T21:25:06-04:00

Commit Message:
XEEN: Fix setting up music, musPlayInstrument command

Changed paths:
    engines/xeen/music.cpp
    engines/xeen/music.h
    engines/xeen/sound.cpp
    engines/xeen/sound.h
    engines/xeen/worldofxeen/darkside_cutscenes.cpp



diff --git a/engines/xeen/music.cpp b/engines/xeen/music.cpp
index ae3d5ab..c4e4f7b 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 a715471..f09f96f 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 46532fa..f3d3a3e 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 5dd80c0..aba38c8 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,8 +69,6 @@ public:
 
 	void stopMusic(int id);
 
-	void playSong(Common::SeekableReadStream &f) {}
-
 	/**
 	 * Play a given sound
 	 */
@@ -76,11 +76,6 @@ public:
 		Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType);
 
 	/**
-	 * Play a given music
-	 */
-	void playMusic(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle);
-
-	/**
 	 * Stop playing a sound
 	 */
 	void stopSound(Audio::SoundHandle &soundHandle);
@@ -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 514bcac..6dd4bd2 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;
 }
 





More information about the Scummvm-git-logs mailing list