From 086f5961b6575c50bb386750b6e9a3ed1efdd8cd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 2 Sep 2010 12:14:04 +0000 Subject: SWORD25: unsigned int -> uint svn-id: r53309 --- engines/sword25/sfx/fmodexchannel.cpp | 20 +++--- engines/sword25/sfx/fmodexchannel.h | 12 ++-- engines/sword25/sfx/fmodexresource.cpp | 4 +- engines/sword25/sfx/fmodexresource.h | 2 +- engines/sword25/sfx/fmodexsound.cpp | 100 ++++++++++++++--------------- engines/sword25/sfx/fmodexsound.h | 58 ++++++++--------- engines/sword25/sfx/soundengine.h | 34 +++++----- engines/sword25/sfx/soundengine_script.cpp | 36 +++++------ 8 files changed, 133 insertions(+), 133 deletions(-) (limited to 'engines/sword25/sfx') diff --git a/engines/sword25/sfx/fmodexchannel.cpp b/engines/sword25/sfx/fmodexchannel.cpp index e8992e92a6..5214dd7b51 100644 --- a/engines/sword25/sfx/fmodexchannel.cpp +++ b/engines/sword25/sfx/fmodexchannel.cpp @@ -133,7 +133,7 @@ bool BS_FMODExChannel::SetLoop(bool Loop) { // ----------------------------------------------------------------------------- -bool BS_FMODExChannel::SetLoopPoints(unsigned int LoopStart, unsigned int LoopEnd) { +bool BS_FMODExChannel::SetLoopPoints(uint LoopStart, uint LoopEnd) { BS_ASSERT(m_ChannelPtr); FMOD_RESULT Result = FMOD_Channel_SetLoopPoints(m_ChannelPtr, LoopStart, FMOD_TIMEUNIT_PCM, LoopEnd, FMOD_TIMEUNIT_PCM); @@ -146,7 +146,7 @@ bool BS_FMODExChannel::SetLoopPoints(unsigned int LoopStart, unsigned int LoopEn // ----------------------------------------------------------------------------- -bool BS_FMODExChannel::SetPosition(unsigned int Position) { +bool BS_FMODExChannel::SetPosition(uint Position) { BS_ASSERT(m_ChannelPtr); FMOD_RESULT Result = FMOD_Channel_SetPosition(m_ChannelPtr, Position, FMOD_TIMEUNIT_PCM); @@ -198,10 +198,10 @@ float BS_FMODExChannel::GetPanning() { // ----------------------------------------------------------------------------- -unsigned int BS_FMODExChannel::GetPosition() { +uint BS_FMODExChannel::GetPosition() { BS_ASSERT(m_ChannelPtr); - unsigned int Position = 0; + uint Position = 0; FMOD_RESULT Result = FMOD_Channel_GetPosition(m_ChannelPtr, &Position, FMOD_TIMEUNIT_PCM); if (IsImportantError(Result)) BS_FMODExException("FMOD_Channel_GetPosition()", Result).Log(); @@ -210,10 +210,10 @@ unsigned int BS_FMODExChannel::GetPosition() { // ----------------------------------------------------------------------------- -unsigned int BS_FMODExChannel::GetTime() { +uint BS_FMODExChannel::GetTime() { BS_ASSERT(m_ChannelPtr); - unsigned int Time = 0; + uint Time = 0; FMOD_RESULT Result = FMOD_Channel_GetPosition(m_ChannelPtr, &Time, FMOD_TIMEUNIT_MS); if (IsImportantError(Result)) BS_FMODExException("FMOD_Channel_GetPosition()", Result).Log(); @@ -222,9 +222,9 @@ unsigned int BS_FMODExChannel::GetTime() { // ----------------------------------------------------------------------------- -unsigned int BS_FMODExChannel::GetLoopStart() { +uint BS_FMODExChannel::GetLoopStart() { BS_ASSERT(m_ChannelPtr); - unsigned int LoopStart = 0; + uint LoopStart = 0; FMOD_RESULT Result = FMOD_Channel_GetLoopPoints(m_ChannelPtr, &LoopStart, FMOD_TIMEUNIT_PCM, 0, FMOD_TIMEUNIT_PCM); if (IsImportantError(Result)) BS_FMODExException("FMOD_Channel_GetLoopPoints()", Result).Log(); @@ -233,9 +233,9 @@ unsigned int BS_FMODExChannel::GetLoopStart() { // ----------------------------------------------------------------------------- -unsigned int BS_FMODExChannel::GetLoopEnd() { +uint BS_FMODExChannel::GetLoopEnd() { BS_ASSERT(m_ChannelPtr); - unsigned int LoopEnd = 0; + uint LoopEnd = 0; FMOD_RESULT Result = FMOD_Channel_GetLoopPoints(m_ChannelPtr, 0, FMOD_TIMEUNIT_PCM, &LoopEnd, FMOD_TIMEUNIT_PCM); if (IsImportantError(Result)) BS_FMODExException("FMOD_Channel_GetLoopPoints()", Result).Log(); diff --git a/engines/sword25/sfx/fmodexchannel.h b/engines/sword25/sfx/fmodexchannel.h index 9d8b64f3b4..bada197eb0 100644 --- a/engines/sword25/sfx/fmodexchannel.h +++ b/engines/sword25/sfx/fmodexchannel.h @@ -61,16 +61,16 @@ public: bool SetVolume(float Volume); bool SetPanning(float Panning); bool SetLoop(bool Loop); - bool SetLoopPoints(unsigned int LoopStart, unsigned int LoopEnd); - bool SetPosition(unsigned int Position); + bool SetLoopPoints(uint LoopStart, uint LoopEnd); + bool SetPosition(uint Position); bool Stop(); float GetVolume(); float GetPanning(); - unsigned int GetPosition(); - unsigned int GetTime(); - unsigned int GetLoopStart(); - unsigned int GetLoopEnd(); + uint GetPosition(); + uint GetTime(); + uint GetLoopStart(); + uint GetLoopEnd(); bool IsLooping(); bool IsPaused(); bool IsPlaying(); diff --git a/engines/sword25/sfx/fmodexresource.cpp b/engines/sword25/sfx/fmodexresource.cpp index 2a987695bd..d4bdbb2887 100644 --- a/engines/sword25/sfx/fmodexresource.cpp +++ b/engines/sword25/sfx/fmodexresource.cpp @@ -53,7 +53,7 @@ // ----------------------------------------------------------------------------- namespace { -const unsigned int MAX_SAMPLE_SIZE = 100 * 1024; // Die Dateigröße in Byte ab der ein Sound als Stream abgespielt wird +const uint MAX_SAMPLE_SIZE = 100 * 1024; // Die Dateigröße in Byte ab der ein Sound als Stream abgespielt wird } // ----------------------------------------------------------------------------- @@ -78,7 +78,7 @@ BS_FMODExResource::BS_FMODExResource(const std::string &FileName, FMOD_SYSTEM *F } // Datei laden - unsigned int FileSize; + uint FileSize; char *FileDataPtr = (char *) PackagePtr->GetFile(GetFileName(), &FileSize); if (!FileDataPtr) { BS_LOG_ERRORLN("File \"%s\" could not be loaded.", GetFileName().c_str()); diff --git a/engines/sword25/sfx/fmodexresource.h b/engines/sword25/sfx/fmodexresource.h index b8a6a07e1f..f74fef5365 100644 --- a/engines/sword25/sfx/fmodexresource.h +++ b/engines/sword25/sfx/fmodexresource.h @@ -64,7 +64,7 @@ public: private: FMOD_SOUND *m_SoundPtr; char *m_SoundDataPtr; - unsigned int m_SoundDataSize; + uint m_SoundDataSize; }; #endif diff --git a/engines/sword25/sfx/fmodexsound.cpp b/engines/sword25/sfx/fmodexsound.cpp index e71711577c..fb529a7621 100644 --- a/engines/sword25/sfx/fmodexsound.cpp +++ b/engines/sword25/sfx/fmodexsound.cpp @@ -59,8 +59,8 @@ namespace Sword25 { const float DEFAULT_MUSIC_VOLUME = 1.0f; const float DEFAULT_SPEECH_VOLUME = 1.0f; const float DEFAULT_SFX_VOLUME = 1.0f; -const unsigned int SOUNDTYPE_COUNT = 3; -const unsigned int INVALID_SOUND_HANDLE = 0xffffffff; +const uint SOUNDTYPE_COUNT = 3; +const uint INVALID_SOUND_HANDLE = 0xffffffff; // ------------------------------------------------------------------------- @@ -103,7 +103,7 @@ inline float NormalizeVolume(float Volume) { // ------------------------------------------------------------------------- -inline FMOD_SOUND_FORMAT BitsPerSampleToFMODExSoundFormat(unsigned int BitsPerSample) { +inline FMOD_SOUND_FORMAT BitsPerSampleToFMODExSoundFormat(uint BitsPerSample) { switch (BitsPerSample) { case 8: return FMOD_SOUND_FORMAT_PCM8; @@ -155,7 +155,7 @@ Service *FMODExSound_CreateObject(Kernel *pKernel) { // ----------------------------------------------------------------------------- -bool FMODExSound::Init(unsigned int SampleRate, unsigned int Channels) { +bool FMODExSound::Init(uint SampleRate, uint Channels) { #if 0 // Eine Warnung ausgeben, wenn dieser Service schon initialisiert wurde. // Allerdings wird trotzdem true zurückgegeben, weil kein Fehler aufgetreten ist, der Service ist noch benutzbar. @@ -218,7 +218,7 @@ bool FMODExSound::PlaySound(const Common::String &FileName, float Pan, bool Loop, int LoopStart, int LoopEnd, - unsigned int Layer) { + uint Layer) { #if 0 return PlaySoundInternal(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer, 0, 0) != 0; #else @@ -228,13 +228,13 @@ bool FMODExSound::PlaySound(const Common::String &FileName, // ----------------------------------------------------------------------------- -unsigned int FMODExSound::PlaySoundEx(const Common::String &FileName, +uint FMODExSound::PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, - unsigned int Layer) { + uint Layer) { #if 0 return PlaySoundInternal(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer, 0, 0); #else @@ -245,19 +245,19 @@ unsigned int FMODExSound::PlaySoundEx(const Common::String &FileName, // ------------------------------------------------------------------------- #if 0 -FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundSetPosCallback(FMOD_SOUND *sound, int subsound, unsigned int position, FMOD_TIMEUNIT postype) { +FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundSetPosCallback(FMOD_SOUND *sound, int subsound, uint position, FMOD_TIMEUNIT postype) { // In dynamischen Sounds wird nicht gesprungen, daher tut dieses Funktion nichts. return FMOD_OK; } // ------------------------------------------------------------------------- -FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundReadCallback(FMOD_SOUND *sound, void *data, unsigned int datalen) { +FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundReadCallback(FMOD_SOUND *sound, void *data, uint datalen) { // Handle auf das aktuelle Soundsystem holen, dies ist wohl dieses hier. BS_FMODExSound *t = reinterpret_cast(BS_Kernel::GetInstance()->GetSfx()); // Handle auf den richtigen Sound holen, wurde als FMOD Ex Benutzerdaten gesetzt. - unsigned int Handle; + uint Handle; FMOD_RESULT Result = FMOD_Sound_GetUserData(sound, reinterpret_cast(&Handle)); if (Result != FMOD_OK) { BS_FMODExException("FMOD_Sound_GetUserData()", Result).Log(); @@ -273,15 +273,15 @@ FMOD_RESULT F_CALLBACK BS_FMODExSound::FMODExDynamicSoundReadCallback(FMOD_SOUND #endif // ----------------------------------------------------------------------------- -unsigned int FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, +uint FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, - unsigned int SampleRate, - unsigned int BitsPerSample, - unsigned int Channels, + uint SampleRate, + uint BitsPerSample, + uint Channels, float Volume, float Pan, - unsigned int Layer) { + uint Layer) { #if 0 // Parameter überprüfen if (BitsPerSampleToFMODExSoundFormat(BitsPerSample) == FMOD_SOUND_FORMAT_NONE) { @@ -294,7 +294,7 @@ unsigned int FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallba } // Zu vergebendes Handle bestimmen - unsigned int Handle = m_NextHandle++; + uint Handle = m_NextHandle++; // Sound in die Sound-Map eintragen mit all den Informationen, die wir bisher haben. // Dies muss für dynamische Sounds so früh geschehen, da sofort nach dem Aufruf von FMOD_System_CreateSound der Callback aufgerufen wird um @@ -351,15 +351,15 @@ unsigned int FMODExSound::PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallba // ----------------------------------------------------------------------------- #if 0 -unsigned int BS_FMODExSound::PlaySoundInternal(const Common::String &FileName, +uint BS_FMODExSound::PlaySoundInternal(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, - unsigned int Layer, - unsigned int Position, - unsigned int Handle) { + uint Layer, + uint Position, + uint Handle) { BS_ASSERT(m_FMOD); BS_ASSERT(Type < SOUNDTYPE_COUNT); @@ -384,8 +384,8 @@ unsigned int BS_FMODExSound::PlaySoundInternal(const Common::String &FileName, if (Loop) { // Bestimmen, welche Loop-Points benutzt werden. Falls ein Loop-Point als Parameter nicht spezifiziert wurde (Wert -1), // wird der Loop-Point von FMOD Ex benutzt. - unsigned int RealLoopStart = (LoopStart > 0) ? LoopStart : ChannelPtr->GetLoopStart(); - unsigned int RealLoopEnd = (LoopEnd > 0) ? LoopEnd : ChannelPtr->GetLoopEnd(); + uint RealLoopStart = (LoopStart > 0) ? LoopStart : ChannelPtr->GetLoopStart(); + uint RealLoopEnd = (LoopEnd > 0) ? LoopEnd : ChannelPtr->GetLoopEnd(); // Loop-Points auf Gültigkeit überprüfen if (RealLoopStart > RealLoopEnd) { @@ -424,15 +424,15 @@ unsigned int BS_FMODExSound::PlaySoundInternal(const Common::String &FileName, return 0; } - unsigned int MyLoopStart = ChannelPtr->GetLoopStart(); - unsigned int MyLoopEnd = ChannelPtr->GetLoopEnd(); + uint MyLoopStart = ChannelPtr->GetLoopStart(); + uint MyLoopEnd = ChannelPtr->GetLoopEnd(); ChannelPtr->SetLoopPoints(MyLoopStart, MyLoopEnd); // Sound abspielen ChannelPtr->SetPaused(false); // Sound in die Sound-Map eintragen - unsigned int NewHandle = (Handle != 0) ? Handle : m_NextHandle++; + uint NewHandle = (Handle != 0) ? Handle : m_NextHandle++; m_PlayingSoundsMap[NewHandle] = PlayingSoundData(SoundResourcePtr, ChannelPtr, Type, Layer, Volume); return NewHandle; @@ -520,7 +520,7 @@ void FMODExSound::ResumeAll() { // ----------------------------------------------------------------------------- -void FMODExSound::PauseLayer(unsigned int Layer) { +void FMODExSound::PauseLayer(uint Layer) { #if 0 BS_ASSERT(m_FMOD); @@ -543,7 +543,7 @@ void FMODExSound::PauseLayer(unsigned int Layer) { // ----------------------------------------------------------------------------- -void FMODExSound::ResumeLayer(unsigned int Layer) { +void FMODExSound::ResumeLayer(uint Layer) { #if 0 BS_ASSERT(m_FMOD); @@ -567,7 +567,7 @@ void FMODExSound::ResumeLayer(unsigned int Layer) { // Sound Setter // ----------------------------------------------------------------------------- -void FMODExSound::SetSoundVolume(unsigned int Handle, float Volume) { +void FMODExSound::SetSoundVolume(uint Handle, float Volume) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -577,7 +577,7 @@ void FMODExSound::SetSoundVolume(unsigned int Handle, float Volume) { // ----------------------------------------------------------------------------- -void FMODExSound::SetSoundPanning(unsigned int Handle, float Pan) { +void FMODExSound::SetSoundPanning(uint Handle, float Pan) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -587,7 +587,7 @@ void FMODExSound::SetSoundPanning(unsigned int Handle, float Pan) { // ----------------------------------------------------------------------------- -void FMODExSound::PauseSound(unsigned int Handle) { +void FMODExSound::PauseSound(uint Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -600,7 +600,7 @@ void FMODExSound::PauseSound(unsigned int Handle) { // ----------------------------------------------------------------------------- -void FMODExSound::ResumeSound(unsigned int Handle) { +void FMODExSound::ResumeSound(uint Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -613,7 +613,7 @@ void FMODExSound::ResumeSound(unsigned int Handle) { // ----------------------------------------------------------------------------- -void FMODExSound::StopSound(unsigned int Handle) { +void FMODExSound::StopSound(uint Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -625,7 +625,7 @@ void FMODExSound::StopSound(unsigned int Handle) { // Sound Getter // ----------------------------------------------------------------------------- -bool FMODExSound::IsSoundPaused(unsigned int Handle) { +bool FMODExSound::IsSoundPaused(uint Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -636,7 +636,7 @@ bool FMODExSound::IsSoundPaused(unsigned int Handle) { // ----------------------------------------------------------------------------- -bool FMODExSound::IsSoundPlaying(unsigned int Handle) { +bool FMODExSound::IsSoundPlaying(uint Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -647,7 +647,7 @@ bool FMODExSound::IsSoundPlaying(unsigned int Handle) { // ----------------------------------------------------------------------------- -float FMODExSound::GetSoundVolume(unsigned int Handle) { +float FMODExSound::GetSoundVolume(uint Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -658,7 +658,7 @@ float FMODExSound::GetSoundVolume(unsigned int Handle) { // ----------------------------------------------------------------------------- -float FMODExSound::GetSoundPanning(unsigned int Handle) { +float FMODExSound::GetSoundPanning(uint Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -669,7 +669,7 @@ float FMODExSound::GetSoundPanning(unsigned int Handle) { // ----------------------------------------------------------------------------- -float FMODExSound::GetSoundTime(unsigned int Handle) { +float FMODExSound::GetSoundTime(uint Handle) { #if 0 BS_ASSERT(m_FMOD); PlayingSoundData *PSDPtr = GetPlayingSoundDataByHandle(Handle); @@ -705,7 +705,7 @@ void BS_FMODExSound::RemoveInactiveSounds() { // ----------------------------------------------------------------------------- -BS_FMODExSound::PlayingSoundData *BS_FMODExSound::GetPlayingSoundDataByHandle(unsigned int Handle) { +BS_FMODExSound::PlayingSoundData *BS_FMODExSound::GetPlayingSoundDataByHandle(uint Handle) { // Zum Soundhandle gehörige Daten in der Hash-Map finden PSM_ITER it = m_PlayingSoundsMap.find(Handle); // Falls die Daten nicht gefunden werden konnten, Fehler zurückgebene, ansonsten ein Pointer auf die Daten. @@ -715,8 +715,8 @@ BS_FMODExSound::PlayingSoundData *BS_FMODExSound::GetPlayingSoundDataByHandle(un // ----------------------------------------------------------------------------- -unsigned int BS_FMODExSound::CountPlayingDynamicSounds() { - unsigned int Result = 0; +uint BS_FMODExSound::CountPlayingDynamicSounds() { + uint Result = 0; for (PSM_CONST_ITER it = m_PlayingSoundsMap.begin(); it != m_PlayingSoundsMap.end(); ++it) if (!it->second.ResourcePtr) ++Result; return Result; @@ -772,7 +772,7 @@ bool FMODExSound::Persist(OutputPersistenceBlock &Writer) { RemoveInactiveSounds(); // Warnung ausgeben, wenn dynamische Sounds abgespielt werden - unsigned int PlayingDynamicSounds = CountPlayingDynamicSounds(); + uint PlayingDynamicSounds = CountPlayingDynamicSounds(); if (PlayingDynamicSounds) BS_LOG_WARNINGLN("There are currently dynamic sounds playing. These will not be persisted."); // Nächstes Handle speichern @@ -792,7 +792,7 @@ bool FMODExSound::Persist(OutputPersistenceBlock &Writer) { // Soundeigenschaften speichern Writer.Write(PSD.ResourcePtr->GetFileName()); - Writer.Write(static_cast(PSD.Type)); + Writer.Write(static_cast(PSD.Type)); Writer.Write(PSD.Layer); Writer.Write(PSD.Volume); @@ -835,22 +835,22 @@ bool FMODExSound::Unpersist(InputPersistenceBlock &Reader) { Reader.Read(m_NextHandle); // Soundanzahl einlesen - unsigned int SoundCount = 0; + uint SoundCount = 0; Reader.Read(SoundCount); // Informationen über jeden spielenden Sound einlesen und ihn mit den Parametern abspielen - for (unsigned int i = 0; i < SoundCount; ++i) { - unsigned int Handle; + for (uint i = 0; i < SoundCount; ++i) { + uint Handle; Common::String FileName; - unsigned int Type; - unsigned int Layer; + uint Type; + uint Layer; float Volume; float Pan; bool Loop; - unsigned int LoopStart; - unsigned int LoopEnd; - unsigned int Position; + uint LoopStart; + uint LoopEnd; + uint Position; bool Paused; bool PausedLayer; bool PausedGlobal; diff --git a/engines/sword25/sfx/fmodexsound.h b/engines/sword25/sfx/fmodexsound.h index 7a313d7025..10d383cfd5 100644 --- a/engines/sword25/sfx/fmodexsound.h +++ b/engines/sword25/sfx/fmodexsound.h @@ -48,28 +48,28 @@ public: FMODExSound(Kernel *pKernel); virtual ~FMODExSound(); - bool Init(unsigned int SampleRate, unsigned int Channels = 32); + bool Init(uint SampleRate, uint Channels = 32); void Update(); void SetVolume(float Volume, SOUND_TYPES Type); float GetVolume(SOUND_TYPES Type); void PauseAll(); void ResumeAll(); - void PauseLayer(unsigned int Layer); - void ResumeLayer(unsigned int Layer); - bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, unsigned int Layer); - unsigned int PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, unsigned int Layer); - unsigned int PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, unsigned int SampleRate, unsigned int BitsPerSample, unsigned int Channels, float Volume = 1.0f, float Pan = 0.0f, unsigned int Layer = 0); - - void SetSoundVolume(unsigned int Handle, float Volume); - void SetSoundPanning(unsigned int Handle, float Pan); - void PauseSound(unsigned int Handle); - void ResumeSound(unsigned int Handle); - void StopSound(unsigned int Handle); - bool IsSoundPaused(unsigned int Handle); - bool IsSoundPlaying(unsigned int Handle); - float GetSoundVolume(unsigned int Handle); - float GetSoundPanning(unsigned int Handle); - float GetSoundTime(unsigned int Handle); + void PauseLayer(uint Layer); + void ResumeLayer(uint Layer); + bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, uint Layer); + uint PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, uint Layer); + uint PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, uint SampleRate, uint BitsPerSample, uint Channels, float Volume = 1.0f, float Pan = 0.0f, uint Layer = 0); + + void SetSoundVolume(uint Handle, float Volume); + void SetSoundPanning(uint Handle, float Pan); + void PauseSound(uint Handle); + void ResumeSound(uint Handle); + void StopSound(uint Handle); + bool IsSoundPaused(uint Handle); + bool IsSoundPlaying(uint Handle); + float GetSoundVolume(uint Handle); + float GetSoundPanning(uint Handle); + float GetSoundTime(uint Handle); Resource *LoadResource(const Common::String &FileName); bool CanLoadResource(const Common::String &FileName); @@ -85,7 +85,7 @@ public: private: struct PlayingSoundData { PlayingSoundData() {}; - PlayingSoundData(BS_Resource *ResourcePtr_, BS_FMODExChannel *ChannelPtr_, SOUND_TYPES Type_, unsigned int Layer_, float Volume_, DynamicSoundReadCallback ReadCallback_ = 0, void *UserData_ = 0) : + PlayingSoundData(BS_Resource *ResourcePtr_, BS_FMODExChannel *ChannelPtr_, SOUND_TYPES Type_, uint Layer_, float Volume_, DynamicSoundReadCallback ReadCallback_ = 0, void *UserData_ = 0) : ResourcePtr(ResourcePtr_), ChannelPtr(ChannelPtr_), Type(Type_), @@ -101,7 +101,7 @@ private: BS_Resource *ResourcePtr; BS_FMODExChannel *ChannelPtr; SOUND_TYPES Type; - unsigned int Layer; + uint Layer; DynamicSoundReadCallback ReadCallback; void *UserData; @@ -111,23 +111,23 @@ private: bool PausedGlobal; }; - typedef BS_Hashmap PSM; - typedef BS_Hashmap::iterator PSM_ITER; - typedef BS_Hashmap::const_iterator PSM_CONST_ITER; + typedef BS_Hashmap PSM; + typedef BS_Hashmap::iterator PSM_ITER; + typedef BS_Hashmap::const_iterator PSM_CONST_ITER; PSM m_PlayingSoundsMap; FMOD_SYSTEM *m_FMOD; float m_Volumes[3]; - unsigned int m_NextHandle; + uint m_NextHandle; void RemoveInactiveSounds(); - PlayingSoundData *GetPlayingSoundDataByHandle(unsigned int Handle); - unsigned int PlaySoundInternal(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, unsigned int Layer, unsigned int Handle, unsigned int Position); - unsigned int CountPlayingDynamicSounds(); + PlayingSoundData *GetPlayingSoundDataByHandle(uint Handle); + uint PlaySoundInternal(const Common::String &FileName, SOUND_TYPES Type, float Volume, float Pan, bool Loop, int LoopStart, int LoopEnd, uint Layer, uint Handle, uint Position); + uint CountPlayingDynamicSounds(); - static FMOD_RESULT F_CALLBACK FMODExDynamicSoundSetPosCallback(FMOD_SOUND *sound, int subsound, unsigned int position, FMOD_TIMEUNIT postype); - static FMOD_RESULT F_CALLBACK FMODExDynamicSoundReadCallback(FMOD_SOUND *sound, void *data, unsigned int datalen); - static FMOD_RESULT F_CALLBACK DSPReadCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels); + static FMOD_RESULT F_CALLBACK FMODExDynamicSoundSetPosCallback(FMOD_SOUND *sound, int subsound, uint position, FMOD_TIMEUNIT postype); + static FMOD_RESULT F_CALLBACK FMODExDynamicSoundReadCallback(FMOD_SOUND *sound, void *data, uint datalen); + static FMOD_RESULT F_CALLBACK DSPReadCallback(FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, uint length, int inchannels, int outchannels); #endif }; diff --git a/engines/sword25/sfx/soundengine.h b/engines/sword25/sfx/soundengine.h index da60f9d736..6c67c9c531 100644 --- a/engines/sword25/sfx/soundengine.h +++ b/engines/sword25/sfx/soundengine.h @@ -80,7 +80,7 @@ public: * @param Data Pointer to the data buffer * @param DataLength Length of the data to be written in bytes */ - typedef void (*DynamicSoundReadCallback)(void *UserData, void *Data, unsigned int DataLength); + typedef void (*DynamicSoundReadCallback)(void *UserData, void *Data, uint DataLength); // ----------------------------------------------------------------------------- // Constructor / destructor @@ -101,7 +101,7 @@ public: * @remark Calls to other methods may take place only if this * method was called successfully. */ - virtual bool Init(unsigned int SampleRate, unsigned int Channels = 32) = 0; + virtual bool Init(uint SampleRate, uint Channels = 32) = 0; /** * Performs a "tick" of the sound engine @@ -141,13 +141,13 @@ public: * Pauses all sounds of a given layer. * @param Layer The Sound Layer */ - virtual void PauseLayer(unsigned int Layer) = 0; + virtual void PauseLayer(uint Layer) = 0; /** * Resumes all the sounds in a layer that was previously stopped with PauseLayer() * @param Layer The Sound Layer */ - virtual void ResumeLayer(unsigned int Layer) = 0; + virtual void ResumeLayer(uint Layer) = 0; /** @@ -166,7 +166,7 @@ public: * @remark If more control is needed over the playing, eg. changing the sound parameters * for Volume and Panning, then PlaySoundEx should be used. */ - virtual bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, unsigned int Layer = 0) = 0; + virtual bool PlaySound(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, uint Layer = 0) = 0; /** * Plays a sound @@ -183,7 +183,7 @@ public: * @remark If more control is needed over the playing, eg. changing the sound parameters * for Volume and Panning, then PlaySoundEx should be used. */ - virtual unsigned int PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, unsigned int Layer = 0) = 0; + virtual uint PlaySoundEx(const Common::String &FileName, SOUND_TYPES Type, float Volume = 1.0f, float Pan = 0.0f, bool Loop = false, int LoopStart = -1, int LoopEnd = -1, uint Layer = 0) = 0; /** * Plays a sound generated at runtime @@ -202,69 +202,69 @@ public: * @return Returns a handle to the sound. With this handle, the sound can be manipulated during playback. * @remark Dynamic sounds cannot be persisted. */ - virtual unsigned int PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, unsigned int SampleRate, unsigned int BitsPerSample, unsigned int Channels, float Volume = 1.0f, float Pan = 0.0f, unsigned int Layer = 0) = 0; + virtual uint PlayDynamicSoundEx(DynamicSoundReadCallback ReadCallback, void *UserData, SOUND_TYPES Type, uint SampleRate, uint BitsPerSample, uint Channels, float Volume = 1.0f, float Pan = 0.0f, uint Layer = 0) = 0; /** * Sets the volume of a playing sound * @param Handle The sound handle * @param Volume The volume of the sound (0 = off, 1 = full volume) */ - virtual void SetSoundVolume(unsigned int Handle, float Volume) = 0; + virtual void SetSoundVolume(uint Handle, float Volume) = 0; /** * Sets the panning of a playing sound * @param Handle The sound handle * @param Pan Panning (-1 = full left, 1 = right) */ - virtual void SetSoundPanning(unsigned int Handle, float Pan) = 0; + virtual void SetSoundPanning(uint Handle, float Pan) = 0; /** * Pauses a playing sound * @param Handle The sound handle */ - virtual void PauseSound(unsigned int Handle) = 0; + virtual void PauseSound(uint Handle) = 0; /** * Resumes a paused sound * @param Handle The sound handle */ - virtual void ResumeSound(unsigned int Handle) = 0; + virtual void ResumeSound(uint Handle) = 0; /** * Stops a playing sound * @param Handle The sound handle * @remark Calling this method invalidates the passed handle; it can no longer be used. */ - virtual void StopSound(unsigned int Handle) = 0; + virtual void StopSound(uint Handle) = 0; /** * Returns whether a sound is paused * @param Handle The sound handle * @return Returns true if the sound is paused, false otherwise. */ - virtual bool IsSoundPaused(unsigned int Handle) = 0; + virtual bool IsSoundPaused(uint Handle) = 0; /** * Returns whether a sound is still playing. * @param Handle The sound handle * @return Returns true if the sound is playing, false otherwise. */ - virtual bool IsSoundPlaying(unsigned int Handle) = 0; + virtual bool IsSoundPlaying(uint Handle) = 0; /** * Returns the volume of a playing sound (0 = off, 1 = full volume) */ - virtual float GetSoundVolume(unsigned int Handle) = 0; + virtual float GetSoundVolume(uint Handle) = 0; /** * Returns the panning of a playing sound (-1 = full left, 1 = right) */ - virtual float GetSoundPanning(unsigned int Handle) = 0; + virtual float GetSoundPanning(uint Handle) = 0; /** * Returns the position within a playing sound in seconds */ - virtual float GetSoundTime(unsigned int Handle) = 0; + virtual float GetSoundTime(uint Handle) = 0; private: bool _RegisterScriptBindings(); diff --git a/engines/sword25/sfx/soundengine_script.cpp b/engines/sword25/sfx/soundengine_script.cpp index 4e8d6cd8c4..fad9742c16 100644 --- a/engines/sword25/sfx/soundengine_script.cpp +++ b/engines/sword25/sfx/soundengine_script.cpp @@ -55,9 +55,9 @@ static int Init(lua_State *L) { if (lua_gettop(L) == 0) lua_pushbooleancpp(L, pSfx->Init(44100, 32)); else if (lua_gettop(L) == 1) - lua_pushbooleancpp(L, pSfx->Init(static_cast(luaL_checknumber(L, 1)), 32)); + lua_pushbooleancpp(L, pSfx->Init(static_cast(luaL_checknumber(L, 1)), 32)); else - lua_pushbooleancpp(L, pSfx->Init(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2)))); + lua_pushbooleancpp(L, pSfx->Init(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2)))); return 1; } @@ -84,7 +84,7 @@ static int SetVolume(lua_State *L) { BS_ASSERT(pSfx); pSfx->SetVolume(static_cast(luaL_checknumber(L, 1)), - static_cast(static_cast(luaL_checknumber(L, 2)))); + static_cast(static_cast(luaL_checknumber(L, 2)))); return 0; } @@ -97,7 +97,7 @@ static int GetVolume(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushnumber(L, pSfx->GetVolume(static_cast(static_cast(luaL_checknumber(L, 1))))); + lua_pushnumber(L, pSfx->GetVolume(static_cast(static_cast(luaL_checknumber(L, 1))))); return 1; } @@ -156,10 +156,10 @@ static int ResumeLayer(lua_State *L) { // ----------------------------------------------------------------------------- -static void ProcessPlayParams(lua_State *L, Common::String &FileName, SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, unsigned int &Layer) { +static void ProcessPlayParams(lua_State *L, Common::String &FileName, SoundEngine::SOUND_TYPES &Type, float &Volume, float &Pan, bool &Loop, int &LoopStart, int &LoopEnd, uint &Layer) { FileName = luaL_checkstring(L, 1); - Type = static_cast(static_cast(luaL_checknumber(L, 2))); + Type = static_cast(static_cast(luaL_checknumber(L, 2))); if (lua_gettop(L) < 3 || lua_isnil(L, 3)) Volume = 1.0f; else Volume = static_cast(luaL_checknumber(L, 3)); @@ -177,7 +177,7 @@ static void ProcessPlayParams(lua_State *L, Common::String &FileName, SoundEngin else LoopEnd = static_cast(luaL_checknumber(L, 7)); if (lua_gettop(L) < 8 || lua_isnil(L, 8)) Layer = 0; - else Layer = static_cast(luaL_checknumber(L, 8)); + else Layer = static_cast(luaL_checknumber(L, 8)); } static int PlaySound(lua_State *L) { @@ -193,7 +193,7 @@ static int PlaySound(lua_State *L) { bool Loop; int LoopStart; int LoopEnd; - unsigned int Layer; + uint Layer; ProcessPlayParams(L, FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer); lua_pushbooleancpp(L, pSfx->PlaySound(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer)); @@ -214,7 +214,7 @@ static int PlaySoundEx(lua_State *L) { bool Loop; int LoopStart; int LoopEnd; - unsigned int Layer; + uint Layer; ProcessPlayParams(L, FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer); lua_pushnumber(L, pSfx->PlaySoundEx(FileName, Type, Volume, Pan, Loop, LoopStart, LoopEnd, Layer)); @@ -230,7 +230,7 @@ static int SetSoundVolume(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->SetSoundVolume(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2))); + pSfx->SetSoundVolume(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2))); return 0; } @@ -243,7 +243,7 @@ static int SetSoundPanning(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->SetSoundPanning(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2))); + pSfx->SetSoundPanning(static_cast(luaL_checknumber(L, 1)), static_cast(luaL_checknumber(L, 2))); return 0; } @@ -256,7 +256,7 @@ static int PauseSound(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->PauseSound(static_cast(luaL_checknumber(L, 1))); + pSfx->PauseSound(static_cast(luaL_checknumber(L, 1))); return 0; } @@ -269,7 +269,7 @@ static int ResumeSound(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->ResumeSound(static_cast(luaL_checknumber(L, 1))); + pSfx->ResumeSound(static_cast(luaL_checknumber(L, 1))); return 0; } @@ -282,7 +282,7 @@ static int StopSound(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - pSfx->StopSound(static_cast(luaL_checknumber(L, 1))); + pSfx->StopSound(static_cast(luaL_checknumber(L, 1))); return 0; } @@ -295,7 +295,7 @@ static int IsSoundPaused(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushbooleancpp(L, pSfx->IsSoundPaused(static_cast(luaL_checknumber(L, 1)))); + lua_pushbooleancpp(L, pSfx->IsSoundPaused(static_cast(luaL_checknumber(L, 1)))); return 1; } @@ -308,7 +308,7 @@ static int IsSoundPlaying(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushbooleancpp(L, pSfx->IsSoundPlaying(static_cast(luaL_checknumber(L, 1)))); + lua_pushbooleancpp(L, pSfx->IsSoundPlaying(static_cast(luaL_checknumber(L, 1)))); return 1; } @@ -321,7 +321,7 @@ static int GetSoundVolume(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushnumber(L, pSfx->GetSoundVolume(static_cast(luaL_checknumber(L, 1)))); + lua_pushnumber(L, pSfx->GetSoundVolume(static_cast(luaL_checknumber(L, 1)))); return 1; } @@ -334,7 +334,7 @@ static int GetSoundPanning(lua_State *L) { SoundEngine *pSfx = static_cast(Kernel::GetInstance()->GetService("sfx")); BS_ASSERT(pSfx); - lua_pushnumber(L, pSfx->GetSoundPanning(static_cast(luaL_checknumber(L, 1)))); + lua_pushnumber(L, pSfx->GetSoundPanning(static_cast(luaL_checknumber(L, 1)))); return 1; } -- cgit v1.2.3