diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index 2dbe4baad..a183909d3 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -230,6 +230,22 @@ void OpenAL_Output::Deinitialize() } +Sound* OpenAL_Output::PlaySound(const std::string &fname, std::auto_ptr decoder, + float volume, float pitch, bool loop) +{ + fail("PlaySound not yet supported"); + return NULL; +} + +Sound* OpenAL_Output::PlaySound3D(const std::string &fname, std::auto_ptr decoder, + MWWorld::Ptr ptr, float volume, float pitch, + float min, float max, bool loop) +{ + fail("PlaySound3D not yet supported"); + return NULL; +} + + Sound* OpenAL_Output::StreamSound(const std::string &fname, std::auto_ptr decoder) { std::auto_ptr sound; diff --git a/apps/openmw/mwsound/openal_output.hpp b/apps/openmw/mwsound/openal_output.hpp index 6dd5a2c23..0ab8dd349 100644 --- a/apps/openmw/mwsound/openal_output.hpp +++ b/apps/openmw/mwsound/openal_output.hpp @@ -22,6 +22,12 @@ namespace MWSound virtual bool Initialize(const std::string &devname=""); virtual void Deinitialize(); + virtual Sound *PlaySound(const std::string &fname, std::auto_ptr decoder, + float volume, float pitch, bool loop); + virtual Sound *PlaySound3D(const std::string &fname, std::auto_ptr decoder, + 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 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 a8a91cca1..ba9809291 100644 --- a/apps/openmw/mwsound/sound_output.hpp +++ b/apps/openmw/mwsound/sound_output.hpp @@ -4,6 +4,8 @@ #include #include +#include "../mwworld/ptr.hpp" + namespace MWSound { class SoundManager; @@ -17,6 +19,11 @@ namespace MWSound virtual bool Initialize(const std::string &devname="") = 0; virtual void Deinitialize() = 0; + virtual Sound *PlaySound(const std::string &fname, std::auto_ptr decoder, + float volume, float pitch, bool loop) = 0; + 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; // FIXME: This should take an MWWorld::Ptr that represents the in-world camera diff --git a/apps/openmw/mwsound/soundmanager.cpp b/apps/openmw/mwsound/soundmanager.cpp index 242755e95..b24a74868 100644 --- a/apps/openmw/mwsound/soundmanager.cpp +++ b/apps/openmw/mwsound/soundmanager.cpp @@ -120,7 +120,17 @@ namespace MWSound float min, float max, bool loop, bool untracked) { - //std::cout << "Cannot load " << file << ", skipping.\n"; + try + { + Sound *sound; + std::auto_ptr decoder(new DEFAULT_DECODER); + sound = Output->PlaySound3D(file, decoder, ptr, volume, pitch, min, max, loop); + delete sound; + } + catch(std::exception &e) + { + std::cout <<"Sound play error: "< decoder(new DEFAULT_DECODER); + sound = Output->PlaySound(file, decoder, volume, pitch, loop); + delete sound; + } + catch(std::exception &e) + { + std::cout <<"Sound play error: "<