[Scummvm-cvs-logs] SF.net SVN: scummvm: [25753] scummvm/trunk/engines/queen

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Feb 20 20:23:08 CET 2007


Revision: 25753
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25753&view=rev
Author:   fingolfin
Date:     2007-02-20 11:23:07 -0800 (Tue, 20 Feb 2007)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/queen/queen.cpp
    scummvm/trunk/engines/queen/resource.cpp
    scummvm/trunk/engines/queen/resource.h
    scummvm/trunk/engines/queen/sound.cpp
    scummvm/trunk/engines/queen/sound.h

Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp	2007-02-20 18:50:17 UTC (rev 25752)
+++ scummvm/trunk/engines/queen/queen.cpp	2007-02-20 19:23:07 UTC (rev 25753)
@@ -398,7 +398,7 @@
 	_music = new Music(driver, this);
 	_music->hasNativeMT32(native_mt32);
 
-	_sound = Sound::giveSound(_mixer, this, _resource->getCompression());
+	_sound = Sound::makeSoundInstance(_mixer, this, _resource->getCompression());
 	_walk = new Walk(this);
 	//_talkspeedScale = (MAX_TEXT_SPEED - MIN_TEXT_SPEED) / 255.0;
 

Modified: scummvm/trunk/engines/queen/resource.cpp
===================================================================
--- scummvm/trunk/engines/queen/resource.cpp	2007-02-20 18:50:17 UTC (rev 25752)
+++ scummvm/trunk/engines/queen/resource.cpp	2007-02-20 19:23:07 UTC (rev 25753)
@@ -251,7 +251,7 @@
 	return NULL;
 }
 
-Common::File *Resource::giveSound(const char *filename, uint32 *size) {
+Common::File *Resource::findSound(const char *filename, uint32 *size) {
 	assert(strstr(filename, ".SB"));
 	Common::File *f = NULL;
 	ResourceEntry *re = resourceEntry(filename);

Modified: scummvm/trunk/engines/queen/resource.h
===================================================================
--- scummvm/trunk/engines/queen/resource.h	2007-02-20 18:50:17 UTC (rev 25752)
+++ scummvm/trunk/engines/queen/resource.h	2007-02-20 19:23:07 UTC (rev 25753)
@@ -71,7 +71,7 @@
 	bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; }
 
 	//! returns a reference to a sound file
-	Common::File *giveSound(const char *filename, uint32 *size);
+	Common::File *findSound(const char *filename, uint32 *size);
 
 	bool isDemo() const { return (_version.features & GF_DEMO) != 0; }
 	bool isInterview() const { return (_version.features & GF_INTERVIEW) != 0; }

Modified: scummvm/trunk/engines/queen/sound.cpp
===================================================================
--- scummvm/trunk/engines/queen/sound.cpp	2007-02-20 18:50:17 UTC (rev 25752)
+++ scummvm/trunk/engines/queen/sound.cpp	2007-02-20 19:23:07 UTC (rev 25753)
@@ -40,6 +40,55 @@
 
 namespace Queen {
 
+class SilentSound : public Sound {
+public:
+	SilentSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}
+protected:
+	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
+		// Do nothing
+	}
+};
+
+class SBSound : public Sound {
+public:
+	SBSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}
+protected:
+	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle);
+};
+
+#ifdef USE_MAD
+class MP3Sound : public Sound {
+public:
+	MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}
+protected:
+	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(f, size));
+	}
+};
+#endif
+
+#ifdef USE_VORBIS
+class OGGSound : public Sound {
+public:
+	OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}
+protected:
+	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(f, size));
+	}
+};
+#endif
+
+#ifdef USE_FLAC
+class FLACSound : public Sound {
+public:
+	FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
+protected:
+	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(f, size));
+	}
+};
+#endif // #ifdef USE_FLAC
+
 Sound::Sound(Audio::Mixer *mixer, QueenEngine *vm) :
 	_mixer(mixer), _vm(vm), _sfxToggle(true), _speechToggle(true), _musicToggle(true), _lastOverride(0) {
 #ifdef ENABLE_AMIGA_MUSIC
@@ -47,7 +96,7 @@
 #endif
 }
 
-Sound *Sound::giveSound(Audio::Mixer *mixer, QueenEngine *vm, uint8 compression) {
+Sound *Sound::makeSoundInstance(Audio::Mixer *mixer, QueenEngine *vm, uint8 compression) {
 	if (!mixer->isReady())
 		return new SilentSound(mixer, vm);
 
@@ -113,7 +162,7 @@
 	strcat(name, ".SB");
 	waitFinished(isSpeech);
 	uint32 size;
-	Common::File *f = _vm->resource()->giveSound(name, &size);
+	Common::File *f = _vm->resource()->findSound(name, &size);
 	if (f) {
 		playSoundData(f, size, isSpeech ? &_speechHandle : &_sfxHandle);
 		_speechSfxExists = isSpeech;
@@ -253,9 +302,6 @@
 	_lastOverride = (int16)READ_BE_INT16(ptr); ptr += 2;
 }
 
-void SilentSound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-}
-
 void SBSound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
 	int headerSize;
 	f->seek(2, SEEK_CUR);
@@ -282,22 +328,4 @@
 	}
 }
 
-#ifdef USE_MAD
-void MP3Sound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(f, size));
-}
-#endif
-
-#ifdef USE_VORBIS
-void OGGSound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(f, size));
-}
-#endif
-
-#ifdef USE_FLAC
-void FLACSound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(f, size));
-}
-#endif
-
 } //End of namespace Queen

Modified: scummvm/trunk/engines/queen/sound.h
===================================================================
--- scummvm/trunk/engines/queen/sound.h	2007-02-20 18:50:17 UTC (rev 25752)
+++ scummvm/trunk/engines/queen/sound.h	2007-02-20 19:23:07 UTC (rev 25753)
@@ -62,7 +62,12 @@
 public:
 	Sound(Audio::Mixer *mixer, QueenEngine *vm);
 	virtual ~Sound() {}
-	static Sound *giveSound(Audio::Mixer *mixer, QueenEngine *vm, uint8 compression);
+
+	/**
+	 * Factory method for subclasses of class Sound.
+	 */
+	static Sound *makeSoundInstance(Audio::Mixer *mixer, QueenEngine *vm, uint8 compression);
+
 	void playSfx(uint16 sfx);
 	void playSpeech(const char *base);
 	void playSong(int16 songNum);
@@ -130,47 +135,6 @@
 #endif
 };
 
-class SilentSound : public Sound {
-public:
-	SilentSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-protected:
-	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle);
-};
-
-class SBSound : public Sound {
-public:
-	SBSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-protected:
-	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle);
-};
-
-#ifdef USE_MAD
-class MP3Sound : public Sound {
-public:
-	MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-protected:
-	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle);
-};
-#endif
-
-#ifdef USE_VORBIS
-class OGGSound : public Sound {
-public:
-	OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-protected:
-	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle);
-};
-#endif
-
-#ifdef USE_FLAC
-class FLACSound : public Sound {
-public:
-	FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
-protected:
-	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle);
-};
-#endif // #ifdef USE_FLAC
-
 } // End of namespace Queen
 
 #endif


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