X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fsound.cc;h=864c68abda05f3820f823e8a81922fb2a9b909ea;hp=34c30ce78929b172d2165bad3eff78fec4c2081b;hb=6c9943707d4f33035830eba0587a61a34eaecbc2;hpb=af88821a172c4dfd138b91b2a5148ae50b502fa2 diff --git a/src/moof/sound.cc b/src/moof/sound.cc index 34c30ce..864c68a 100644 --- a/src/moof/sound.cc +++ b/src/moof/sound.cc @@ -23,6 +23,8 @@ #include "log.hh" #include "sound.hh" #include "resource.hh" +#include "runloop.hh" +#include "thread.hh" #include "timer.hh" @@ -36,6 +38,9 @@ namespace moof { +thread stream_thread_; + + /*] Sound backend *************************************************************************/ @@ -356,10 +361,18 @@ public: alSourcePlay(source_); } + void start_update_timer() { stream_timer_.init(boost::bind(&impl::stream_update, this, _1, _2), - SCALAR(0.1), timer::repeat); + SCALAR(0.1), timer::repeat); + + //thread thread; + //thread.runloop().add_timer(stream_timer_); + if (!stream_thread_.is_valid()) + { + stream_thread_ = thread::detach(stream_timer_); + } } void fill_stream() @@ -531,10 +544,8 @@ public: void stream_update(timer& timer, scalar t) { - //log_error("blaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhrrrrrg"); + log_debug("blaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhrrrrrg"); fill_stream(); - // TODO: might be nice to also allow using threads for streaming - // rather than a timer, probably as a compile-time option }