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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Mar 12 06:23:03 CET 2006


Revision: 21234
Author:   lordhoto
Date:     2006-03-12 06:22:27 -0800 (Sun, 12 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21234&view=rev

Log Message:
-----------
Music in the last two intro scenes plays now again with adlib.
Cleaned up the sound code a bit (removed some unneeded functions).

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra.cpp
    scummvm/trunk/engines/kyra/kyra.h
    scummvm/trunk/engines/kyra/seqplayer.cpp
    scummvm/trunk/engines/kyra/sequences_v1.cpp
    scummvm/trunk/engines/kyra/sound.cpp
    scummvm/trunk/engines/kyra/sound.h
    scummvm/trunk/engines/kyra/sound_adlib.cpp
Modified: scummvm/trunk/engines/kyra/kyra.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra.cpp	2006-03-12 12:55:16 UTC (rev 21233)
+++ scummvm/trunk/engines/kyra/kyra.cpp	2006-03-12 14:22:27 UTC (rev 21234)
@@ -646,8 +646,6 @@
 		error("Could not load \"_NPC.EMC\" script");
 	}
 	
-	snd_playTheme(1);
-	snd_setSoundEffectFile(1);
 	enterNewScene(_currentCharacter->sceneId, _currentCharacter->facing, 0, 0, 1);
 	
 	if (_abortIntroFlag && _skipFlag) {

Modified: scummvm/trunk/engines/kyra/kyra.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra.h	2006-03-12 12:55:16 UTC (rev 21233)
+++ scummvm/trunk/engines/kyra/kyra.h	2006-03-12 14:22:27 UTC (rev 21234)
@@ -587,8 +587,6 @@
 	void seq_playCredits();
 	void updateKyragemFading();
 	
-	void snd_setSoundEffectFile(int file);
-	
 	static OpcodeProc _opcodeTable[];
 	static const int _opcodeTableSize;
 	

Modified: scummvm/trunk/engines/kyra/seqplayer.cpp
===================================================================
--- scummvm/trunk/engines/kyra/seqplayer.cpp	2006-03-12 12:55:16 UTC (rev 21233)
+++ scummvm/trunk/engines/kyra/seqplayer.cpp	2006-03-12 14:22:27 UTC (rev 21234)
@@ -404,11 +404,10 @@
 			break;
 		}
 	} else {*/
-		if (msg == 0) {
-			// nothing to do here...
-		} else if (msg == 1) {
+		if (msg == 1) {
 			_sound->beginFadeOut();
 		} else {
+			_sound->haltTrack();
 			_sound->playTrack(msg);
 		}
 //	}

Modified: scummvm/trunk/engines/kyra/sequences_v1.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_v1.cpp	2006-03-12 12:55:16 UTC (rev 21233)
+++ scummvm/trunk/engines/kyra/sequences_v1.cpp	2006-03-12 14:22:27 UTC (rev 21234)
@@ -82,7 +82,7 @@
 	_screen->fadeFromBlack();
 	delay(60 * _tickLength);
 	_screen->fadeToBlack();
-	_sound->stopMusic();
+	_sound->haltTrack();
 }
 
 void KyraEngine::seq_intro() {
@@ -110,7 +110,6 @@
 	_seq->setCopyViewOffs(true);
 	_screen->setFont(Screen::FID_8_FNT);
 	snd_playTheme(MUSIC_INTRO, 2);
- 	snd_setSoundEffectFile(MUSIC_INTRO);
 	_text->setTalkCoords(144);
 	for (int i = 0; i < ARRAYSIZE(introProcTable) && !seq_skipSequence(); ++i) {
 		(this->*introProcTable[i])();
@@ -118,7 +117,7 @@
 	_text->setTalkCoords(136);
 	delay(30 * _tickLength);
 	_seq->setCopyViewOffs(false);
-	_sound->stopMusic();
+	_sound->haltTrack();
 	if (_features & GF_TALKIE) {
 		_res->unloadPakFile("INTRO.VRM");
 	}

Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2006-03-12 12:55:16 UTC (rev 21233)
+++ scummvm/trunk/engines/kyra/sound.cpp	2006-03-12 14:22:27 UTC (rev 21234)
@@ -92,7 +92,7 @@
 	_eventFromMusic = false;
 	_fadeMusicOut = _sfxIsPlaying = false;
 	_fadeStartTime = 0;
-	_isPlaying = _isLooping = _nativeMT32 = false;
+	_isPlaying = _nativeMT32 = false;
 	_soundEffect = _parser = 0;
 	_soundEffectSource = _parserSource = 0;
 
@@ -203,9 +203,6 @@
 	switch (type) {
 	case 0x2F:	// End of Track
 		if (_eventFromMusic) {
-			if (!_isLooping) {
-				_isPlaying = false;
-			}
 			// remap all channels
 			for (int i = 0; i < 16; ++i) {
 				_virChannel[i] = i;
@@ -220,7 +217,7 @@
 	}
 }
 
-void SoundMidiPC::playMusic(const char *file) {
+void SoundMidiPC::loadMusicFile(const char *file) {
 	char filename[25];
 	sprintf(filename, "%s.XMI", file);
 
@@ -233,6 +230,7 @@
 	}
 
 	playMusic(data, size);
+	loadSoundEffectFile(file);
 }
 
 void SoundMidiPC::playMusic(uint8 *data, uint32 size) {
@@ -291,7 +289,6 @@
 }
 
 void SoundMidiPC::stopMusic() {
-	_isLooping = false;
 	_isPlaying = false;
 	if (_parser) {
 		_parser->unloadMusic();
@@ -330,7 +327,6 @@
 		music->setVolume(255);
 		music->_fadeStartTime = 0;
 		music->_fadeMusicOut = false;
-		music->_isLooping = false;
 		music->_isPlaying = false;
 		
 		music->_eventFromMusic = true;
@@ -360,14 +356,12 @@
 	}
 }
 
-void SoundMidiPC::playTrack(uint8 track, bool loop) {
+void SoundMidiPC::playTrack(uint8 track) {
 	if (_parser) {
 		_isPlaying = true;
-		_isLooping = loop;
 		_parser->setTrack(track);
 		_parser->jumpToTick(0);
 		_parser->setTempo(1);
-		_parser->property(MidiParser::mpAutoLoop, loop);
 	}
 }
 
@@ -392,16 +386,10 @@
 	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playTheme(%d)", file);
 	assert(file < _musicFilesCount);
 	_curMusicTheme = _newMusicTheme = file;
-	_sound->playMusic(_musicFiles[file]);
-	_sound->playTrack(track, false);
+	_sound->loadMusicFile(_musicFiles[file]);
+	_sound->playTrack(track);
 }
 
-void KyraEngine::snd_setSoundEffectFile(int file) {
-	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_setSoundEffectFile(%d)", file);
-	assert(file < _musicFilesCount);
-	_sound->loadSoundEffectFile(_musicFiles[file]);
-}
-
 void KyraEngine::snd_playSoundEffect(int track) {
 	debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playSoundEffect(%d)", track);
 	if (track == 49) {
@@ -416,18 +404,18 @@
 	static const int8 soundTable[] = {
 		-1,   0,  -1,   1,   0,   3,   0,   2,
 		 0,   4,   1,   2,   1,   3,   1,   4,
-		 1, 0x5C,   1,   6,   1,   7,   2,   2,
+		 1,  92,   1,   6,   1,   7,   2,   2,
 		 2,   3,   2,   4,   2,   5,   2,   6,
 		 2,   7,   3,   3,   3,   4,   1,   8,
 		 1,   9,   4,   2,   4,   3,   4,   4,
 		 4,   5,   4,   6,   4,   7,   4,   8,
-		 1, 0x0B,   1, 0x0C,   1, 0x0E,   1, 0x0D,
-		 4,   9,   5, 0x0C,   6,   2,   6,   6,
+		 1,  11,   1,  12,   1,  14,   1,  13,
+		 4,   9,   5,  12,   6,   2,   6,   6,
 		 6,   7,   6,   8,   6,   9,   6,   3,
 		 6,   4,   6,   5,   7,   2,   7,   3,
 		 7,   4,   7,   5,   7,   6,   7,   7,
 		 7,   8,   7,   9,   8,   2,   8,   3,
-		 8,   4,   8,   5,   6, 0x0B,   5, 0x0B
+		 8,   4,   8,   5,   6,  11,   5,  11
 	};
 	//if (!_disableSound) {
 	//	XXX
@@ -446,7 +434,7 @@
 		if (_lastMusicCommand != command) {
 			_lastMusicCommand = command;
 			_sound->haltTrack();
-			_sound->playTrack(soundTable[command*2+1], true);
+			_sound->playTrack(soundTable[command*2+1]);
 		}
 	} else {
 		_lastMusicCommand = 1;

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2006-03-12 12:55:16 UTC (rev 21233)
+++ scummvm/trunk/engines/kyra/sound.h	2006-03-12 14:22:27 UTC (rev 21234)
@@ -49,20 +49,14 @@
 	virtual void setVolume(int volume) = 0;
 	virtual int getVolume() = 0;
 	
-	virtual void playMusic(const char *file) = 0;
-	virtual void stopMusic() = 0;
+	virtual void loadMusicFile(const char *file) = 0;
 	
-	virtual void playTrack(uint8 track, bool looping = true) = 0;
+	virtual void playTrack(uint8 track) = 0;
 	virtual void haltTrack() = 0;
-	virtual void startTrack() = 0;
 	
-	virtual void loadSoundEffectFile(const char *file) = 0;
-	virtual void stopSoundEffect() = 0;
-	
 	virtual void playSoundEffect(uint8 track) = 0;
 	
 	virtual void beginFadeOut() = 0;
-	virtual bool fadeOut() = 0;
 	
 	void voicePlay(const char *file);
 	void voiceUnload() {}
@@ -97,20 +91,14 @@
 	void setVolume(int volume);
 	int getVolume();
 	
-	void playMusic(const char *file);
-	void stopMusic();
+	void loadMusicFile(const char *file);
 	
-	void playTrack(uint8 track, bool looping);
+	void playTrack(uint8 track);
 	void haltTrack();
-	void startTrack();
 	
-	void loadSoundEffectFile(const char *file);
-	void stopSoundEffect();
-	
 	void playSoundEffect(uint8 track);
 	
 	void beginFadeOut();
-	bool fadeOut();
 private:
 	void loadSoundFile(const char *file);
 
@@ -139,26 +127,14 @@
 	void setVolume(int volume);
 	int getVolume() { return _volume; }
 
-	void hasNativeMT32(bool nativeMT32) { _nativeMT32 = nativeMT32; }
-	bool isMT32() { return _nativeMT32; }
-
-	void playMusic(const char *file);
-	void playMusic(uint8 *data, uint32 size);
-	void stopMusic();
-
-	void playTrack(uint8 track, bool looping);
+	void loadMusicFile(const char *file);
+	
+	void playTrack(uint8 track);
 	void haltTrack() { _isPlaying = false; }
-	void startTrack() { _isPlaying = true; }
-	void setPassThrough(bool b)	{ _passThrough = b; }
-
-	void loadSoundEffectFile(const char *file);
-	void loadSoundEffectFile(uint8 *data, uint32 size);
-	void stopSoundEffect();
-
+	
 	void playSoundEffect(uint8 track);
 
 	void beginFadeOut();
-	bool fadeOut() { return _fadeMusicOut; }
 
 	//MidiDriver interface implementation
 	int open();
@@ -172,8 +148,19 @@
 	//Channel allocation functions
 	MidiChannel *allocateChannel()		{ return 0; }
 	MidiChannel *getPercussionChannel()	{ return 0; }
+	
+	void setPassThrough(bool b)	{ _passThrough = b; }
+	
+	void hasNativeMT32(bool nativeMT32) { _nativeMT32 = nativeMT32; }
+	bool isMT32() { return _nativeMT32; }
 
 private:
+	void playMusic(uint8 *data, uint32 size);
+	void stopMusic();
+	void loadSoundEffectFile(const char *file);
+	void loadSoundEffectFile(uint8 *data, uint32 size);
+	
+	void stopSoundEffect();
 
 	static void onTimer(void *data);
 
@@ -188,7 +175,6 @@
 	bool _sfxIsPlaying;
 	uint32 _fadeStartTime;
 	bool _fadeMusicOut;
-	bool _isLooping;
 	bool _eventFromMusic;
 	MidiParser *_parser;
 	byte *_parserSource;

Modified: scummvm/trunk/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_adlib.cpp	2006-03-12 12:55:16 UTC (rev 21233)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp	2006-03-12 14:22:27 UTC (rev 21234)
@@ -31,11 +31,6 @@
 #include "sound/fmopl.h"
 #include "sound/audiostream.h"
 
-// TODO:
-//   - check how the sounds are stopped (doesn't work atm whyever)
-//   - implement music pausing + stop and fadeing
-//   - check why the sfx sounds strange sometimes
-
 // Basic Adlib Programming:
 // http://www.gamedev.net/reference/articles/article446.asp
 
@@ -175,7 +170,7 @@
 
 	void primaryEffect1(OutputState &state);
 	void primaryEffect2(OutputState &state);
-	void secondaryEffect1(OutputState& state);
+	void secondaryEffect1(OutputState &state);
 
 	void resetAdlibState();
 	void writeOPL(byte reg, byte val);
@@ -2187,34 +2182,20 @@
 	return 0;
 }
 
-void SoundAdlibPC::playMusic(const char *file) {
+void SoundAdlibPC::loadMusicFile(const char *file) {
 	loadSoundFile(file);
 }
 
-void SoundAdlibPC::stopMusic() {
-	//playSoundEffect(0);
-}
-
-void SoundAdlibPC::playTrack(uint8 track, bool looping) {
+void SoundAdlibPC::playTrack(uint8 track) {
 	playSoundEffect(track);
 }
 
 void SoundAdlibPC::haltTrack() {
 	unk1();
 	unk2();
-	_engine->_system->delayMillis(3 * 60);
+	//_engine->_system->delayMillis(3 * 60);
 }
 
-void SoundAdlibPC::startTrack() {
-}
-
-void SoundAdlibPC::loadSoundEffectFile(const char *file) {
-	loadSoundFile(file);
-}
-
-void SoundAdlibPC::stopSoundEffect() {
-}
-
 void SoundAdlibPC::playSoundEffect(uint8 track) {
 	uint8 soundId = _trackEntries[track];
 	if ((int8)soundId == -1 || !_soundDataPtr)
@@ -2251,10 +2232,6 @@
 	playSoundEffect(1);
 }
 
-bool SoundAdlibPC::fadeOut() {
-	return false;
-}
-
 void SoundAdlibPC::loadSoundFile(const char *file) {
 	if (_soundFileLoaded == file)
 		return;


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