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 core/Export.h core...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src core/Export.cpp core/Export.h core...
Date: Tue, 08 May 2007 01:15:59 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/05/08 01:15:59

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

Log message:
        * Make export buffer size independent of audiodevices' buffer size.
        * correctly breakout of song exporting if user hit stop button
        * resume playback if export started during playback

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.cpp?cvsroot=traverso&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.h?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Project.cpp?cvsroot=traverso&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.h?cvsroot=traverso&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/ExportWidget.cpp?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/ExportWidget.h?cvsroot=traverso&r1=1.4&r2=1.5

Patches:
Index: core/Export.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- core/Export.cpp     3 May 2007 18:12:07 -0000       1.4
+++ core/Export.cpp     8 May 2007 01:15:59 -0000       1.5
@@ -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.4 2007/05/03 18:12:07 r_sijrier Exp $
+    $Id: Export.cpp,v 1.5 2007/05/08 01:15:59 r_sijrier Exp $
 */
 
 #include "Export.h"
@@ -58,6 +58,8 @@
        extension = "";
        
        allSongs = false;
+       stop = false;
+       breakout = false;
        isRecording = -1;
        exportdir = "";
        name = "";

Index: core/Export.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- core/Export.h       3 May 2007 18:12:07 -0000       1.5
+++ core/Export.h       8 May 2007 01:15:59 -0000       1.6
@@ -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.5 2007/05/03 18:12:07 r_sijrier Exp $
+$Id: Export.h,v 1.6 2007/05/08 01:15:59 r_sijrier Exp $
 */
 
 #ifndef EXPORT_H
@@ -67,6 +67,7 @@
 
        int             progress;  /* audio thread sets this */
        bool            stop;      /* UI sets this */
+       bool            breakout;
        bool            running;   /* audio thread sets to false when export is 
done */
 
        int             status;
@@ -79,6 +80,8 @@
        int             renderpass;
        float           peakvalue;
        float           normvalue;
+       bool            resumeTransport;
+       nframes_t       resumeTransportFrame;
 };
 
 

Index: core/Project.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Project.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- core/Project.cpp    3 May 2007 22:43:12 -0000       1.37
+++ core/Project.cpp    8 May 2007 01:15:59 -0000       1.38
@@ -430,6 +430,7 @@
        spec->progress = 0;
        spec->running = true;
        spec->stop = false;
+       spec->breakout = false;
 
        ExportThread* exportThread =  new ExportThread(this, spec);
        exportThread->start();
@@ -441,7 +442,7 @@
 {
        PMESG("Starting export, rate is %d bitdepth is %d", spec->sample_rate, 
spec->data_width );
 
-       spec->blocksize = audiodevice().get_buffer_size();
+       spec->blocksize = 32768;
 
        spec->dataF = new audio_sample_t[spec->blocksize * spec->channels];
 
@@ -464,6 +465,7 @@
        foreach(Song* song, songsToRender) {
                PMESG("Starting export for song %lld", song->get_id());
                emit exportStartedForSong(song);
+               spec->resumeTransport = false;
 
                if (spec->normalize) {
                        spec->peakvalue = 0.0;
@@ -496,6 +498,16 @@
                
                while(song->render(spec) > 0) {}
 
+               song->set_transport_pos(spec->resumeTransportFrame);
+               if (spec->resumeTransport) {
+                       Command* k;
+                       if (!QMetaObject::invokeMethod(song, "go",  
Qt::QueuedConnection)) {
+                               printf("Invoking Song::go() failed\n");
+                       }
+               }
+               if (spec->breakout) {
+                       break;
+               }
                renderedSongs++;
        }
 

Index: core/Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- core/Song.cpp       7 May 2007 21:29:20 -0000       1.86
+++ core/Song.cpp       8 May 2007 01:15:59 -0000       1.87
@@ -129,16 +129,16 @@
        connect(this, SIGNAL(seekStart(uint)), m_diskio, SLOT(seek(uint)), 
Qt::QueuedConnection);
        connect(&audiodevice(), SIGNAL(clientRemoved(Client*)), this, SLOT 
(audiodevice_client_removed(Client*)));
        connect(&audiodevice(), SIGNAL(started()), this, 
SLOT(audiodevice_started()));
-       connect(&audiodevice(), SIGNAL(driverParamsChanged()), this, 
SLOT(resize_buffer()), Qt::DirectConnection);
+       connect(&audiodevice(), SIGNAL(driverParamsChanged()), this, 
SLOT(audiodevice_params_changed()), Qt::DirectConnection);
        connect(m_diskio, SIGNAL(seekFinished()), this, SLOT(seek_finished()), 
Qt::QueuedConnection);
        connect (m_diskio, SIGNAL(readSourceBufferUnderRun()), this, 
SLOT(handle_diskio_readbuffer_underrun()));
        connect (m_diskio, SIGNAL(writeSourceBufferOverRun()), this, 
SLOT(handle_diskio_writebuffer_overrun()));
        connect(this, SIGNAL(transferStarted()), m_diskio, SLOT(start_io()));
        connect(this, SIGNAL(transferStopped()), m_diskio, SLOT(stop_io()));
 
-       mixdown = new audio_sample_t[audiodevice().get_buffer_size()];
-       gainbuffer = new audio_sample_t[audiodevice().get_buffer_size()];
+       mixdown = gainbuffer = 0;
        m_masterOut = new AudioBus("Master Out", 2);
+       resize_buffer(false, audiodevice().get_buffer_size());
        m_hs = new QUndoStack(pm().get_undogroup());
        set_history_stack(m_hs);
        m_acmanager = new AudioClipManager(this);
@@ -312,7 +312,11 @@
 int Song::prepare_export(ExportSpecification* spec)
 {
        PENTER;
+       
+       spec->resumeTransportFrame = transportFrame;
+       
        if (transport) {
+               spec->resumeTransport = true;
                stopTransport = true;
        }
 
@@ -381,6 +385,8 @@
                m_exportSource = new WriteSource(spec);
        }
 
+       resize_buffer(false, spec->blocksize);
+
        return 1;
 }
 
@@ -388,6 +394,7 @@
 {
        m_exportSource->finish_export();
        delete m_exportSource;
+       resize_buffer(false, audiodevice().get_buffer_size());
        return 0;
 }
 
@@ -942,18 +949,29 @@
        }
 }
 
-void Song::resize_buffer( )
+void Song::resize_buffer(bool updateArmStatus, nframes_t size)
 {
+       if (mixdown)
        delete [] mixdown;
+       if (gainbuffer)
        delete [] gainbuffer;
-       mixdown = new audio_sample_t[audiodevice().get_buffer_size()];
-       gainbuffer = new audio_sample_t[audiodevice().get_buffer_size()];
+       mixdown = new audio_sample_t[size];
+       gainbuffer = new audio_sample_t[size];
+       m_masterOut->set_buffer_size(size);
+       
+       if (updateArmStatus) {
        foreach(Track* track, m_tracks) {
                AudioBus* bus = 
audiodevice().get_capture_bus(track->get_bus_in().toAscii());
                if (bus && track->armed()) {
                        bus->set_monitor_peaks(true);
                }
        }
+       }
+}
+
+void Song::audiodevice_params_changed()
+{
+       resize_buffer(true, audiodevice().get_buffer_size());
 }
 
 int Song::get_bitdepth( )

Index: core/Song.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- core/Song.h 7 May 2007 18:59:00 -0000       1.48
+++ core/Song.h 8 May 2007 01:15:59 -0000       1.49
@@ -184,6 +184,7 @@
 
        int finish_audio_export();
        void start_seek();
+       void resize_buffer(bool updateArmStatus, nframes_t size);
 
        Track* create_track();
        
@@ -193,7 +194,7 @@
        void seek_finished();
        void audiodevice_client_removed(Client* );
        void audiodevice_started();
-       void resize_buffer();
+       void audiodevice_params_changed();
        void set_gain(float gain);
        
        float get_gain() const;

Index: traverso/ExportWidget.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/ExportWidget.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- traverso/ExportWidget.cpp   7 May 2007 22:21:08 -0000       1.12
+++ traverso/ExportWidget.cpp   8 May 2007 01:15:59 -0000       1.13
@@ -40,6 +40,7 @@
 
 ExportWidget::ExportWidget( QWidget * parent )
        : QDialog(parent)
+       , spec(0)
 {
         setupUi(this);
        
@@ -47,20 +48,7 @@
        m_layout->setMargin(0);
        setLayout(m_layout);
 
-        m_project = pm().get_project();
-
-        if (!m_project) {
-                info().information(tr("No project loaded, to export a project, 
load it first!"));
-        } else {
-                spec = new ExportSpecification;
-                spec->exportdir = m_project->get_root_dir() + "/Export/";
-                exportDirName->setText(spec->exportdir);
-               
-               connect(m_project, SIGNAL(songExportProgressChanged(int)), 
this, SLOT(update_song_progress(int)));
-                connect(m_project, SIGNAL(overallExportProgressChanged(int)), 
this, SLOT(update_overall_progress(int)));
-                connect(m_project, SIGNAL(exportFinished()), this, 
SLOT(render_finished()));
-                connect(m_project, SIGNAL(exportStartedForSong(Song*)), this, 
SLOT (set_exporting_song(Song*)));
-        }
+       set_project(pm().get_project());
 
         bitdepthComboBox->insertItem(0, "8");
         bitdepthComboBox->insertItem(1, "16");
@@ -114,6 +102,7 @@
 
        connect(buttonBox, SIGNAL(accepted()), this, 
SLOT(on_exportStartButton_clicked()));
        connect(buttonBox, SIGNAL(rejected()), this, 
SLOT(on_cancelButton_clicked()));
+       connect(&pm(), SIGNAL(projectLoaded(Project*)), this, 
SLOT(set_project(Project*)));
 }
 
 ExportWidget::~ ExportWidget( )
@@ -255,6 +244,7 @@
 {
         show_settings_view();
         spec->stop = true;
+       spec->breakout = true;
 }
 
 
@@ -339,7 +329,32 @@
        buttonBox->setEnabled(true);
 }
 
+void ExportWidget::set_project(Project * project)
+{
+       m_project = project;
+       if (! m_project) {
+               info().information(tr("No project loaded, to export a project, 
load it first!"));
+               setEnabled(false);
+               if (spec) {
+                       delete spec;
+                       spec = 0;
+               }
+       } else {
+               setEnabled(true);
+               if (spec) {
+                       delete spec;
+                       spec = 0;
+               }
+               spec = new ExportSpecification;
+               spec->exportdir = m_project->get_root_dir() + "/Export/";
+               exportDirName->setText(spec->exportdir);
 
+               connect(m_project, SIGNAL(songExportProgressChanged(int)), 
this, SLOT(update_song_progress(int)));
+               connect(m_project, SIGNAL(overallExportProgressChanged(int)), 
this, SLOT(update_overall_progress(int)));
+               connect(m_project, SIGNAL(exportFinished()), this, 
SLOT(render_finished()));
+               connect(m_project, SIGNAL(exportStartedForSong(Song*)), this, 
SLOT (set_exporting_song(Song*)));
+       }
+}
 
 //eof
 

Index: traverso/ExportWidget.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/ExportWidget.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- traverso/ExportWidget.h     3 May 2007 14:05:00 -0000       1.4
+++ traverso/ExportWidget.h     8 May 2007 01:15:59 -0000       1.5
@@ -48,6 +48,7 @@
         void show_settings_view();
 
 private slots:
+       void set_project(Project* project);
         void update_song_progress(int progress);
         void update_overall_progress(int progress);
         void render_finished();




reply via email to

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