diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index bf972512bc..9131bbe296 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -92,7 +92,7 @@ public: OpenAL_SoundStream(std::auto_ptr decoder); virtual ~OpenAL_SoundStream(); - void Play(); + void Play(float volume, float pitch); virtual void Stop(); virtual bool isPlaying(); }; @@ -156,12 +156,14 @@ OpenAL_SoundStream::~OpenAL_SoundStream() Decoder->Close(); } -void OpenAL_SoundStream::Play() +void OpenAL_SoundStream::Play(float volume, float pitch) { std::vector data(BufferSize); alSourceStop(Source); alSourcei(Source, AL_BUFFER, 0); + alSourcef(Source, AL_GAIN, volume); + alSourcef(Source, AL_PITCH, pitch); throwALerror(); for(ALuint i = 0;i < NumBuffers;i++) @@ -395,14 +397,14 @@ Sound* OpenAL_Output::PlaySound3D(const std::string &fname, std::auto_ptr decoder) +Sound* OpenAL_Output::StreamSound(const std::string &fname, std::auto_ptr decoder, float volume, float pitch) { std::auto_ptr sound; decoder->Open(fname); sound.reset(new OpenAL_SoundStream(decoder)); - sound->Play(); + sound->Play(volume, pitch); return sound.release(); } diff --git a/apps/openmw/mwsound/openal_output.hpp b/apps/openmw/mwsound/openal_output.hpp index 0ab8dd3496..65fe89c9e6 100644 --- a/apps/openmw/mwsound/openal_output.hpp +++ b/apps/openmw/mwsound/openal_output.hpp @@ -28,7 +28,8 @@ namespace MWSound MWWorld::Ptr ptr, float volume, float pitch, float min, float max, bool loop); - virtual Sound *StreamSound(const std::string &fname, std::auto_ptr decoder); + virtual Sound *StreamSound(const std::string &fname, std::auto_ptr decoder, + float volume, float pitch); virtual void UpdateListener(float pos[3], float atdir[3], float updir[3]); diff --git a/apps/openmw/mwsound/sound_output.hpp b/apps/openmw/mwsound/sound_output.hpp index ba98092915..9c8d0303b3 100644 --- a/apps/openmw/mwsound/sound_output.hpp +++ b/apps/openmw/mwsound/sound_output.hpp @@ -24,7 +24,8 @@ namespace MWSound virtual Sound *PlaySound3D(const std::string &fname, std::auto_ptr decoder, MWWorld::Ptr ptr, float volume, float pitch, float min, float max, bool loop) = 0; - virtual Sound *StreamSound(const std::string &fname, std::auto_ptr decoder) = 0; + virtual Sound *StreamSound(const std::string &fname, std::auto_ptr decoder, + float volume, float pitch) = 0; // FIXME: This should take an MWWorld::Ptr that represents the in-world camera virtual void UpdateListener(float pos[3], float atdir[3], float updir[3]) = 0; diff --git a/apps/openmw/mwsound/soundmanager.cpp b/apps/openmw/mwsound/soundmanager.cpp index b1caf7ff37..cab179f616 100644 --- a/apps/openmw/mwsound/soundmanager.cpp +++ b/apps/openmw/mwsound/soundmanager.cpp @@ -199,7 +199,7 @@ namespace MWSound if(mMusic) mMusic->Stop(); std::auto_ptr decoder(new DEFAULT_DECODER); - mMusic.reset(Output->StreamSound(filename, decoder)); + mMusic.reset(Output->StreamSound(filename, decoder, 0.4f, 1.0f)); } void SoundManager::streamMusic(const std::string& filename)