traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src/core Export.cpp Export.h Project.c...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/core Export.cpp Export.h Project.c...
Date: Fri, 12 Oct 2007 10:06:30 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/10/12 10:06:30

Modified files:
        src/core       : Export.cpp Export.h Project.cpp Song.cpp Song.h 

Log message:
        * fixed threading issue with resume playback support after an export 
(its highly unlikely though that this issue ever would cause a problem, but 
this is 'more correct' )

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.cpp?cvsroot=traverso&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.h?cvsroot=traverso&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Project.cpp?cvsroot=traverso&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.146&r2=1.147
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.h?cvsroot=traverso&r1=1.70&r2=1.71

Patches:
Index: Export.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- Export.cpp  26 Sep 2007 20:46:32 -0000      1.11
+++ Export.cpp  12 Oct 2007 10:06:29 -0000      1.12
@@ -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: Export.cpp,v 1.11 2007/09/26 20:46:32 r_sijrier Exp $
+    $Id: Export.cpp,v 1.12 2007/10/12 10:06:29 r_sijrier Exp $
 */
 
 #include "Export.h"
@@ -32,6 +32,7 @@
 {
         m_project = project;
         m_spec  = specification;
+       specification->thread = this;
 }
 
 void ExportThread::run( )

Index: Export.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- Export.h    26 Sep 2007 20:46:32 -0000      1.15
+++ Export.h    12 Oct 2007 10:06:30 -0000      1.16
@@ -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: Export.h,v 1.15 2007/09/26 20:46:32 r_sijrier Exp $
+$Id: Export.h,v 1.16 2007/10/12 10:06:30 r_sijrier Exp $
 */
 
 #ifndef EXPORT_H
@@ -33,6 +33,7 @@
 #include "gdither.h"
 
 class Project;
+class ExportThread;
 
 struct ExportSpecification
 {
@@ -88,6 +89,8 @@
        TimeRef         resumeTransportLocation;
        bool            renderfinished;
        bool            isCdExport;
+       
+       ExportThread*   thread;
 };
 
 
@@ -95,16 +98,20 @@
 {
        Q_OBJECT
 
-public:
+       public:
        ExportThread(Project* project, ExportSpecification* spec);
        ~ExportThread()
        {}
 
        void run();
+               void sleep_for(uint msecs) {
+                       msleep(msecs);
+               }
 
-private:
+       private:
        Project*                m_project;
        ExportSpecification*    m_spec;
 };
 
+
 #endif

Index: Project.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Project.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- Project.cpp 11 Oct 2007 13:01:55 -0000      1.59
+++ Project.cpp 12 Oct 2007 10:06:30 -0000      1.60
@@ -595,7 +595,9 @@
                
                while(song->render(spec) > 0) {}
                
-               song->set_transport_pos(spec->resumeTransportLocation);
+               if (!QMetaObject::invokeMethod(song, "set_transport_pos",  
Qt::QueuedConnection, Q_ARG(TimeRef, spec->resumeTransportLocation))) {
+                       printf("Invoking Song::set_transport_pos() failed\n");
+               }
                if (spec->resumeTransport) {
                        if (!QMetaObject::invokeMethod(song, "start_transport", 
 Qt::QueuedConnection)) {
                                printf("Invoking Song::start_transport() 
failed\n");

Index: Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -b -r1.146 -r1.147
--- Song.cpp    12 Oct 2007 08:52:13 -0000      1.146
+++ Song.cpp    12 Oct 2007 10:06:30 -0000      1.147
@@ -343,7 +343,15 @@
                if (is_transport_rolling()) {
                        spec->resumeTransport = true;
                        // When transport is rolling, this equals stopping the 
transport!
-                       start_transport();
+                       // prepare_export() is called from another thread, so 
use a queued connection
+                       // to call the function in the correct thread!
+                       if (!QMetaObject::invokeMethod(this, "start_transport", 
 Qt::QueuedConnection)) {
+                               printf("Invoking Song::start_transport() 
failed\n");
+                               return -1;
+                       }
+                       // wait a number (5) of audiodevice process cycles to 
be sure we really stopped transport
+                       uint msecs = (audiodevice().get_buffer_size() * 5 * 
1000) / audiodevice().get_sample_rate();
+                       spec->thread->sleep_for(msecs);
                }
                
                m_rendering = true;

Index: Song.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- Song.h      12 Oct 2007 08:52:13 -0000      1.70
+++ Song.h      12 Oct 2007 10:06:30 -0000      1.71
@@ -111,7 +111,6 @@
        void set_first_visible_frame(nframes_t pos);
        void set_title(const QString& sTitle);
        void set_work_at(const TimeRef& location);
-       void set_transport_pos(TimeRef location);
        void set_hzoom(int hzoom);
        void set_snapping(bool snap);
        void set_scrollbar_xy(int x, int y) {m_sbx = x; m_sby = y;}
@@ -222,6 +221,7 @@
        void audiodevice_started();
        void audiodevice_params_changed();
        void set_gain(float gain);
+       void set_transport_pos(TimeRef location);
        
        float get_gain() const;
 




reply via email to

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