#include "Log.hh"
#include "Mippleton.hh"
#include "Sound.hh"
+#include "Timer.hh"
#define BUFFER_SIZE (64 * 1024)
//#define BUFFER_SIZE (5*2048)
}
- void beginStream(ALuint source, int nBuffers = 4)
+ void beginStream(ALuint source, int nBuffers = 8)
{
if (!oggStream.datasource) openFile();
if (!oggStream.datasource) return;
alSourcei(source_, AL_LOOPING, AL_FALSE);
alSourcePlay(source_);
playing_ = true;
+
+ streamTimer.init(boost::bind(&Impl::streamUpdate, this, _1, _2), 1.0,
+ Timer::REPEAT);
}
inline void update()
std::queue<BufferP> queue_;
std::vector<BufferP> expired_;
+
+ Timer streamTimer;
+
+ void streamUpdate(Timer& timer, Scalar t)
+ {
+ // don't let the music die!
+ update();
+ }
};
Sound::Sound(const std::string& name) :
impl_->play();
}
-
void Sound::stream()
{
// pass through
impl_->stream();
}
-void Sound::update(Scalar t, Scalar dt)
-{
- // pass through
- impl_->update();
-}
-
void Sound::stop()
{