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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Apr 6 15:32:41 CEST 2008


Revision: 31423
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31423&view=rev
Author:   lordhoto
Date:     2008-04-06 06:32:41 -0700 (Sun, 06 Apr 2008)

Log Message:
-----------
- Fixed HACKs in o2_getMusicDriver and o2_getSfxDriver
- Implemented missing bits in KyraEngine_v2::enterNewScene for MIDI (AdLib code still missing)
- Added music/sfx type to Sound class

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

Modified: scummvm/trunk/engines/kyra/scene_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v2.cpp	2008-04-06 13:06:05 UTC (rev 31422)
+++ scummvm/trunk/engines/kyra/scene_v2.cpp	2008-04-06 13:32:41 UTC (rev 31423)
@@ -81,9 +81,10 @@
 	}
 
 	bool newSoundFile = false;
+	uint32 waitTime = 0;
 	if (_sceneList[newScene].sound != _lastMusicCommand) {
 		newSoundFile = true;
-		//XXX
+		waitTime = _system->getMillis() + 1000;
 		_sound->beginFadeOut();
 	}
 	
@@ -113,7 +114,13 @@
 	_sceneExit4 = scene.exit4;
 
 	if (newSoundFile) {
-		//XXX while (snd_isPlaying()) ;
+		if (_sound->getMusicType() == Sound::kAdlib) {
+			while (0/*snd_isPlaying()*/)
+				_system->delayMillis(10);
+		} else {
+			while (waitTime > _system->getMillis())
+				_system->delayMillis(10);
+		}
 		snd_loadSoundFile(_sceneList[newScene].sound);
 	}
 

Modified: scummvm/trunk/engines/kyra/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_v2.cpp	2008-04-06 13:06:05 UTC (rev 31422)
+++ scummvm/trunk/engines/kyra/script_v2.cpp	2008-04-06 13:32:41 UTC (rev 31423)
@@ -1675,7 +1675,14 @@
 
 int KyraEngine_v2::o2_getSfxDriver(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getSfxDriver(%p) ()", (const void *)script);
-	return 1;	// HACK: this is AdLib driver, maybe we should return 6 for MT-32 or 7 for General MIDI too when we're using that
+	if (_sound->getSfxType() == Sound::kAdlib)
+		return 1;
+	else if (_sound->getSfxType() == Sound::kMidiMT32)
+		return 6;
+	else if (_sound->getSfxType() == Sound::kMidiGM)
+		return 7;
+	// TODO: find nice default value
+	return 0;
 }
 
 int KyraEngine_v2::o2_getVocSupport(ScriptState *script) {
@@ -1686,7 +1693,14 @@
 
 int KyraEngine_v2::o2_getMusicDriver(ScriptState *script) {
 	debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getMusicDriver(%p) ()", (const void *)script);
-	return 1;	// HACK: this is AdLib driver, maybe we should return 6 for MT-32 or 7 for General MIDI too when we're using that
+	if (_sound->getMusicType() == Sound::kAdlib)
+		return 1;
+	else if (_sound->getMusicType() == Sound::kMidiMT32)
+		return 6;
+	else if (_sound->getMusicType() == Sound::kMidiGM)
+		return 7;
+	// TODO: find nice default value
+	return 0;
 }
 
 int KyraEngine_v2::o2_setVocHigh(ScriptState *script) {

Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h	2008-04-06 13:06:05 UTC (rev 31422)
+++ scummvm/trunk/engines/kyra/sound.h	2008-04-06 13:32:41 UTC (rev 31423)
@@ -69,6 +69,16 @@
 	Sound(KyraEngine *vm, Audio::Mixer *mixer);
 	virtual ~Sound();
 
+	enum kType {
+		kAdlib,
+		kMidiMT32,
+		kMidiGM,
+		kTowns
+	};
+
+	virtual kType getMusicType() const = 0;
+	virtual kType getSfxType() const { return getMusicType(); }
+
 	/**
 	 * Initializes the output device.
 	 *
@@ -221,6 +231,8 @@
 	SoundAdlibPC(KyraEngine *vm, Audio::Mixer *mixer);
 	~SoundAdlibPC();
 
+	kType getMusicType() const { return kAdlib; }
+
 	bool init();
 	void process();
 
@@ -273,6 +285,8 @@
 	SoundMidiPC(KyraEngine *vm, Audio::Mixer *mixer, MidiDriver *driver);
 	~SoundMidiPC();
 
+	kType getMusicType() const { return isMT32() ? kMidiMT32 : kMidiGM; }
+
 	bool init() { return true; }
 
 	void updateVolumeSettings() { /*XXX*/ }
@@ -302,7 +316,7 @@
 	void setPassThrough(bool b)	{ _passThrough = b; }
 
 	void hasNativeMT32(bool nativeMT32);
-	bool isMT32() { return _nativeMT32; }
+	bool isMT32() const { return _nativeMT32; }
 
 private:
 	void setVolume(int vol);
@@ -343,6 +357,8 @@
 	SoundTowns(KyraEngine *vm, Audio::Mixer *mixer);
 	~SoundTowns();
 
+	kType getMusicType() const { return kTowns; }
+
 	bool init();
 	void process();
 
@@ -398,6 +414,8 @@
 	SoundTowns_v2(KyraEngine *vm, Audio::Mixer *mixer);
 	~SoundTowns_v2();
 
+	kType getMusicType() const { return kTowns; }
+
 	bool init();
 	void process();
 
@@ -424,6 +442,9 @@
 	MixedSoundDriver(KyraEngine *vm, Audio::Mixer *mixer, Sound *music, Sound *sfx) : Sound(vm, mixer), _music(music), _sfx(sfx) {}
 	~MixedSoundDriver() { delete _music; delete _sfx; }
 
+	kType getMusicType() const { return _music->getMusicType(); }
+	kType getSfxType() const { return _sfx->getSfxType(); }
+
 	bool init() { return (_music->init() && _sfx->init()); }
 	void process() { _music->process(); _sfx->process(); }
 


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