]> Dogcows Code - chaz/yoink/blobdiff - src/moof/sound.cc
mesh and other random adjustments
[chaz/yoink] / src / moof / sound.cc
index 0714698673f02f8d7a757e0923ba39ca509f2191..2c19d265b721f0b9d0e01a94f0bd93007157f948 100644 (file)
@@ -13,7 +13,6 @@
 #include <deque>
 #include <list>
 #include <stdexcept>
-#include <string>
 
 #include <boost/algorithm/string.hpp>
 #include <boost/cstdint.hpp>
 
 #include "hash.hh"
 #include "log.hh"
-#include "manager.hh"
 #include "sound.hh"
 #include "resource.hh"
 #include "timer.hh"
 
 
 #ifndef BUF_SIZE
-#define BUF_SIZE       (4096)
+#define BUF_SIZE       (4096 * 64)
 #endif
 
-#define NUM_BUFFERS (8)
+#define NUM_BUFFERS (4)
 
 
 namespace moof {
 
 
+/*] Sound backend
+ *************************************************************************/
+
 class sound_backend
 {
 public:
@@ -104,27 +105,11 @@ ALCcontext*       sound_backend::al_context;
 class sound_resource;
 typedef resource_handle<sound_resource> sound_handle;
 
-
-class sound_resource_loader
-{
-public:
-       
-       sound_resource_loader()
-       {
-               resource::register_type<sound_resource>("ogg", "sounds");
-       }
-
-       ~sound_resource_loader()
-       {
-               resource::unregister_type("ogg");
-       }
-};
-
-static sound_resource_loader loader;
-
+MOOF_REGISTER_RESOURCE(sound_resource, ogg, sounds);
 
 
-// SOUND BUFFER
+/*] Sound buffer
+ *************************************************************************/
 
 class buffer
 {
@@ -226,7 +211,8 @@ buffer::retcount_lookup buffer::retain_counts_;
 
 
 
-// SOUND RESOURCE
+/*] Sound resource
+ *************************************************************************/
 
 class sound_resource : public boost::noncopyable
 {
@@ -334,6 +320,8 @@ private:
 };
 
 
+/*] Sound class
+ *************************************************************************/
 
 class sound::impl
 {
@@ -419,7 +407,7 @@ public:
                if (!stream_timer_.is_valid())
                {
                        stream_timer_.init(boost::bind(&impl::stream_update, this, _1, _2),
-                                       0.01, timer::repeat);
+                                       SCALAR(0.5), timer::repeat);
                }
 
                alSourcePlay(source_);
@@ -603,12 +591,6 @@ void sound::enqueue(const std::string& path)
 
 
 void sound::play()
-{
-       // pass through
-       impl_->play();
-}
-
-void sound::stream()
 {
        // pass through
        impl_->stream();
@@ -637,7 +619,6 @@ void sound::toggle()
 {
        if (is_playing()) pause();
        else play();
-       // TODO: what about streaming sources?
 }
 
 bool sound::is_playing() const
This page took 0.019099 seconds and 4 git commands to generate.