diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-14 20:40:20 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-14 20:40:20 +0000 |
commit | 28d7a4cd5b4bc3df5d034ed9472231d91710a6b6 (patch) | |
tree | 18c0d5df6c0a4b3f406869c86f5fe2f3b63ca299 /src/audio/audio.cc | |
parent | f9dad976adca728a5996450334dcabf57fef2443 (diff) |
failed attempt at multiple simultanious sounds
Diffstat (limited to 'src/audio/audio.cc')
-rw-r--r-- | src/audio/audio.cc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 729f3d2..8880780 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -71,12 +71,25 @@ void shutdown() void play(const char *name) { - Buffers::load(std::string(name)); + if (!audio_context) + return; - if (Sources::available(0)) { - alSourceRewind(Sources::ui()); - Buffers::bind(Sources::ui(), std::string(name)); - alSourcePlay(Sources::ui()); + size_t buffer = Buffers::load(std::string(name)); + + ALint state; + for (size_t i = 0; i < MAXUISOURCES; i++) { + ALuint source = Sources::source(i); + alGetSourcei(source , AL_SOURCE_STATE , &state); + if (state != AL_PLAYING) { + //alSourceRewind(Sources::source(i)); + Buffers::bind(source, buffer); + alSourcef(source, AL_PITCH, 1.0); + alSourcef(source, AL_GAIN, 1.0); + alSourcePlay(source); + + } else { + con_debug << "source " << Sources::source(i) << " playing!" << std::endl; + } } } |