Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2010-08-02 22:22:34 +0400
committerJoerg Mueller <nexyon@gmail.com>2010-08-02 22:22:34 +0400
commit86fc34b924e281ee9273c44c024434bdd6e3f7f2 (patch)
tree44b3a423eaa1643ca6ad3519249bf2c15586e472 /intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
parentbce3a49e2e8fb9d344ca86769f5ffe0c7189024f (diff)
Audaspace:
* Added a stopCallback function that is called when the end of a sound is reached. * Fixed the scrubbing not working. * Minor SoundActuator cleanup.
Diffstat (limited to 'intern/audaspace/OpenAL/AUD_OpenALDevice.cpp')
-rw-r--r--intern/audaspace/OpenAL/AUD_OpenALDevice.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
index 88e48ff20ba..f69a2e5d805 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
@@ -68,6 +68,12 @@ struct AUD_OpenALHandle : AUD_Handle
/// The loop count of the source.
int loopcount;
+
+ /// The stop callback.
+ stopCallback stop;
+
+ /// Stop callback data.
+ void* stop_data;
};
struct AUD_OpenALBufferedFactory
@@ -131,13 +137,9 @@ void AUD_OpenALDevice::updateStreams()
{
// for all sounds
- AUD_HandleIterator it = m_playingSounds->begin();
- while(it != m_playingSounds->end())
+ for(AUD_HandleIterator it = m_playingSounds->begin(); it != m_playingSounds->end(); it++)
{
sound = *it;
- // increment the iterator to make sure it's valid,
- // in case the sound gets deleted after stopping
- ++it;
// is it a streamed sound?
if(!sound->isBuffered)
@@ -227,12 +229,21 @@ void AUD_OpenALDevice::updateStreams()
// if it really stopped
if(sound->data_end)
{
+ if(sound->stop)
+ sound->stop(sound->stop_data);
+
+ // increment the iterator to the next value,
+ // because the sound gets deleted in the list here.
+ ++it;
// pause or
if(sound->keep)
pause(sound);
// stop
else
stop(sound);
+ // decrement again, so that we get the next sound in the
+ // next loop run
+ --it;
}
// continue playing
else
@@ -1012,6 +1023,20 @@ bool AUD_OpenALDevice::setLoopCount(AUD_Handle* handle, int count)
return result;
}
+bool AUD_OpenALDevice::setStopCallback(AUD_Handle* handle, stopCallback callback, void* data)
+{
+ lock();
+ bool result = isValid(handle);
+ if(result)
+ {
+ AUD_OpenALHandle* h = (AUD_OpenALHandle*)handle;
+ h->stop = callback;
+ h->stop_data = data;
+ }
+ unlock();
+ return result;
+}
+
/* AUD_XXX Temorary disabled
bool AUD_OpenALDevice::bufferFactory(void *value)