diff options
| author | Max Horn | 2005-05-11 00:01:44 +0000 | 
|---|---|---|
| committer | Max Horn | 2005-05-11 00:01:44 +0000 | 
| commit | 2de46dc8eb173ca06a107d5353f2209944284115 (patch) | |
| tree | 2119f03a2883659d2b5fbbc70db31273271370e0 | |
| parent | 1a615346abab8f234c3dbd1c55e78b179bca9d87 (diff) | |
| download | scummvm-rg350-2de46dc8eb173ca06a107d5353f2209944284115.tar.gz scummvm-rg350-2de46dc8eb173ca06a107d5353f2209944284115.tar.bz2 scummvm-rg350-2de46dc8eb173ca06a107d5353f2209944284115.zip | |
Moved some more stuff to namespace Audio (enough for tonight)
svn-id: r18040
37 files changed, 91 insertions, 81 deletions
| diff --git a/gob/sound.cpp b/gob/sound.cpp index 018fc48ab2..169f4be382 100644 --- a/gob/sound.cpp +++ b/gob/sound.cpp @@ -85,7 +85,7 @@ int SquareWaveStream::readBuffer(int16 *buffer, const int numSamples) {  }  SquareWaveStream speakerStream; -SoundHandle speakerHandle; +Audio::SoundHandle speakerHandle;  Snd_SoundDesc *snd_loopingSounds[5]; // Should be enough  void snd_initSound(void) { diff --git a/gob/sound.h b/gob/sound.h index cc913795da..8ff39b2d2f 100644 --- a/gob/sound.h +++ b/gob/sound.h @@ -44,7 +44,7 @@ extern CleanupFuncPtr snd_cleanupFunc;  void snd_writeAdlib(int16 port, int16 data);  typedef struct Snd_SoundDesc { -	SoundHandle handle; +	Audio::SoundHandle handle;  	char *data;  	int32 size;  	int16 repCount; diff --git a/graphics/animation.h b/graphics/animation.h index 7a437c08ae..30957cb90e 100644 --- a/graphics/animation.h +++ b/graphics/animation.h @@ -88,7 +88,7 @@ protected:  	Common::File *_mpegFile; -	SoundHandle _bgSound; +	Audio::SoundHandle _bgSound;  	AudioStream *_bgSoundStream;  #ifdef BACKEND_8BIT diff --git a/queen/sound.h b/queen/sound.h index 34e860a567..338425696b 100644 --- a/queen/sound.h +++ b/queen/sound.h @@ -112,8 +112,8 @@ protected:  	bool _speechSfxExists;  	int16 _lastOverride; -	SoundHandle _sfxHandle; -	SoundHandle _speechHandle; +	Audio::SoundHandle _sfxHandle; +	Audio::SoundHandle _speechHandle;  };  class SilentSound : public Sound { diff --git a/saga/music.h b/saga/music.h index 9fcd66558d..9d9701397f 100644 --- a/saga/music.h +++ b/saga/music.h @@ -125,7 +125,7 @@ private:  	Audio::Mixer *_mixer;  	MusicPlayer *_player; -	SoundHandle _musicHandle; +	Audio::SoundHandle _musicHandle;  	uint32 _trackNumber;  	static const MUSIC_MIDITABLE _midiTableITECD[26]; diff --git a/saga/sound.cpp b/saga/sound.cpp index ae1a14cf04..4bff16e762 100644 --- a/saga/sound.cpp +++ b/saga/sound.cpp @@ -46,7 +46,7 @@ Sound::~Sound() {  	_soundInitialized = 0;  } -int Sound::playSoundBuffer(SoundHandle *handle, SOUNDBUFFER *buf, int volume, bool loop) { +int Sound::playSoundBuffer(Audio::SoundHandle *handle, SOUNDBUFFER *buf, int volume, bool loop) {  	byte flags;  	if (!_soundInitialized) { diff --git a/saga/sound.h b/saga/sound.h index 4bf126edcf..a22dd79b3e 100644 --- a/saga/sound.h +++ b/saga/sound.h @@ -64,7 +64,7 @@ public:   private: -	int playSoundBuffer(SoundHandle *handle, SOUNDBUFFER *buf, int volume, bool loop); +	int playSoundBuffer(Audio::SoundHandle *handle, SOUNDBUFFER *buf, int volume, bool loop);  	int _soundInitialized;  	int _enabled; @@ -73,8 +73,8 @@ public:  	Audio::Mixer *_mixer;  	Common::MemoryReadStream *_voxStream; -	SoundHandle _effectHandle; -	SoundHandle _voiceHandle; +	Audio::SoundHandle _effectHandle; +	Audio::SoundHandle _voiceHandle;  }; diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index 0911445b6e..b03600e41a 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -77,7 +77,7 @@ private:  		int32 mixerFlags;  		ImuseDigiSndMgr::soundStruct *soundHandle; -		SoundHandle handle; +		Audio::SoundHandle handle;  		AppendableAudioStream *stream;  		AudioStream *stream2; diff --git a/scumm/player_mod.cpp b/scumm/player_mod.cpp index 1649d98c3c..80d747ff62 100644 --- a/scumm/player_mod.cpp +++ b/scumm/player_mod.cpp @@ -92,7 +92,7 @@ void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol,  	_channels[i].pan = pan;  	_channels[i].freq = rate;  	_channels[i].input = makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | (loopStart != loopEnd ? Audio::Mixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart); -	_channels[i].converter = makeRateConverter(rate, _mixer->getOutputRate(), false, false); +	_channels[i].converter = Audio::makeRateConverter(rate, _mixer->getOutputRate(), false, false);  }  void Player_MOD::stopChannel(int id) { @@ -139,7 +139,7 @@ void Player_MOD::setChannelFreq(int id, int freq) {  		if (_channels[i].id == id) {  			_channels[i].freq = freq;  			delete _channels[i].converter; -			_channels[i].converter = makeRateConverter(freq, _mixer->getOutputRate(), false, false); +			_channels[i].converter = Audio::makeRateConverter(freq, _mixer->getOutputRate(), false, false);  			break;  		}  	} @@ -169,8 +169,8 @@ void Player_MOD::do_mix(int16 *data, uint len) {  		}  		for (i = 0; i < MOD_MAXCHANS; i++)  			if (_channels[i].id) { -				st_volume_t vol_l = (127 - _channels[i].pan) * _channels[i].vol / 127; -				st_volume_t vol_r = (127 + _channels[i].pan) * _channels[i].vol / 127; +				Audio::st_volume_t vol_l = (127 - _channels[i].pan) * _channels[i].vol / 127; +				Audio::st_volume_t vol_r = (127 + _channels[i].pan) * _channels[i].vol / 127;  				_channels[i].converter->flow(*_channels[i].input, &data[dpos*2], dlen, vol_l, vol_r);  			}  		dpos += dlen; diff --git a/scumm/player_mod.h b/scumm/player_mod.h index e211aa1cf4..883b43b2d7 100644 --- a/scumm/player_mod.h +++ b/scumm/player_mod.h @@ -26,7 +26,9 @@  #include "scumm/scumm.h"  #include "sound/audiostream.h" -class RateConverter; +namespace Audio { +	class RateConverter; +}  namespace Scumm { @@ -69,7 +71,7 @@ private:  		uint8 vol;  		int8 pan;  		uint16 freq; -		RateConverter *converter; +		Audio::RateConverter *converter;  		AudioStream *input;  	}; diff --git a/scumm/smush/smush_mixer.h b/scumm/smush/smush_mixer.h index 0f6417f721..cff529b5c6 100644 --- a/scumm/smush/smush_mixer.h +++ b/scumm/smush/smush_mixer.h @@ -39,7 +39,7 @@ private:  	struct channels {  		int id;  		SmushChannel *chan; -		SoundHandle handle; +		Audio::SoundHandle handle;  		AppendableAudioStream *stream;  	} _channels[NUM_CHANNELS]; diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index dc57258dbf..7b6b4ded18 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -56,10 +56,10 @@ private:  	bool _skips[37];  	int32 _frame; -	SoundHandle _IACTchannel; +	Audio::SoundHandle _IACTchannel;  	AppendableAudioStream *_IACTstream; -	SoundHandle _compressedFileSoundHandle; +	Audio::SoundHandle _compressedFileSoundHandle;  	bool _compressedFileMode;  	Common::File _compressedFile;  	byte _IACToutput[4096]; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index f0380b5bd6..1c94cbe2ce 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -668,7 +668,7 @@ void Sound::startHETalkSound(uint32 offset) {  	addSoundToQueue2(1, 0, channel, 0);  } -void Sound::startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handle) { +void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle *handle) {  	int num = 0, i;  	int size = 0;  	int id = -1; diff --git a/scumm/sound.h b/scumm/sound.h index a792629e99..c07e9ee990 100644 --- a/scumm/sound.h +++ b/scumm/sound.h @@ -95,8 +95,8 @@ protected:  	int16 _heMusicTracks;  public: -	SoundHandle _talkChannelHandle;	// Handle of mixer channel actor is talking on -	SoundHandle _heSoundChannels[8]; +	Audio::SoundHandle _talkChannelHandle;	// Handle of mixer channel actor is talking on +	Audio::SoundHandle _heSoundChannels[8];  	bool _soundsPaused;  	byte _sfxMode; @@ -110,7 +110,7 @@ public:  	void setOverrideFreq(int freq);  	void playSound(int soundID, int heOffset, int heChannel, int heFlags);  	void startHETalkSound(uint32 offset); -	void startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handle = NULL); +	void startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle *handle = NULL);  	void stopTalkSound();  	bool isMouthSyncOff(uint pos);  	int getSoundElapsedTime(int sound) const; diff --git a/simon/sound.cpp b/simon/sound.cpp index d34371874d..9e302e34d5 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -47,25 +47,25 @@ public:  	BaseSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false);  	BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets, bool bigendian = false);  	virtual ~BaseSound(); -	virtual void playSound(uint sound, SoundHandle *handle, byte flags) = 0; +	virtual void playSound(uint sound, Audio::SoundHandle *handle, byte flags) = 0;  };  class WavSound : public BaseSound {  public:  	WavSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};  	WavSound(Audio::Mixer *mixer, File *file, uint32 *offsets) : BaseSound(mixer, file, offsets) {}; -	void playSound(uint sound, SoundHandle *handle, byte flags); +	void playSound(uint sound, Audio::SoundHandle *handle, byte flags);  };  class VocSound : public BaseSound {  public:  	VocSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {}; -	void playSound(uint sound, SoundHandle *handle, byte flags); +	void playSound(uint sound, Audio::SoundHandle *handle, byte flags);  };  class RawSound : public BaseSound {  public:  	RawSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {}; -	void playSound(uint sound, SoundHandle *handle, byte flags); +	void playSound(uint sound, Audio::SoundHandle *handle, byte flags);  };  BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 base, bool bigendian) { @@ -119,7 +119,7 @@ BaseSound::~BaseSound() {  	delete _file;  } -void WavSound::playSound(uint sound, SoundHandle *handle, byte flags) { +void WavSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {  	if (_offsets == NULL)  		return; @@ -134,7 +134,7 @@ void WavSound::playSound(uint sound, SoundHandle *handle, byte flags) {  	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream);  } -void VocSound::playSound(uint sound, SoundHandle *handle, byte flags) { +void VocSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {  	if (_offsets == NULL)  		return; @@ -146,7 +146,7 @@ void VocSound::playSound(uint sound, SoundHandle *handle, byte flags) {  	_mixer->playRaw(handle, buffer, size, samples_per_sec, flags | Audio::Mixer::FLAG_AUTOFREE);  } -void RawSound::playSound(uint sound, SoundHandle *handle, byte flags) { +void RawSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {  	if (_offsets == NULL)  		return; @@ -163,10 +163,10 @@ void RawSound::playSound(uint sound, SoundHandle *handle, byte flags) {  class MP3Sound : public BaseSound {  public:  	MP3Sound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {}; -	void playSound(uint sound, SoundHandle *handle, byte flags); +	void playSound(uint sound, Audio::SoundHandle *handle, byte flags);  }; -void MP3Sound::playSound(uint sound, SoundHandle *handle, byte flags) +void MP3Sound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)  {  	if (_offsets == NULL)  		return; @@ -187,10 +187,10 @@ void MP3Sound::playSound(uint sound, SoundHandle *handle, byte flags)  class VorbisSound : public BaseSound {  public:  	VorbisSound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {}; -	void playSound(uint sound, SoundHandle *handle, byte flags); +	void playSound(uint sound, Audio::SoundHandle *handle, byte flags);  }; -void VorbisSound::playSound(uint sound, SoundHandle *handle, byte flags) +void VorbisSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)  {  	if (_offsets == NULL)  		return; @@ -211,10 +211,10 @@ void VorbisSound::playSound(uint sound, SoundHandle *handle, byte flags)  class FlacSound : public BaseSound {  public:  	FlacSound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {}; -	void playSound(uint sound, SoundHandle *handle, byte flags); +	void playSound(uint sound, Audio::SoundHandle *handle, byte flags);  }; -void FlacSound::playSound(uint sound, SoundHandle *handle, byte flags) +void FlacSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)  {  	if (_offsets == NULL)  		return; diff --git a/simon/sound.h b/simon/sound.h index 75efe46cb5..641d90d2d0 100644 --- a/simon/sound.h +++ b/simon/sound.h @@ -44,9 +44,9 @@ private:  	uint32 *_offsets;  	uint16 _lastVoiceFile; -	SoundHandle _voiceHandle; -	SoundHandle _effectsHandle; -	SoundHandle _ambientHandle; +	Audio::SoundHandle _voiceHandle; +	Audio::SoundHandle _effectsHandle; +	Audio::SoundHandle _ambientHandle;  	bool _hasEffectsFile;  	bool _hasVoiceFile; diff --git a/sky/intro.h b/sky/intro.h index e7840fa120..1fbf2a4bb0 100644 --- a/sky/intro.h +++ b/sky/intro.h @@ -56,7 +56,7 @@ private:  	uint8 *_textBuf, *_saveBuf;  	uint8 *_bgBuf;  	uint32 _bgSize; -	SoundHandle _voice, _bgSfx; +	Audio::SoundHandle _voice, _bgSfx;  	int32 _relDelay; diff --git a/sky/sound.cpp b/sky/sound.cpp index c65579d950..a9a1708846 100644 --- a/sky/sound.cpp +++ b/sky/sound.cpp @@ -1031,7 +1031,7 @@ Sound::~Sound(void) {  	if (_soundData) free(_soundData);  } -void Sound::playSound(uint32 id, byte *sound, uint32 size, SoundHandle *handle) { +void Sound::playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *handle) {  	byte flags = 0;  	flags |= Audio::Mixer::FLAG_UNSIGNED|Audio::Mixer::FLAG_AUTOFREE; diff --git a/sky/sound.h b/sky/sound.h index 2f9d68c3a9..1305369190 100644 --- a/sky/sound.h +++ b/sky/sound.h @@ -50,16 +50,16 @@ protected:  public:  	Audio::Mixer *_mixer; -	SoundHandle _voiceHandle; -	SoundHandle _effectHandle; -	SoundHandle _bgSoundHandle; -	SoundHandle _ingameSound0, _ingameSound1, _ingameSpeech; +	Audio::SoundHandle _voiceHandle; +	Audio::SoundHandle _effectHandle; +	Audio::SoundHandle _bgSoundHandle; +	Audio::SoundHandle _ingameSound0, _ingameSound1, _ingameSpeech;  	uint16 _saveSounds[2];  protected: -	void playSound(uint32 id, byte *sound, uint32 size, SoundHandle *handle); +	void playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *handle);  public:  	Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume); diff --git a/sound/audiocd.h b/sound/audiocd.h index 9a2ffc4810..33d5848c6b 100644 --- a/sound/audiocd.h +++ b/sound/audiocd.h @@ -30,7 +30,7 @@  class DigitalTrackInfo {  public:  	virtual bool error() = 0; -	virtual void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) = 0; +	virtual void play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration) = 0;  	virtual ~DigitalTrackInfo() { }  }; @@ -62,7 +62,7 @@ private:  private:  	/* used for emulated CD music */  	struct ExtStatus : Status { -		SoundHandle handle; +		Audio::SoundHandle handle;  	};  	ExtStatus _cd; diff --git a/sound/flac.cpp b/sound/flac.cpp index d0d6403252..c5840476ed 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -750,7 +750,7 @@ public:  	FlacTrackInfo(File *file);  	~FlacTrackInfo();  	bool error() { return _file == NULL; } -	void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration); +	void play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration);  };  FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL) @@ -764,7 +764,7 @@ FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL)  		delete tempStream;  } -void FlacTrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) { +void FlacTrackInfo::play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration) {  	if (error()) {  		debug(1, "FlacTrackInfo::play:  invalid state, method should not been called");  	} diff --git a/sound/mixer.h b/sound/mixer.h index 0293f3c394..c062437a0c 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -29,12 +29,14 @@  class AudioStream; -namespace Audio { -	class Channel; -	class Mixer; -}  class OSystem; + +namespace Audio { + +class Channel; +class Mixer; +  class SoundHandle {  	friend class Audio::Channel;  	friend class Audio::Mixer; @@ -43,8 +45,6 @@ public:  	inline SoundHandle() : _val(0xFFFFFFFF) {}  }; -namespace Audio { -  class Mixer {  public:  	enum { diff --git a/sound/mp3.cpp b/sound/mp3.cpp index 8638e3265f..0bc670bed3 100644 --- a/sound/mp3.cpp +++ b/sound/mp3.cpp @@ -288,7 +288,7 @@ public:  	MP3TrackInfo(File *file);  	~MP3TrackInfo();  	bool error() { return _error_flag; } -	void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration); +	void play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration);  }; @@ -363,7 +363,7 @@ error:  	delete file;  } -void MP3TrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) { +void MP3TrackInfo::play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration) {  	unsigned int offset;  	mad_timer_t durationTime; diff --git a/sound/rate.cpp b/sound/rate.cpp index 94db083225..4ab935331c 100644 --- a/sound/rate.cpp +++ b/sound/rate.cpp @@ -33,6 +33,8 @@  #include "sound/mixer.h"  #include "common/util.h" +namespace Audio { +  /**   * The precision of the fractional computations used by the rate converter.   * Normally you should never have to modify this value. @@ -277,3 +279,5 @@ RateConverter *makeRateConverter(st_rate_t inrate, st_rate_t outrate, bool stere  			return new CopyRateConverter<false, false>();  	}  } + +} // End of namespace Audio diff --git a/sound/rate.h b/sound/rate.h index 4797cc61b5..2a4d02b676 100644 --- a/sound/rate.h +++ b/sound/rate.h @@ -25,9 +25,11 @@  #include "common/scummsys.h"  #include "base/engine.h" -//#include "sound/audiostream.h"  class AudioStream; + +namespace Audio { +  typedef int16 st_sample_t;  typedef uint16 st_volume_t;  typedef uint32 st_size_t; @@ -76,4 +78,6 @@ public:  RateConverter *makeRateConverter(st_rate_t inrate, st_rate_t outrate, bool stereo, bool reverseStereo = false); +} // End of namespace Audio +  #endif diff --git a/sound/softsynth/fluidsynth.cpp b/sound/softsynth/fluidsynth.cpp index ba45d527ce..13f680e3fd 100644 --- a/sound/softsynth/fluidsynth.cpp +++ b/sound/softsynth/fluidsynth.cpp @@ -38,7 +38,7 @@ private:  	fluid_synth_t *_synth;  	int _soundFont;  	int _outputRate; -	SoundHandle _handle; +	Audio::SoundHandle _handle;  protected:  	// Because GCC complains about casting from const to non-const... diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp index a64bbe3251..c79abd28ba 100644 --- a/sound/softsynth/mt32.cpp +++ b/sound/softsynth/mt32.cpp @@ -43,7 +43,7 @@ class MidiChannel_MT32 : public MidiChannel_MPU401 {  class MidiDriver_MT32 : public MidiDriver_Emulated {  private: -	SoundHandle _handle; +	Audio::SoundHandle _handle;  	MidiChannel_MT32 _midiChannels[16];  	uint16 _channelMask;  	MT32Emu::Synth *_synth; diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index a92867b660..5d510173d1 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -52,7 +52,7 @@ public:  	~VorbisTrackInfo();  	bool openTrack();  	bool error() { return _error_flag; } -	void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration); +	void play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration);  }; @@ -168,7 +168,7 @@ VorbisTrackInfo::~VorbisTrackInfo() {  #define VORBIS_TREMOR  #endif -void VorbisTrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) { +void VorbisTrackInfo::play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int startFrame, int duration) {  	bool err = openTrack();  	assert(!err); diff --git a/sword1/credits.cpp b/sword1/credits.cpp index d207c7b4db..55587406b1 100644 --- a/sword1/credits.cpp +++ b/sword1/credits.cpp @@ -112,7 +112,7 @@ void CreditsPlayer::play(void) {  	_system->updateScreen();  	// everything's initialized, time to render and show the credits. -	SoundHandle bgSound; +	Audio::SoundHandle bgSound;  	_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &bgSound, bgSoundStream, 0);  	int relDelay = 0; diff --git a/sword1/music.cpp b/sword1/music.cpp index f0b70f5731..02eb47714c 100644 --- a/sword1/music.cpp +++ b/sword1/music.cpp @@ -275,8 +275,8 @@ void Music::mixer(int16 *buf, uint32 len) {  }  void Music::setVolume(uint8 volL, uint8 volR) { -	_volumeL = (st_volume_t)volL; -	_volumeR = (st_volume_t)volR; +	_volumeL = (Audio::st_volume_t)volL; +	_volumeR = (Audio::st_volume_t)volR;  }  void Music::giveVolume(uint8 *volL, uint8 *volR) { @@ -327,7 +327,7 @@ void Music::startMusic(int32 tuneId, int32 loopFlag) {  		   As the corresponding _converter is NULL, the handle will be ignored by the playing thread */  		if (_handles[newStream].play(_tuneList[tuneId], loopFlag != 0)) {  			_mutex.lock(); -			_converter[newStream] = makeRateConverter(_handles[newStream].getRate(), _mixer->getOutputRate(), _handles[newStream].isStereo(), false); +			_converter[newStream] = Audio::makeRateConverter(_handles[newStream].getRate(), _mixer->getOutputRate(), _handles[newStream].isStereo(), false);  			_mutex.unlock();  		}  	} else { diff --git a/sword1/music.h b/sword1/music.h index 5628cbce40..d3dd46ccd1 100644 --- a/sword1/music.h +++ b/sword1/music.h @@ -103,9 +103,9 @@ public:  	int getRate() const { return _sampleRate; }  private: -	st_volume_t _volumeL, _volumeR; +	Audio::st_volume_t _volumeL, _volumeR;  	MusicHandle _handles[2]; -	RateConverter *_converter[2]; +	Audio::RateConverter *_converter[2];  	Audio::Mixer *_mixer;  	uint32 _sampleRate;  	Common::Mutex _mutex; diff --git a/sword1/sound.h b/sword1/sound.h index 5b2469aa81..bca1b2c64a 100644 --- a/sword1/sound.h +++ b/sword1/sound.h @@ -44,7 +44,7 @@ namespace Sword1 {  struct QueueElement {  	uint32 id, delay; -	SoundHandle handle; +	Audio::SoundHandle handle;  };  struct RoomVol { @@ -103,7 +103,7 @@ private:  	uint32		 _cowHeaderSize;  	uint8		 _currentCowFile;  	CowMode		 _cowMode; -	SoundHandle _speechHandle, _fxHandle; +	Audio::SoundHandle _speechHandle, _fxHandle;  	Common::RandomSource _rnd;  	QueueElement _fxQueue[MAX_FXQ_LENGTH]; diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp index d70397eb4e..8e3e8958b6 100644 --- a/sword2/driver/animation.cpp +++ b/sword2/driver/animation.cpp @@ -168,7 +168,7 @@ void MoviePlayer::drawTextObject(AnimationState *anim, MovieTextObject *obj) {   */  int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], int32 leadInRes, int32 leadOutRes) { -	SoundHandle leadInHandle; +	Audio::SoundHandle leadInHandle;  	// This happens if the user quits during the "eye" smacker  	if (_vm->_quit) @@ -246,7 +246,7 @@ int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], int32 lea  void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *leadOut, uint32 leadOutLen) {  	uint frameCounter = 0, textCounter = 0; -	SoundHandle handle; +	Audio::SoundHandle handle;  	bool skipCutscene = false, textVisible = false;  	uint32 flags = Audio::Mixer::FLAG_16BITS;  	bool startNextText = false; @@ -452,7 +452,7 @@ void MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], byte  	tmpPal[255 * 4 + 2] = 255;  	_vm->_screen->setPalette(0, 256, tmpPal, RDPAL_INSTANT); -	SoundHandle handle; +	Audio::SoundHandle handle;  	bool skipCutscene = false; diff --git a/sword2/driver/animation.h b/sword2/driver/animation.h index b2d0332281..5958d03692 100644 --- a/sword2/driver/animation.h +++ b/sword2/driver/animation.h @@ -78,7 +78,7 @@ private:  	byte *_textSurface; -	SoundHandle _leadOutHandle; +	Audio::SoundHandle _leadOutHandle;  	uint _leadOutFrame;  	bool _seamless; diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index fd8e7e8671..33699972ef 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -441,7 +441,7 @@ int Sound::readBuffer(int16 *buffer, const int numSamples) {  		if (!_musicMuted) {  			for (int j = 0; j < len; j++) { -				clampedAdd(buffer[j], _mixBuffer[j]); +				Audio::clampedAdd(buffer[j], _mixBuffer[j]);  			}  		}  	} diff --git a/sword2/sound.cpp b/sword2/sound.cpp index 67ac46388d..3723784142 100644 --- a/sword2/sound.cpp +++ b/sword2/sound.cpp @@ -250,7 +250,7 @@ int32 Sound::playFx(FxQueueEntry *fx) {  	return playFx(&fx->handle, fx->data, fx->len, fx->volume, fx->pan, (fx->type == FX_LOOP), Audio::Mixer::kSFXSoundType);  } -int32 Sound::playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, Audio::Mixer::SoundType soundType) { +int32 Sound::playFx(Audio::SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, Audio::Mixer::SoundType soundType) {  	if (_fxMuted)  		return RD_OK; diff --git a/sword2/sound.h b/sword2/sound.h index f717aab33d..9ef3844044 100644 --- a/sword2/sound.h +++ b/sword2/sound.h @@ -172,7 +172,7 @@ private:  	Common::Mutex _mutex;  	struct FxQueueEntry { -		SoundHandle handle;	// sound handle +		Audio::SoundHandle handle;	// sound handle  		uint32 resource;		// resource id of sample  		byte *data;			// pointer to WAV data  		uint32 len;			// WAV data length @@ -198,7 +198,7 @@ private:  	int32 _loopingMusicId; -	SoundHandle _soundHandleSpeech; +	Audio::SoundHandle _soundHandleSpeech;  	MusicInputStream *_music[MAXMUS];  	//Common::File _musicFile[MAXMUS]; @@ -253,7 +253,7 @@ public:  	void queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan);  	int32 playFx(FxQueueEntry *fx); -	int32 playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, Audio::Mixer::SoundType soundType); +	int32 playFx(Audio::SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, Audio::Mixer::SoundType soundType);  	int32 stopFx(int32 i);  	int32 setFxIdVolumePan(int32 id, int vol, int pan = 255); | 
