#include <boost/shared_ptr.hpp>
-#include <Moof/Exception.hh>
#include <Moof/Math.hh>
#include <Moof/Resource.hh>
class Sound;
typedef boost::shared_ptr<Sound> SoundP;
+class SoundStream;
+typedef boost::shared_ptr<SoundStream> SoundStreamP;
+
class Sound : public Resource
{
Sound();
explicit Sound(const std::string& name);
+ virtual ~Sound() {}
- void play();
- void stream();
-
- // TODO this API sucks... refactor me!!
+ // this implicitly stops the sound if it is playing
+ void setSample(const std::string& name);
+ virtual void play();
void stop();
void pause();
- void resume();
- void toggle();
-
- void setSample(const std::string& name);
- void enqueue(const std::string& name);
+ void toggle();
bool isPlaying() const;
void setPosition(const Vector3& position);
static std::string getPath(const std::string& name);
-private:
+protected:
class Impl;
boost::shared_ptr<Impl> 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_