[Scummvm-cvs-logs] SF.net SVN: scummvm:[35178] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Nov 30 03:47:21 CET 2008


Revision: 35178
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35178&view=rev
Author:   lordhoto
Date:     2008-11-30 02:47:20 +0000 (Sun, 30 Nov 2008)

Log Message:
-----------
- Fix some valgrind warnings
- Added MIDI SFX support for Kyra2

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/sound.cpp
    scummvm/trunk/engines/kyra/sound.h
    scummvm/trunk/engines/kyra/sound_midi.cpp

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2008-11-30 02:38:08 UTC (rev 35177)
+++ scummvm/trunk/engines/kyra/sound.cpp	2008-11-30 02:47:20 UTC (rev 35178)
@@ -166,6 +166,13 @@
 
 	_curSfxFile = _curMusicTheme = file;
 	_sound->loadSoundFile(_curMusicTheme);
+
+	// Kyrandia 2 uses a special file for
+	// MIDI sound effects, so we load
+	// this here
+	if (_flags.gameID == GI_KYRA2)
+		_sound->loadSfxFile("K2SFX");
+
 	if (track != -1)
 		_sound->playTrack(track);
 }

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2008-11-30 02:38:08 UTC (rev 35177)
+++ scummvm/trunk/engines/kyra/sound.h	2008-11-30 02:47:20 UTC (rev 35178)
@@ -121,11 +121,17 @@
 
 	/**
 	 * Load a sound file for playing music
-	 * and sound effects from.
+	 * (and somtimes sound effects) from.
 	 */
 	virtual void loadSoundFile(Common::String file) = 0;
 
 	/**
+	 * Load a sound file for playing sound
+	 * effects from.
+	 */
+	virtual void loadSfxFile(Common::String file) { }
+
+	/**
 	 * Plays the specified track.
 	 *
 	 * @param track	track number
@@ -321,6 +327,7 @@
 
 	void loadSoundFile(uint file);
 	void loadSoundFile(Common::String file);
+	void loadSfxFile(Common::String file);
 
 	void playTrack(uint8 track);
 	void haltTrack();

Modified: scummvm/trunk/engines/kyra/sound_midi.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_midi.cpp	2008-11-30 02:38:08 UTC (rev 35177)
+++ scummvm/trunk/engines/kyra/sound_midi.cpp	2008-11-30 02:47:20 UTC (rev 35178)
@@ -157,8 +157,10 @@
 			sendIntern(0xC0, i, defaultPrograms[i-1], 0x00);
 	}
 
-	for (int i = 0; i < 4; ++i)
+	for (int i = 0; i < 4; ++i) {
+		_sources[i].volume = 0xFF;
 		initSource(i);
+	}
 }
 
 
@@ -458,6 +460,7 @@
 	}
 
 	_musicVolume = _sfxVolume = 0;
+	_fadeMusicOut = false;
 }
 
 SoundMidiPC::~SoundMidiPC() {
@@ -566,6 +569,24 @@
 	}
 }
 
+void SoundMidiPC::loadSfxFile(Common::String file) {
+	Common::StackLock lock(_mutex);
+
+	file += _useC55 ? ".C55" : ".XMI";
+	if (!_vm->resource()->exists(file.c_str()))
+		return;
+
+	if (_sfxFile != _musicFile)
+		delete[] _sfxFile;
+
+	_sfxFile = _vm->resource()->fileData(file.c_str(), &_sfxFileSize);
+	for (int i = 0; i < 3; ++i) {
+		_output->setSoundSource(i+1);
+		_sfx[i]->loadMusic(_sfxFile, _sfxFileSize);
+		_sfx[i]->stopPlaying();
+	}
+}
+
 void SoundMidiPC::playTrack(uint8 track) {
 	Common::StackLock lock(_mutex);
 	_output->initSource(0);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list