Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/audio
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-01-12 21:57:36 +0000
committerStijn Buys <ingar@osirion.org>2009-01-12 21:57:36 +0000
commit9caf289046ed2639f1935fb1c87133af4f7f6cac (patch)
treeedb3e60cece44a26165b54ff03e3d97ca4c9bba4 /src/audio
parent9c844f666405eaa94df3740c5423ab0e932d4ea8 (diff)
Fixes OpenAL reset sequence.
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/audio.cc8
-rw-r--r--src/audio/buffers.cc20
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;
}
}