diff options
| author | Max Horn | 2007-02-20 19:23:07 +0000 | 
|---|---|---|
| committer | Max Horn | 2007-02-20 19:23:07 +0000 | 
| commit | cc210d75129619afe9c2dad6470bfdebb0d494a3 (patch) | |
| tree | cd7c380a3af3a0b22ff37f1360f6a8b85df61b7f | |
| parent | 227a080e5b25762dc7a5a942dcfbfdbfcd76c372 (diff) | |
| download | scummvm-rg350-cc210d75129619afe9c2dad6470bfdebb0d494a3.tar.gz scummvm-rg350-cc210d75129619afe9c2dad6470bfdebb0d494a3.tar.bz2 scummvm-rg350-cc210d75129619afe9c2dad6470bfdebb0d494a3.zip | |
cleanup
svn-id: r25753
| -rw-r--r-- | engines/queen/queen.cpp | 2 | ||||
| -rw-r--r-- | engines/queen/resource.cpp | 2 | ||||
| -rw-r--r-- | engines/queen/resource.h | 2 | ||||
| -rw-r--r-- | engines/queen/sound.cpp | 74 | ||||
| -rw-r--r-- | engines/queen/sound.h | 48 | 
5 files changed, 60 insertions, 68 deletions
| diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index 273436837f..168f80f364 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -398,7 +398,7 @@ int QueenEngine::init() {  	_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; diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp index 753ca1ff4e..6945635818 100644 --- a/engines/queen/resource.cpp +++ b/engines/queen/resource.cpp @@ -251,7 +251,7 @@ const RetailGameVersion *Resource::detectGameVersionFromSize(uint32 size) {  	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); diff --git a/engines/queen/resource.h b/engines/queen/resource.h index 98b4ef46fb..2e669198fb 100644 --- a/engines/queen/resource.h +++ b/engines/queen/resource.h @@ -71,7 +71,7 @@ public:  	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; } diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index b2f9bb04f5..917351f3da 100644 --- a/engines/queen/sound.cpp +++ b/engines/queen/sound.cpp @@ -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 @@ Sound::Sound(Audio::Mixer *mixer, QueenEngine *vm) :  #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 @@ void Sound::playSound(const char *base, bool isSpeech) {  	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 @@ void Sound::loadState(uint32 ver, byte *&ptr) {  	_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 @@ void SBSound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *so  	}  } -#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 diff --git a/engines/queen/sound.h b/engines/queen/sound.h index 5c19410036..38dadd7ece 100644 --- a/engines/queen/sound.h +++ b/engines/queen/sound.h @@ -62,7 +62,12 @@ class Sound {  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 @@ protected:  #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 | 
