#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:
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
{
-// SOUND RESOURCE
+/*] Sound resource
+ *************************************************************************/
class sound_resource : public boost::noncopyable
{
};
+/*] Sound class
+ *************************************************************************/
class sound::impl
{
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_);
void sound::play()
-{
- // pass through
- impl_->play();
-}
-
-void sound::stream()
{
// pass through
impl_->stream();
{
if (is_playing()) pause();
else play();
- // TODO: what about streaming sources?
}
bool sound::is_playing() const