X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FSound.hh;h=14cd79041ac10cbdc2e0b53d4f295b5090bc26b6;hp=982e9b4065eeca659601fd9015846407a2936fab;hb=a295f8def17036c8071b56e181364f99a377cae7;hpb=8a1acac01b444dccf8b57cedf08392ada2e473c1 diff --git a/src/Moof/Sound.hh b/src/Moof/Sound.hh index 982e9b4..14cd790 100644 --- a/src/Moof/Sound.hh +++ b/src/Moof/Sound.hh @@ -36,7 +36,6 @@ #include -#include #include #include @@ -47,6 +46,9 @@ namespace Mf { class Sound; typedef boost::shared_ptr SoundP; +class SoundStream; +typedef boost::shared_ptr SoundStreamP; + class Sound : public Resource { @@ -60,20 +62,16 @@ public: 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); @@ -89,13 +87,32 @@ public: static std::string getPath(const std::string& name); -private: +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_