Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-11-30 14:58:30 +0000
committerStijn Buys <ingar@osirion.org>2010-11-30 14:58:30 +0000
commitb9a97161e947995fc5c708a1e61b89785e08feef (patch)
tree448e34c2b03bc4bff410b750fdb1be615fa5aa93 /src
parenta7a274bfda04a87009788b705a2d90e01b1041c7 (diff)
Corrected a problem in the sound initialization sequence.
Diffstat (limited to 'src')
-rw-r--r--src/audio/audio.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/audio/audio.cc b/src/audio/audio.cc
index d7f85d9..304174c 100644
--- a/src/audio/audio.cc
+++ b/src/audio/audio.cc
@@ -47,6 +47,8 @@ void init()
}
alcMakeContextCurrent(audio_context);
+
+ con_debug << " device ^B" << alcGetString(audio_device, ALC_DEFAULT_DEVICE_SPECIFIER) << std::endl;
// clear errors
alGetError();
@@ -55,15 +57,13 @@ void init()
Sources::init();
- //con_debug << " audio device ^B" << alcGetString(audio_device, ALC_DEFAULT_DEVICE_SPECIFIER) << std::endl;
-
+ audio_initialized = true;
+
// the "no sound" sound
load("ui/nosnd");
// console sound
load("ui/console");
-
- audio_initialized = true;
}
void reset()
@@ -88,6 +88,9 @@ void reset()
void load(const char *name)
{
+ if (!audio_initialized)
+ return;
+
Buffers::load(std::string(name));
}
@@ -116,7 +119,7 @@ void shutdown()
size_t play(const char *name)
{
- if (!audio_context)
+ if (!audio_initialized)
return 0;
size_t buffer_index = Buffers::load(std::string(name));
@@ -143,7 +146,7 @@ size_t play(const char *name)
size_t play(size_t source_index, size_t buffer_index, float pitch, float gain)
{
- if (!audio_context || !buffer_index)
+ if (!audio_initialized || !buffer_index)
return 0;
ALuint source = Sources::source(source_index);
@@ -166,7 +169,7 @@ size_t play(size_t source_index, size_t buffer_index, float pitch, float gain)
size_t loop(size_t source_index, size_t buffer_index, float pitch, float gain)
{
- if (!audio_context || !buffer_index)
+ if (!audio_initialized || !buffer_index)
return 0;
ALuint source = Sources::source(source_index);
@@ -192,7 +195,7 @@ size_t loop(size_t source_index, size_t buffer_index, float pitch, float gain)
size_t loop(size_t source_index, const char *name, float pitch, float gain)
{
- if (!audio_context)
+ if (!audio_initialized)
return 0;
size_t buffer_index = Buffers::load(std::string(name));
@@ -204,7 +207,7 @@ size_t loop(size_t source_index, const char *name, float pitch, float gain)
void update_listener(math::Vector3f const &location, math::Axis const &axis, math::Vector3f const & velocity, float gain)
{
- if (!audio_context)
+ if (!audio_initialized)
return;
alListenerfv(AL_POSITION, location.ptr());
@@ -222,7 +225,7 @@ void update_listener(math::Vector3f const &location, math::Axis const &axis, mat
void update_source(size_t source_index, math::Vector3f const & location, math::Vector3f const & velocity, float pitch, float gain)
{
- if (!audio_context)
+ if (!audio_initialized)
return;
ALuint source = Sources::source(source_index);
@@ -234,7 +237,7 @@ void update_source(size_t source_index, math::Vector3f const & location, math::V
bool is_playing(const size_t source_index)
{
- if (!audio_context)
+ if (!audio_initialized)
return false;
ALuint source = Sources::source(source_index);