- static void retain_backend()
- {
- if (retain_count_++ == 0)
- {
- al_device_ = alcOpenDevice(0);
- al_context_ = alcCreateContext(al_device_, 0);
- if (!al_device_ || !al_context_)
- {
- const char* error = alcGetString(al_device_,
- alcGetError(al_device_));
- log_error("audio subsystem initialization failure", error);
- }
- else
- {
- alcMakeContextCurrent(al_context_);
- log_info << "opened sound device `"
- << alcGetString(al_device_,
- ALC_DEFAULT_DEVICE_SPECIFIER)
- << "'" << std::endl;
- }
- }
- }
-
- static void release_backend()
- {
- if (--retain_count_ == 0)
- {
- alcMakeContextCurrent(0);
- alcDestroyContext(al_context_);
- alcCloseDevice(al_device_);
- }
- }
-
-
- ALuint source_;
- std::list<ALuint> buffers_;