[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23505] branches/ge_dyn_load: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r23490 :23504
Campbell Barton
ideasman42 at gmail.com
Sun Sep 27 10:01:58 CEST 2009
Revision: 23505
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23505
Author: campbellbarton
Date: 2009-09-27 10:01:57 +0200 (Sun, 27 Sep 2009)
Log Message:
-----------
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r23490:23504
Modified Paths:
--------------
branches/ge_dyn_load/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
branches/ge_dyn_load/intern/audaspace/intern/AUD_C-API.cpp
branches/ge_dyn_load/intern/audaspace/intern/AUD_C-API.h
branches/ge_dyn_load/intern/audaspace/intern/AUD_SoftwareDevice.cpp
branches/ge_dyn_load/release/ui/buttons_data_camera.py
branches/ge_dyn_load/source/Makefile
branches/ge_dyn_load/source/blender/blenkernel/intern/anim_sys.c
branches/ge_dyn_load/source/blender/blenkernel/intern/sound.c
branches/ge_dyn_load/source/blender/editors/animation/anim_channels_defines.c
branches/ge_dyn_load/source/blender/editors/animation/anim_channels_edit.c
branches/ge_dyn_load/source/blender/editors/animation/anim_draw.c
branches/ge_dyn_load/source/blender/editors/animation/anim_filter.c
branches/ge_dyn_load/source/blender/editors/animation/keyframes_edit.c
branches/ge_dyn_load/source/blender/editors/armature/editarmature.c
branches/ge_dyn_load/source/blender/editors/include/ED_anim_api.h
branches/ge_dyn_load/source/blender/editors/include/ED_keyframes_edit.h
branches/ge_dyn_load/source/blender/editors/screen/screen_ops.c
branches/ge_dyn_load/source/blender/editors/space_action/action_edit.c
branches/ge_dyn_load/source/blender/editors/space_action/action_header.c
branches/ge_dyn_load/source/blender/editors/space_graph/graph_draw.c
branches/ge_dyn_load/source/blender/editors/space_graph/graph_edit.c
branches/ge_dyn_load/source/blender/editors/space_graph/graph_header.c
branches/ge_dyn_load/source/blender/editors/space_graph/graph_intern.h
branches/ge_dyn_load/source/blender/editors/space_graph/graph_utils.c
branches/ge_dyn_load/source/blender/editors/space_nla/nla_buttons.c
branches/ge_dyn_load/source/blender/editors/space_nla/nla_channels.c
branches/ge_dyn_load/source/blender/editors/space_nla/nla_header.c
branches/ge_dyn_load/source/blender/editors/space_node/drawnode.c
branches/ge_dyn_load/source/blender/editors/space_view3d/view3d_edit.c
branches/ge_dyn_load/source/blender/makesdna/DNA_action_types.h
branches/ge_dyn_load/source/blender/makesdna/DNA_anim_types.h
branches/ge_dyn_load/source/blender/makesrna/intern/rna_animation.c
branches/ge_dyn_load/source/blender/makesrna/intern/rna_image.c
branches/ge_dyn_load/source/blender/makesrna/intern/rna_scene.c
branches/ge_dyn_load/source/blender/windowmanager/intern/wm_event_system.c
Modified: branches/ge_dyn_load/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
===================================================================
--- branches/ge_dyn_load/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp 2009-09-27 06:27:45 UTC (rev 23504)
+++ branches/ge_dyn_load/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp 2009-09-27 08:01:57 UTC (rev 23505)
@@ -127,101 +127,103 @@
alcSuspendContext(m_context);
- // for all sounds
- AUD_HandleIterator it = m_playingSounds->begin();
- while(it != m_playingSounds->end())
{
- 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)
+ // for all sounds
+ AUD_HandleIterator it = m_playingSounds->begin();
+ while(it != m_playingSounds->end())
{
- // check for buffer refilling
- alGetSourcei(sound->source, AL_BUFFERS_PROCESSED, &info);
+ sound = *it;
+ // increment the iterator to make sure it's valid,
+ // in case the sound gets deleted after stopping
+ ++it;
- if(info)
+ // is it a streamed sound?
+ if(!sound->isBuffered)
{
- specs = sound->reader->getSpecs();
+ // check for buffer refilling
+ alGetSourcei(sound->source, AL_BUFFERS_PROCESSED, &info);
- // for all empty buffers
- while(info--)
+ if(info)
{
- // if there's still data to play back
- if(!sound->data_end)
+ specs = sound->reader->getSpecs();
+
+ // for all empty buffers
+ while(info--)
{
- // read data
- length = m_buffersize;
- sound->reader->read(length, buffer);
-
- // read nothing?
- if(length == 0)
+ // if there's still data to play back
+ if(!sound->data_end)
{
- sound->data_end = true;
- break;
- }
+ // read data
+ length = m_buffersize;
+ sound->reader->read(length, buffer);
- // unqueue buffer
- alSourceUnqueueBuffers(sound->source, 1,
- &sound->buffers[sound->current]);
- ALenum err;
- if((err = alGetError()) != AL_NO_ERROR)
- {
- sound->data_end = true;
- break;
- }
+ // read nothing?
+ if(length == 0)
+ {
+ sound->data_end = true;
+ break;
+ }
- // fill with new data
- alBufferData(sound->buffers[sound->current],
- sound->format,
- buffer,
- length * AUD_SAMPLE_SIZE(specs),
- specs.rate);
+ // unqueue buffer
+ alSourceUnqueueBuffers(sound->source, 1,
+ &sound->buffers[sound->current]);
+ ALenum err;
+ if((err = alGetError()) != AL_NO_ERROR)
+ {
+ sound->data_end = true;
+ break;
+ }
- if(alGetError() != AL_NO_ERROR)
- {
- sound->data_end = true;
- break;
+ // fill with new data
+ alBufferData(sound->buffers[sound->current],
+ sound->format,
+ buffer,
+ length * AUD_SAMPLE_SIZE(specs),
+ specs.rate);
+
+ if(alGetError() != AL_NO_ERROR)
+ {
+ sound->data_end = true;
+ break;
+ }
+
+ // and queue again
+ alSourceQueueBuffers(sound->source, 1,
+ &sound->buffers[sound->current]);
+ if(alGetError() != AL_NO_ERROR)
+ {
+ sound->data_end = true;
+ break;
+ }
+
+ sound->current = (sound->current+1) %
+ AUD_OPENAL_CYCLE_BUFFERS;
}
-
- // and queue again
- alSourceQueueBuffers(sound->source, 1,
- &sound->buffers[sound->current]);
- if(alGetError() != AL_NO_ERROR)
- {
- sound->data_end = true;
+ else
break;
- }
-
- sound->current = (sound->current+1) %
- AUD_OPENAL_CYCLE_BUFFERS;
}
- else
- break;
}
}
- }
- // check if the sound has been stopped
- alGetSourcei(sound->source, AL_SOURCE_STATE, &info);
+ // check if the sound has been stopped
+ alGetSourcei(sound->source, AL_SOURCE_STATE, &info);
- if(info != AL_PLAYING)
- {
- // if it really stopped
- if(sound->data_end)
+ if(info != AL_PLAYING)
{
- // pause or
- if(sound->keep)
- pause(sound);
- // stop
+ // if it really stopped
+ if(sound->data_end)
+ {
+ // pause or
+ if(sound->keep)
+ pause(sound);
+ // stop
+ else
+ stop(sound);
+ }
+ // continue playing
else
- stop(sound);
+ alSourcePlay(sound->source);
}
- // continue playing
- else
- alSourcePlay(sound->source);
}
}
@@ -516,61 +518,74 @@
AUD_Handle* AUD_OpenALDevice::play(AUD_IFactory* factory, bool keep)
{
- // check if it is a buffered factory
- for(AUD_BFIterator i = m_bufferedFactories->begin();
- i != m_bufferedFactories->end(); i++)
+ lock();
+
+ AUD_OpenALHandle* sound = NULL;
+
+ try
{
- if((*i)->factory == factory)
+ // check if it is a buffered factory
+ for(AUD_BFIterator i = m_bufferedFactories->begin();
+ i != m_bufferedFactories->end(); i++)
{
- // create the handle
- AUD_OpenALHandle* sound = new AUD_OpenALHandle; AUD_NEW("handle")
- sound->keep = keep;
- sound->current = -1;
- sound->isBuffered = true;
- sound->data_end = true;
+ if((*i)->factory == factory)
+ {
+ // create the handle
+ sound = new AUD_OpenALHandle; AUD_NEW("handle")
+ sound->keep = keep;
+ sound->current = -1;
+ sound->isBuffered = true;
+ sound->data_end = true;
- alcSuspendContext(m_context);
+ alcSuspendContext(m_context);
- // OpenAL playback code
- try
- {
- alGenSources(1, &sound->source);
- if(alGetError() != AL_NO_ERROR)
- AUD_THROW(AUD_ERROR_OPENAL);
-
+ // OpenAL playback code
try
{
- alSourcei(sound->source, AL_BUFFER, (*i)->buffer);
+ alGenSources(1, &sound->source);
if(alGetError() != AL_NO_ERROR)
AUD_THROW(AUD_ERROR_OPENAL);
+
+ try
+ {
+ alSourcei(sound->source, AL_BUFFER, (*i)->buffer);
+ if(alGetError() != AL_NO_ERROR)
+ AUD_THROW(AUD_ERROR_OPENAL);
+ }
+ catch(AUD_Exception)
+ {
+ alDeleteSources(1, &sound->source);
+ throw;
+ }
}
catch(AUD_Exception)
{
- alDeleteSources(1, &sound->source);
+ delete sound; AUD_DELETE("handle")
+ alcProcessContext(m_context);
throw;
}
- }
- catch(AUD_Exception)
- {
- delete sound; AUD_DELETE("handle")
- alcProcessContext(m_context);
- unlock();
- throw;
- }
- // play sound
- m_playingSounds->push_back(sound);
+ // play sound
+ m_playingSounds->push_back(sound);
- alSourcei(sound->source, AL_SOURCE_RELATIVE, 1);
- start();
+ alSourcei(sound->source, AL_SOURCE_RELATIVE, 1);
+ start();
- alcProcessContext(m_context);
- unlock();
-
- return sound;
+ alcProcessContext(m_context);
+ }
}
}
+ catch(AUD_Exception)
+ {
+ unlock();
+ throw;
+ }
+ unlock();
+
+ if(sound)
+ return sound;
+
AUD_IReader* reader = factory->createReader();
if(reader == NULL)
@@ -596,7 +611,7 @@
}
// create the handle
- AUD_OpenALHandle* sound = new AUD_OpenALHandle; AUD_NEW("handle")
+ sound = new AUD_OpenALHandle; AUD_NEW("handle")
sound->keep = keep;
sound->reader = reader;
sound->current = 0;
@@ -683,8 +698,11 @@
bool AUD_OpenALDevice::pause(AUD_Handle* handle)
{
+ bool result = false;
+
+ lock();
+
// only songs that are played can be paused
- lock();
for(AUD_HandleIterator i = m_playingSounds->begin();
i != m_playingSounds->end(); i++)
{
@@ -693,16 +711,20 @@
m_pausedSounds->push_back(*i);
alSourcePause((*i)->source);
m_playingSounds->erase(i);
- unlock();
- return true;
+ result = true;
+ break;
}
}
+
unlock();
- return false;
+
+ return result;
}
bool AUD_OpenALDevice::resume(AUD_Handle* handle)
{
+ bool result = false;
+
lock();
// only songs that are paused can be resumed
@@ -714,19 +736,24 @@
m_playingSounds->push_back(*i);
start();
m_pausedSounds->erase(i);
- unlock();
- return true;
+ result = true;
+ break;
}
}
+
unlock();
- return false;
+
+ return result;
}
bool AUD_OpenALDevice::stop(AUD_Handle* handle)
{
AUD_OpenALHandle* sound;
+ bool result = false;
+
lock();
+
for(AUD_HandleIterator i = m_playingSounds->begin();
i != m_playingSounds->end(); i++)
{
@@ -741,51 +768,60 @@
}
delete *i; AUD_DELETE("handle")
m_playingSounds->erase(i);
- unlock();
- return true;
+ result = true;
+ break;
}
}
- for(AUD_HandleIterator i = m_pausedSounds->begin();
- i != m_pausedSounds->end(); i++)
+ if(!result)
{
- if(*i == handle)
+ for(AUD_HandleIterator i = m_pausedSounds->begin();
+ i != m_pausedSounds->end(); i++)
{
- sound = *i;
- alDeleteSources(1, &sound->source);
- if(!sound->isBuffered)
+ if(*i == handle)
{
- delete sound->reader; AUD_DELETE("reader")
- alDeleteBuffers(AUD_OPENAL_CYCLE_BUFFERS, sound->buffers);
+ sound = *i;
+ alDeleteSources(1, &sound->source);
+ if(!sound->isBuffered)
+ {
+ delete sound->reader; AUD_DELETE("reader")
+ alDeleteBuffers(AUD_OPENAL_CYCLE_BUFFERS, sound->buffers);
+ }
+ delete *i; AUD_DELETE("handle")
+ m_pausedSounds->erase(i);
+ result = true;
+ break;
}
- delete *i; AUD_DELETE("handle")
- m_pausedSounds->erase(i);
- unlock();
- return true;
}
}
+
unlock();
- return false;
+
+ return result;
}
bool AUD_OpenALDevice::setKeep(AUD_Handle* handle, bool keep)
{
+ bool result = false;
+
lock();
+
if(isValid(handle))
{
((AUD_OpenALHandle*)handle)->keep = keep;
- unlock();
- return true;
+ result = true;
}
+
unlock();
- return false;
+
+ return result;
}
bool AUD_OpenALDevice::sendMessage(AUD_Handle* handle, AUD_Message &message)
{
+ bool result = false;
+
lock();
- bool result = false;
-
if(handle == 0)
{
for(AUD_HandleIterator i = m_playingSounds->begin();
@@ -800,12 +836,16 @@
else if(isValid(handle))
if(!((AUD_OpenALHandle*)handle)->isBuffered)
result = ((AUD_OpenALHandle*)handle)->reader->notify(message);
+
unlock();
+
return result;
}
bool AUD_OpenALDevice::seek(AUD_Handle* handle, float position)
{
+ bool result = false;
+
lock();
if(isValid(handle))
@@ -857,20 +897,19 @@
alSourceRewind(alhandle->source);
}
}
- unlock();
- return true;
+ result = true;
}
unlock();
- return false;
+ return result;
}
float AUD_OpenALDevice::getPosition(AUD_Handle* handle)
{
+ float position = 0.0;
+
lock();
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list