/*] Copyright (c) 2009-2010, Charles McGarvey [************************** **] All rights reserved. * * vi:ts=4 sw=4 tw=75 * * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. * **************************************************************************/ #ifndef _MOOF_SOUND_HH_ #define _MOOF_SOUND_HH_ /** * @file Sound.hh * Load and play sounds, current supports ogg vorbis. */ #include #include #include #include namespace Mf { class Sound; typedef boost::shared_ptr SoundP; class SoundStream; typedef boost::shared_ptr SoundStreamP; class Sound : public Resource { public: static SoundP alloc(const std::string& name) { return SoundP(new Sound(name)); } Sound(); explicit Sound(const std::string& name); virtual ~Sound() {} // this implicitly stops the sound if it is playing void setSample(const std::string& name); virtual void play(); void stop(); void pause(); void toggle(); bool isPlaying() const; void setPosition(const Vector3& position); void setVelocity(const Vector3& velocity); void setGain(Scalar gain); void setPitch(Scalar pitch); void setLooping(bool looping); static void setListenerPosition(const Vector3& position); static void setListenerVelocity(const Vector3& velocity); static void setListenerOrientation(const Vector3& forward, const Vector3& up); static bool getPath(std::string& name); protected: class Impl; boost::shared_ptr mImpl; }; class SoundStream : public Sound { public: static SoundStreamP alloc(const std::string& name) { return SoundStreamP(new SoundStream(name)); } SoundStream(); explicit SoundStream(const std::string& name) : Sound(name) {} void enqueue(const std::string& name); void play(); }; } // namespace Mf #endif // _MOOF_SOUND_HH_