traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src/core MonoReader.cpp


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/core MonoReader.cpp
Date: Tue, 22 May 2007 21:14:19 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/05/22 21:14:19

Modified files:
        src/core       : MonoReader.cpp 

Log message:
        * fix bug in seek code (didn't calculate relative position to file!) 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/MonoReader.cpp?cvsroot=traverso&r1=1.10&r2=1.11

Patches:
Index: MonoReader.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/MonoReader.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- MonoReader.cpp      18 May 2007 09:42:54 -0000      1.10
+++ MonoReader.cpp      22 May 2007 21:14:19 -0000      1.11
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: MonoReader.cpp,v 1.10 2007/05/18 09:42:54 r_sijrier Exp $
+$Id: MonoReader.cpp,v 1.11 2007/05/22 21:14:19 r_sijrier Exp $
 */
 
 
@@ -195,10 +195,9 @@
                return 0;
        }
 
-
        if (start != m_rbRelativeFileReadPos) {
                int available = m_buffer->read_space();
-               if ( (start > m_rbRelativeFileReadPos) && ( 
(m_rbRelativeFileReadPos + available) > (start + count) ) ) {
+               if ( (start > m_rbRelativeFileReadPos) && 
(m_rbRelativeFileReadPos + available) > (start + count)) {
                        int advance = start - m_rbRelativeFileReadPos;
                        if (available < advance)
                                printf("available < advance !!!!!!!\n");
@@ -240,8 +239,11 @@
 {
        Q_ASSERT(m_clip);
        
+       // calculate position relative to the file!
+       position -= (m_clip->get_track_start_frame() + 
m_clip->get_source_start_frame());
+       
        if (m_rbFileReadPos == position) {
-//             printf("ringbuffer allready at position %d\n", position);
+               printf("ringbuffer allready at position %d\n", position);
                return;
        }
 
@@ -255,7 +257,7 @@
        // if not, fill the buffer from the earliest point this clip
        // will come into play.
        if (fileposition < (int)m_clip->get_source_start_frame()) {
-//             printf("not seeking to %d, but too %d\n\n", 
fileposition,m_clip->get_source_start_frame()); 
+//             printf("not seeking to %ld, but too %d\n\n", 
fileposition,m_clip->get_source_start_frame()); 
                // Song's start from 0, this makes a period start from
                // 0 - 1023 for example, the nframes is 1024!
                // Setting a songs new position is on 1024, and NOT 
@@ -331,7 +333,7 @@
 
 void MonoReader::start_resync( nframes_t position )
 {
-//     printf("starting resync!\n");
+       printf("starting resync!\n");
        m_syncPos = position;
        m_rbReady = 0;
        m_needSync = 1;
@@ -339,11 +341,11 @@
 
 void MonoReader::finish_resync()
 {
-//     printf("sync finished\n");
+       printf("sync finished\n");
        m_needSync = 0;
        m_bufferUnderRunDetected = 0;
        m_rbReady = 1;
-       m_syncInProgress = false;
+       m_syncInProgress = 0;
 }
 
 void MonoReader::sync(audio_sample_t* framebuffer)
@@ -355,7 +357,7 @@
        
        if (!m_syncInProgress) {
                rb_seek_to_file_position(m_syncPos);
-               m_syncInProgress = true;
+               m_syncInProgress = 1;
        }
        
        // Currently, we fill the buffer completely.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]