Commit: c3c2a3bbe86dc400d4f5a6194f8d7c28624af231
Author: Antony Riakiotakis
Date:   Mon Mar 16 11:45:59 2015 +0100
Branches: gooseberry
https://developer.blender.org/rBc3c2a3bbe86dc400d4f5a6194f8d7c28624af231

Revert "Attempted fix for OpenAL synchronization."

This reverts commit d10e80fe792c1c8f00c9c7ce4409002a4515570d.

===================================================================

M       intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
M       intern/audaspace/OpenAL/AUD_OpenALDevice.h
M       source/blender/blenkernel/intern/sound.c

===================================================================

diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp 
b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
index 434928c..d055c13 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
@@ -97,7 +97,7 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::pause(bool keep)
        return false;}
 
 AUD_OpenALDevice::AUD_OpenALHandle::AUD_OpenALHandle(AUD_OpenALDevice* device, 
ALenum format, boost::shared_ptr<AUD_IReader> reader, bool keep) :
-       m_isBuffered(false), m_reader(reader), m_keep(keep), m_format(format), 
m_current(0), m_bytepos(0),
+       m_isBuffered(false), m_reader(reader), m_keep(keep), m_format(format), 
m_current(0),
        m_eos(false), m_loopcount(0), m_stop(NULL), m_stop_data(NULL), 
m_status(AUD_STATUS_PLAYING),
        m_device(device)
 {
@@ -208,8 +208,6 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::stop()
        if(!m_isBuffered)
                alDeleteBuffers(CYCLE_BUFFERS, m_buffers);
 
-       m_bytepos = 0;
-
        for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != 
m_device->m_playingSounds.end(); it++)
        {
                if(it->get() == this)
@@ -271,8 +269,7 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float 
position)
                alSourcef(m_source, AL_SEC_OFFSET, position);
        else
        {
-               int offset = (int)(position * m_reader->getSpecs().rate);
-               m_reader->seek(offset);
+               m_reader->seek((int)(position * m_reader->getSpecs().rate));
                m_eos = false;
 
                ALint info;
@@ -318,14 +315,10 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float 
position)
                                        m_eos = false;
 
                                alSourceQueueBuffers(m_source, CYCLE_BUFFERS, 
m_buffers);
-                               m_bytepos = offset;
                        }
 
                        alSourceRewind(m_source);
                }
-               else {
-                       m_bytepos = offset;
-               }
        }
 
        if(m_status == AUD_STATUS_STOPPED)
@@ -351,7 +344,8 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getPosition()
        if(!m_isBuffered)
        {
                AUD_Specs specs = m_reader->getSpecs();
-               position += (m_bytepos) / specs.rate;
+               position += (m_reader->getPosition() - m_device->m_buffersize *
+                                        CYCLE_BUFFERS) / (float)specs.rate;
        }
 
        return position;
@@ -956,7 +950,6 @@ void AUD_OpenALDevice::updateStreams()
 
                                                                // unqueue 
buffer (warning: this might fail for slow early returning sources (none exist 
so far) if the buffer was not queued due to recent changes - has to be tested)
                                                                
alSourceUnqueueBuffers(sound->m_source, 1, &sound->m_buffers[sound->m_current]);
-                                                               
sound->m_bytepos += length;
                                                                ALenum err;
                                                                if((err = 
alGetError()) != AL_NO_ERROR)
                                                                {
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.h 
b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
index 142d482..f0e4782 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.h
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
@@ -75,8 +75,6 @@ private:
                /// The first buffer to be read next.
                int m_current;
 
-               /// Amount of buffers already passed to OpenAL for processing. 
Used for proper timing
-               unsigned int m_bytepos;
                /// Whether the stream doesn't return any more data.
                bool m_eos;
 
diff --git a/source/blender/blenkernel/intern/sound.c 
b/source/blender/blenkernel/intern/sound.c
index 6acd727..b9d7066 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -621,7 +621,7 @@ void sound_seek_scene(struct Main *bmain, struct Scene 
*scene)
                }
        }
 
-       if ((scene->audio.flag & AUDIO_SCRUB) && !animation_playing) {
+       if (scene->audio.flag & AUDIO_SCRUB && !animation_playing) {
                if (scene->audio.flag & AUDIO_SYNC) {
                        AUD_seek(scene->sound_scene_handle, cur_time);
                        AUD_seekSequencer(scene->sound_scene_handle, cur_time);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to