diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-13 19:36:30 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-13 19:36:30 +0000 |
commit | 03f502cf04cdd37485a31f4072c99764bcd78f0c (patch) | |
tree | 940fd0f50cb00b990a4023d27b5721ebf7e88101 /src | |
parent | 5992c46fc62db1bdf038b5b7be0e94dd10183e77 (diff) |
rewind OpenAL sources before clearing them
Diffstat (limited to 'src')
-rw-r--r-- | src/audio/buffers.cc | 5 | ||||
-rw-r--r-- | src/audio/buffers.h | 1 | ||||
-rw-r--r-- | src/audio/sources.cc | 19 | ||||
-rw-r--r-- | src/audio/sources.h | 1 |
4 files changed, 5 insertions, 21 deletions
diff --git a/src/audio/buffers.cc b/src/audio/buffers.cc index df47d2a..774639e 100644 --- a/src/audio/buffers.cc +++ b/src/audio/buffers.cc @@ -50,11 +50,6 @@ void Buffers::clear() index = 0; } -void Buffers::reset() -{ - //shutdown(); - //init(); -} size_t Buffers::load(std::string name) { diff --git a/src/audio/buffers.h b/src/audio/buffers.h index 462afff..cc7a6c8 100644 --- a/src/audio/buffers.h +++ b/src/audio/buffers.h @@ -23,7 +23,6 @@ class Buffers { public: static void init(); static void shutdown(); - static void reset(); /// find previously loaded PCM data static size_t find(std::string name); diff --git a/src/audio/sources.cc b/src/audio/sources.cc index 01fbafb..2ec0e26 100644 --- a/src/audio/sources.cc +++ b/src/audio/sources.cc @@ -40,6 +40,11 @@ void Sources::init() void Sources::shutdown() { + // stop all sources + for (size_t index= 0; index < MAXSOURCES; index++) { + alSourceRewind(sources[index]); + } + alDeleteSources(MAXSOURCES, sources); clear(); } @@ -52,20 +57,6 @@ void Sources::clear() for (size_t i=0; i < MAXSOURCES; i++) { source_available[i] = false; } - -} - -void Sources::reset() -{ - for (size_t index= 0; index < MAXSOURCES; index++) { - source_available[index] = true; - alSourceRewind(sources[index]); - } - - // reserve ui sound sources - for (size_t i=0; i < MAXUISOURCES; i++) { - source_available[i] = false; - } } size_t Sources::get() diff --git a/src/audio/sources.h b/src/audio/sources.h index f01e7a4..078c424 100644 --- a/src/audio/sources.h +++ b/src/audio/sources.h @@ -23,7 +23,6 @@ class Sources { public: static void init(); static void shutdown(); - static void reset(); static inline bool available(size_t index) { return source_available[index]; } |