+ }
+
+
+ static int retain_count;
+ static ALCdevice* al_device;
+ static ALCcontext* al_context;
+};
+
+int sound_backend::retain_count = 0;
+ALCdevice* sound_backend::al_device;
+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");
+ }
+
+ ~sound_resource_loader()
+ {
+ resource::unregister_type("ogg");
+ }
+};
+
+static sound_resource_loader loader;
+
+
+
+// SOUND BUFFER
+
+class buffer
+{
+public:
+
+ typedef hash<ALuint,int,hash_function> retcount_lookup;
+
+
+ buffer() :
+ buffer_((ALuint)-1) {}
+
+ buffer(const void* data,
+ ALsizei size,
+ ALenum format,
+ ALsizei freq)
+ {
+ alGenBuffers(1, &buffer_);
+ alBufferData(buffer_, format, data, size, freq);
+
+ retain_counts_[buffer_] = 1;
+ log_warning("ctor buffer:", buffer_);
+ }
+
+ buffer(const buffer& buf)
+ {
+ buffer_ = buf.buffer_;
+ retain();
+ }
+
+ buffer& operator = (const buffer& buf)
+ {
+ buffer_ = buf.buffer_;
+ retain();
+ return *this;
+ }
+
+ ~buffer()
+ {
+ release();
+ }