diff options
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/audio.cc | 12 | ||||
-rw-r--r-- | src/audio/sources.cc | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 8880780..1895d21 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -76,19 +76,17 @@ void play(const char *name) size_t buffer = Buffers::load(std::string(name)); - ALint state; for (size_t i = 0; i < MAXUISOURCES; i++) { + ALint srcstate = 0; ALuint source = Sources::source(i); - alGetSourcei(source , AL_SOURCE_STATE , &state); - if (state != AL_PLAYING) { - //alSourceRewind(Sources::source(i)); + alGetSourcei(source , AL_SOURCE_STATE , &srcstate); + if (srcstate != AL_PLAYING) { Buffers::bind(source, buffer); alSourcef(source, AL_PITCH, 1.0); alSourcef(source, AL_GAIN, 1.0); + alSourceRewind(source); alSourcePlay(source); - - } else { - con_debug << "source " << Sources::source(i) << " playing!" << std::endl; + return; } } } diff --git a/src/audio/sources.cc b/src/audio/sources.cc index dd736e7..2c67304 100644 --- a/src/audio/sources.cc +++ b/src/audio/sources.cc @@ -26,7 +26,7 @@ void Sources::init() } // all sources are available for use - for (size_t i=MAXUISOURCES; i < MAXSOURCES; i++) { + for (size_t i = MAXUISOURCES; i < MAXSOURCES; i++) { source_available[i] = true; } |