Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-07-17 14:19:18 +0000
committerStijn Buys <ingar@osirion.org>2008-07-17 14:19:18 +0000
commitae65ef53fc8b70ebee3b43bb06ecd091aaae2a26 (patch)
treed8a2a253314e0bab54edc9ee829aee819a7860bd /src/audio/sources.cc
parenteb075660e7cb61b138c2da337115c59857f89e17 (diff)
engine sounds
Diffstat (limited to 'src/audio/sources.cc')
-rw-r--r--src/audio/sources.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/audio/sources.cc b/src/audio/sources.cc
index 2c67304..3a6b3fc 100644
--- a/src/audio/sources.cc
+++ b/src/audio/sources.cc
@@ -53,4 +53,30 @@ void Sources::clear()
}
+size_t Sources::get()
+{
+ for (size_t i= MAXUISOURCES; i < MAXSOURCES; i++) {
+ if (source_available[i]) {
+ source_available[i] = false;
+ alSourcef(sources[i], AL_PITCH, 1.0);
+ alSourcef(sources[i], AL_GAIN, 1.0);
+ //con_debug << "reserved source " << i << std::endl;
+ return i;
+ }
+ }
+ return 0;
+}
+
+void Sources::remove(size_t index)
+{
+ if ( (index < MAXUISOURCES ) || (MAXSOURCES <= index))
+ return;
+
+ source_available[index] = true;
+ alSourcef(sources[index], AL_GAIN, 0);
+ alSourceRewind(sources[index]);
+
+ //con_debug << "removed source " << index << std::endl;
+}
+
}