From 43927cc52bdd7e44d62b0e6309612558f565b70f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 9 Oct 2010 22:05:46 +0000 Subject: fix crash introduced with inventory transfer, buywindow credits indicator, removed impulse drive initialization delay. --- src/audio/audio.cc | 12 ++++++++++++ src/audio/audio.h | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'src/audio') diff --git a/src/audio/audio.cc b/src/audio/audio.cc index b7a79d7..46d3a67 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -212,4 +212,16 @@ void update_source(size_t source_index, math::Vector3f const & location, math::V alSourcef(source, AL_GAIN, gain); } +bool is_playing(const size_t source_index) +{ + if (!audio_context) + return false; + + ALuint source = Sources::source(source_index); + ALint srcstate = 0; + alGetSourcei(source , AL_SOURCE_STATE , &srcstate); + + return (srcstate == AL_PLAYING); +} + } diff --git a/src/audio/audio.h b/src/audio/audio.h index ecfdf3e..ad9a024 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -58,6 +58,10 @@ void update_source(size_t source_index, math::Vector3f const & location, math::V /// update listener parameters void update_listener(math::Vector3f const &location, math::Axis const &axis, math::Vector3f const & velocity, float gain = 1.0f); + +/// return true is a source is playing +bool is_playing(const size_t source_index); + } #endif // __INCLUDED_AUDIO_AUDIO_H__ -- cgit v1.2.3