traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src core/AudioClip.cpp core/AudioSourc...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src core/AudioClip.cpp core/AudioSourc...
Date: Thu, 03 May 2007 10:38:30 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/05/03 10:38:29

Modified files:
        src/core       : AudioClip.cpp AudioSource.cpp AudioSource.h 
                         Track.cpp WriteSource.cpp WriteSource.h 
        src/traverso/widgets: ResourcesWidget.cpp 

Log message:
        * Set a (recording) WriteSources id, and reuse for the resulting 
readsource.
        The id is used in the filename as well to ensure unique filenames!
        * Naming of recorded clips changed, but it still s***s

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioSource.cpp?cvsroot=traverso&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioSource.h?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Track.cpp?cvsroot=traverso&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/WriteSource.cpp?cvsroot=traverso&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/WriteSource.h?cvsroot=traverso&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/widgets/ResourcesWidget.cpp?cvsroot=traverso&r1=1.6&r2=1.7

Patches:
Index: core/AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- core/AudioClip.cpp  30 Apr 2007 13:49:59 -0000      1.85
+++ core/AudioClip.cpp  3 May 2007 10:38:29 -0000       1.86
@@ -506,6 +506,9 @@
                channelcount = 1;
        }
 
+       qint64 newsourceid = create_id();
+       QString sourceid = QString::number(newsourceid);
+       
        for (int chan=0; chan<captureBus->get_channel_count(); chan++) {
                if (chan == 0) {
                        if ( ! m_track->capture_left_channel() ) {
@@ -537,19 +540,15 @@
                m_exportSpec->end_frame = 0;
                m_exportSpec->total_frames = 0;
                m_exportSpec->blocksize = audiodevice().get_buffer_size();
-
-               QString songid = QString::number(m_song->get_id())  + "_";
-               if (m_song->get_id() < 10)
-                       songid.prepend("0");
-               songid.prepend( "Song" );
-
-               m_exportSpec->name = songid + m_name;
-
+               m_exportSpec->name = m_name + "-" + sourceid;
                m_exportSpec->dataF = captureBus->get_buffer( chan, 
audiodevice().get_buffer_size());
 
                WriteSource* ws = new WriteSource(m_exportSpec, channelnumber, 
channelcount);
                ws->set_process_peaks( true );
                ws->set_recording( true );
+               // We had to create the id before creating the writesource, so 
+               // explicitely set it now, so it can be re-used for the 
resulting ReadSource!
+               ws->set_id(newsourceid);
 
                connect(ws, SIGNAL(exportFinished( WriteSource* )), 
                        this, SLOT(finish_write_source( WriteSource* )));
@@ -665,11 +664,13 @@
 
        QString dir;
        QString name;
+       qint64 id;
        
        if (writeSources.contains(ws)) {
                writeSources.removeAll(ws);
                dir = ws->get_dir();
                name = ws->get_name();
+               id = ws->get_id();
                if (ws->m_peak->finish_processing() < 0) {
                        PERROR("write source peak::finish_processing() 
failed!");
                }
@@ -697,6 +698,9 @@
                                wasRecording );
                
                if (rs) {
+                       // Re-use the writesources id for this readsource, so 
the filename
+                       // and the readsources id match!
+                       rs->set_id(id);
                        // Reset the lenght, so the set_audio_sources() call 
will get the 
                        // lenght from the ReadSource, so we're 100% sure the 
correct lenght
                        // will be used!

Index: core/AudioSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioSource.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- core/AudioSource.cpp        29 Mar 2007 12:07:40 -0000      1.15
+++ core/AudioSource.cpp        3 May 2007 10:38:29 -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: AudioSource.cpp,v 1.15 2007/03/29 12:07:40 r_sijrier Exp $
+$Id: AudioSource.cpp,v 1.16 2007/05/03 10:38:29 r_sijrier Exp $
 */
 
 
@@ -38,7 +38,7 @@
 AudioSource::AudioSource(const QString& dir, const QString& name)
        : m_dir(dir)
        , m_name(name)
-       , m_wasRecording(false)
+       , m_wasRecording (false)
 {
        PENTERCONS;
        m_fileName = m_dir + m_name;
@@ -100,6 +100,12 @@
                m_wasRecording = true;
        }
        
+       if (m_wasRecording) {
+               m_shortName = m_name.left(m_name.length() - 20);
+       } else {
+               m_shortName = m_name;
+       }
+       
        return 1;
 }
 
@@ -164,5 +170,15 @@
        m_channelCount = count;
 }
 
+void AudioSource::set_id(qint64 id)
+{
+       m_id = id;
+}
+
+QString AudioSource::get_short_name() const
+{
+       return m_shortName;
+}
 
 // eof
+

Index: core/AudioSource.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioSource.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- core/AudioSource.h  29 Mar 2007 11:09:38 -0000      1.12
+++ core/AudioSource.h  3 May 2007 10:38:29 -0000       1.13
@@ -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: AudioSource.h,v 1.12 2007/03/29 11:09:38 r_sijrier Exp $
+$Id: AudioSource.h,v 1.13 2007/05/03 10:38:29 r_sijrier Exp $
 */
 
 #ifndef AUDIOSOURCE_H
@@ -53,12 +53,14 @@
        QString get_filename() const;
        QString get_dir() const;
        QString get_name() const;
+       QString get_short_name() const;
        qint64 get_id() const;
        int get_rate() const;
        uint get_channel_count() const;
        int get_bit_depth() const;
        
        void set_channel_count(uint count);
+       void set_id(qint64 id);
        
 protected:
        uint            m_channelCount;
@@ -67,6 +69,7 @@
        QString         m_dir;
        qint64          m_id;
        QString         m_name;
+       QString         m_shortName;
        uint            m_origBitDepth;
        QString         m_fileName;
        nframes_t       m_length;

Index: core/Track.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Track.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- core/Track.cpp      23 Apr 2007 11:52:24 -0000      1.51
+++ core/Track.cpp      3 May 2007 10:38:29 -0000       1.52
@@ -306,8 +306,9 @@
                return 0;
        }
        
-       QString name = "Audio-" + 
QString::number(m_song->get_track_index(m_id)) +
-                       "-take-" + QString::number(++numtakes);
+       QString name =  "s-" + 
QString::number(pm().get_project()->get_song_index(m_song->get_id())) +
+                       "_track-" + 
QString::number(m_song->get_track_index(m_id)) +
+                       "_take-" + QString::number(++numtakes);
        
        AudioClip* clip = resources_manager()->new_audio_clip(name);
        clip->set_song(m_song);

Index: core/WriteSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/WriteSource.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- core/WriteSource.cpp        30 Apr 2007 18:25:14 -0000      1.18
+++ core/WriteSource.cpp        3 May 2007 10:38:29 -0000       1.19
@@ -476,3 +476,4 @@
 }
 
 //eof
+

Index: core/WriteSource.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/WriteSource.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- core/WriteSource.h  17 Apr 2007 19:56:46 -0000      1.11
+++ core/WriteSource.h  3 May 2007 10:38: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: WriteSource.h,v 1.11 2007/04/17 19:56:46 r_sijrier Exp $
+$Id: WriteSource.h,v 1.12 2007/05/03 10:38:29 r_sijrier Exp $
 */
 
 #ifndef WRITESOURCE_H

Index: traverso/widgets/ResourcesWidget.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/widgets/ResourcesWidget.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- traverso/widgets/ResourcesWidget.cpp        1 May 2007 21:11:42 -0000       
1.6
+++ traverso/widgets/ResourcesWidget.cpp        3 May 2007 10:38:29 -0000       
1.7
@@ -117,10 +117,10 @@
        foreach(ReadSource* rs, 
m_project->get_audiosource_manager()->get_all_audio_sources()) {
                QTreeWidgetItem* item = new 
QTreeWidgetItem(audioFileTreeWidget);
                QString duration = frame_to_ms(rs->get_nframes(), 44100);
-               item->setText(0, rs->get_name());
+               item->setText(0, rs->get_short_name());
                item->setText(1, duration);
                item->setData(0, Qt::UserRole, rs->get_id());
-               item->setToolTip(0, rs->get_name() + "   " + duration);
+               item->setToolTip(0, rs->get_short_name() + "   " + duration);
                if (!rs->get_ref_count()) {
                        item->setForeground(0, QColor(Qt::lightGray));
                        item->setForeground(1, QColor(Qt::lightGray));




reply via email to

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