diff options
author | Stijn Buys <ingar@osirion.org> | 2008-08-03 17:58:10 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-08-03 17:58:10 +0000 |
commit | e685db34cb94e4bef564da4afdaa7a18b1819c09 (patch) | |
tree | a75184c1bae3ac5386ac5dafd36fc21211d88d6b /src/audio | |
parent | 217b4453fd284a29c422ebd1cef30a9c2c3de639 (diff) |
documentation, extra sound warnings, network bytes/sec
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/audio.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 94f4d23..50d15c8 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -30,6 +30,14 @@ void init() // create the audio context audio_context = alcCreateContext(audio_device ,0); + + if (!audio_context) { + alcCloseDevice(audio_device); + audio_device = 0; + con_warn << "Could not create audio context!"; + return; + } + alcMakeContextCurrent(audio_context); // clear errors @@ -100,6 +108,9 @@ void play(const char *name) void update_source(size_t source_index, math::Vector3f const & location, math::Vector3f const & velocity, float pitch, float gain) { + if (!audio_context) + return; + ALuint source = Sources::source(source_index); alSourcefv(source, AL_POSITION, location.ptr()); //alSourcefv(source, AL_VELOCITY, velocity.ptr()); @@ -127,6 +138,9 @@ void 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) { + if (!audio_context) + return; + alListenerfv(AL_POSITION, location.ptr()); ALfloat orientation[6]; |