diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-12 21:57:36 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-12 21:57:36 +0000 |
commit | 9caf289046ed2639f1935fb1c87133af4f7f6cac (patch) | |
tree | edb3e60cece44a26165b54ff03e3d97ca4c9bba4 /src/audio | |
parent | 9c844f666405eaa94df3740c5423ab0e932d4ea8 (diff) |
Fixes OpenAL reset sequence.
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/audio.cc | 8 | ||||
-rw-r--r-- | src/audio/buffers.cc | 20 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 84c7e0e..2192e2f 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -60,9 +60,11 @@ void reset() { con_print << "^BInitializing audio..." << std::endl; - Sources::reset(); - Buffers::reset(); - + Sources::shutdown(); + Buffers::shutdown(); + Buffers::init(); + Sources::init(); + load("ui/nosnd"); load("ui/console"); } diff --git a/src/audio/buffers.cc b/src/audio/buffers.cc index 33c4dbf..df47d2a 100644 --- a/src/audio/buffers.cc +++ b/src/audio/buffers.cc @@ -19,11 +19,11 @@ ALuint Buffers::buffers[MAXBUFFERS]; void Buffers::init() { - int error; - clear(); - + clear(); + alGenBuffers(MAXBUFFERS, buffers); + int error; if ((error = alGetError()) != AL_NO_ERROR) { con_warn << "Error " << error << " initializing OpenAL buffers!" << std::endl; return; @@ -33,7 +33,13 @@ void Buffers::init() void Buffers::shutdown() { alDeleteBuffers(MAXBUFFERS, buffers); - + + int error; + if ((error = alGetError()) != AL_NO_ERROR) { + con_warn << "Error " << error << " clearing OpenAL buffers!" << std::endl; + return; + } + clear(); } @@ -46,8 +52,8 @@ void Buffers::clear() void Buffers::reset() { - shutdown(); - init(); + //shutdown(); + //init(); } size_t Buffers::load(std::string name) @@ -114,7 +120,7 @@ void Buffers::bind(ALuint source, size_t id) int error; alSourcei(source, AL_BUFFER, buffers[id]); if ((error = alGetError()) != AL_NO_ERROR) { - con_warn << "Error " << std::hex << error << " binding buffer " << buffers[id] << " to source " << source << std::endl; + con_warn << "Error " << error << " binding buffer " << buffers[id] << " to source " << source << std::endl; } } |