X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FSound.hh;h=6e5f78a23fc4311e736000aecd922f534a003a3a;hp=982e9b4065eeca659601fd9015846407a2936fab;hb=7e84479de612a4ce287c6f63deb014b447a993ec;hpb=a723e23ca2d32e8eed32f9c53323afbbedba575b diff --git a/src/Moof/Sound.hh b/src/Moof/Sound.hh index 982e9b4..6e5f78a 100644 --- a/src/Moof/Sound.hh +++ b/src/Moof/Sound.hh @@ -47,6 +47,9 @@ namespace Mf { class Sound; typedef boost::shared_ptr SoundP; +class SoundStream; +typedef boost::shared_ptr SoundStreamP; + class Sound : public Resource { @@ -60,20 +63,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 +88,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_