traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src audiofileio/encode/SFAudioWriter.c...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src audiofileio/encode/SFAudioWriter.c...
Date: Wed, 26 Sep 2007 20:46:34 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/09/26 20:46:34

Modified files:
        src/audiofileio/encode: SFAudioWriter.cpp 
        src/commands   : AudioClipExternalProcessing.cpp Fade.cpp 
        src/core       : AudioClip.cpp Export.cpp Export.h Marker.cpp 
                         Marker.h Peak.cpp Peak.h Song.cpp Utils.cpp 
                         Utils.h WriteSource.cpp 
        src/traverso/dialogs: AudioClipEditDialog.cpp 
        src/traverso/songcanvas: TimeLineView.cpp TimeLineView.h 
        src/traverso/widgets: InfoWidgets.cpp 

Log message:
        * nframes_t to TimeRef cleanup, conversion, fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/audiofileio/encode/SFAudioWriter.cpp?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/AudioClipExternalProcessing.cpp?cvsroot=traverso&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Fade.cpp?cvsroot=traverso&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.136&r2=1.137
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.cpp?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Export.h?cvsroot=traverso&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Marker.cpp?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Marker.h?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.cpp?cvsroot=traverso&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.h?cvsroot=traverso&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.139&r2=1.140
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Utils.cpp?cvsroot=traverso&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Utils.h?cvsroot=traverso&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/WriteSource.cpp?cvsroot=traverso&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/dialogs/AudioClipEditDialog.cpp?cvsroot=traverso&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TimeLineView.cpp?cvsroot=traverso&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TimeLineView.h?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/widgets/InfoWidgets.cpp?cvsroot=traverso&r1=1.43&r2=1.44

Patches:
Index: audiofileio/encode/SFAudioWriter.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/audiofileio/encode/SFAudioWriter.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- audiofileio/encode/SFAudioWriter.cpp        24 Sep 2007 00:57:51 -0000      
1.6
+++ audiofileio/encode/SFAudioWriter.cpp        26 Sep 2007 20:46:31 -0000      
1.7
@@ -95,7 +95,7 @@
        m_sfinfo.frames = 48000*100;
        m_sfinfo.samplerate = m_rate;
        m_sfinfo.channels = m_channels;
-       //m_sfinfo.frames = m_spec->end_frame - m_spec->start_frame + 1;
+       //m_sfinfo.frames = m_spec->endLocation - m_spec->startLocation + 1;
        
        m_sf = sf_open(m_fileName.toUtf8().data(), SFM_WRITE, &m_sfinfo);
        if (m_sf == 0) {

Index: commands/AudioClipExternalProcessing.cpp
===================================================================
RCS file: 
/sources/traverso/traverso/src/commands/AudioClipExternalProcessing.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- commands/AudioClipExternalProcessing.cpp    24 Sep 2007 00:57:50 -0000      
1.29
+++ commands/AudioClipExternalProcessing.cpp    26 Sep 2007 20:46:32 -0000      
1.30
@@ -57,9 +57,9 @@
                DecodeBuffer decodebuffer;
        
                ExportSpecification* spec = new ExportSpecification();
-               spec->start_frame = 0;
-               spec->end_frame = m_readsource->get_nframes();
-               spec->total_frames = spec->end_frame;
+               spec->startLocation = 0;
+               spec->endLocation = TimeRef(m_readsource->get_nframes(), 
m_readsource->get_rate());
+               spec->totalTime = spec->endLocation;
                spec->pos = 0;
                spec->isRecording = false;
        
@@ -82,7 +82,8 @@
                }
        
                do {
-                       nframes_t this_nframes = 
std::min((nframes_t)(spec->end_frame - spec->pos), buffersize);
+                       nframes_t diff = (spec->endLocation - 
spec->pos).to_frame(m_readsource->get_rate());
+                       nframes_t this_nframes = std::min(diff, buffersize);
                        nframes_t nframes = this_nframes;
                
                        memset (spec->dataF, 0, sizeof (spec->dataF[0]) * 
nframes * spec->channels);
@@ -99,7 +100,7 @@
                
                        spec->pos += nframes;
                        
-               } while (spec->pos != spec->total_frames);
+               } while (spec->pos != spec->totalTime);
                
                writesource->finish_export();
                delete writesource;

Index: commands/Fade.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Fade.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- commands/Fade.cpp   24 Sep 2007 16:58:37 -0000      1.22
+++ commands/Fade.cpp   26 Sep 2007 20:46:32 -0000      1.23
@@ -130,7 +130,7 @@
        
        m_curve->set_range( m_newRange );
        
-       
cpointer().get_viewport()->set_holdcursor_text(frame_to_ms_3((nframes_t)m_newRange,
 pm().get_project()->get_rate()));
+       
cpointer().get_viewport()->set_holdcursor_text(timeref_to_ms_3(m_newRange));
        
        return 1;
 }

Index: core/AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -b -r1.136 -r1.137
--- core/AudioClip.cpp  24 Sep 2007 16:58:38 -0000      1.136
+++ core/AudioClip.cpp  26 Sep 2007 20:46:32 -0000      1.137
@@ -559,9 +559,9 @@
        spec->sample_rate = audiodevice().get_sample_rate();
        spec->src_quality = SRC_SINC_MEDIUM_QUALITY;
        spec->isRecording = true;
-       spec->start_frame = 0;
-       spec->end_frame = 0;
-       spec->total_frames = 0;
+       spec->startLocation = 0;
+       spec->endLocation = 0;
+       spec->totalTime = 0;
        spec->blocksize = audiodevice().get_buffer_size();
        spec->name = m_name + "-" + sourceid;
        spec->dataF = m_captureBus->get_buffer(0, 
audiodevice().get_buffer_size());

Index: core/Export.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- core/Export.cpp     13 Aug 2007 00:01:52 -0000      1.10
+++ core/Export.cpp     26 Sep 2007 20:46:32 -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: Export.cpp,v 1.10 2007/08/13 00:01:52 benjie Exp $
+    $Id: Export.cpp,v 1.11 2007/09/26 20:46:32 r_sijrier Exp $
 */
 
 #include "Export.h"
@@ -45,15 +45,15 @@
        
        src_quality = SRC_SINC_MEDIUM_QUALITY;
        channels = -1;
-       start_frame = -1;
-       end_frame = -1;
+       startLocation = -1;
+       endLocation = -1;
        dither_type = GDitherTri;
        
        dataF = 0;
        blocksize = -1;
        data_width = -1;
        
-       total_frames = -1;
+       totalTime = -1;
        pos = -1;
        
        allSongs = false;
@@ -84,12 +84,12 @@
                return -1;
        }
        
-       if (start_frame == -1) {
+       if (startLocation == -1) {
                printf("ExportSpecification: No start frame configured!\n");
                return -1;
        }
 
-       if (end_frame == -1) {
+       if (endLocation == -1) {
                printf("ExportSpecification: No end frame configured!\n");
                return -1;
        }
@@ -109,7 +109,7 @@
                return -1;
        }
 
-       if (total_frames == -1) {
+       if (totalTime == -1) {
                printf("ExportSpecification: No total frames configured!\n");
                return -1;
        }

Index: core/Export.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Export.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- core/Export.h       10 Sep 2007 18:42:48 -0000      1.14
+++ core/Export.h       26 Sep 2007 20:46:32 -0000      1.15
@@ -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.14 2007/09/10 18:42:48 r_sijrier Exp $
+$Id: Export.h,v 1.15 2007/09/26 20:46:32 r_sijrier Exp $
 */
 
 #ifndef EXPORT_H
@@ -49,8 +49,8 @@
        int             sample_rate;
        int             src_quality;
        int             channels;
-       long            start_frame;
-       long long       end_frame;
+       TimeRef         startLocation;
+       TimeRef         endLocation;
        GDitherType     dither_type;
 
        /* used exclusively during export */
@@ -60,9 +60,9 @@
        int             blocksize;
        int             data_width;
 
-       long            total_frames;
+       TimeRef         totalTime;
+       TimeRef         pos;
        QMap<QString, QString>  extraFormat;
-       long            pos;
 
        /* shared between UI thread and audio thread */
 

Index: core/Marker.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Marker.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- core/Marker.cpp     20 Sep 2007 18:25:14 -0000      1.12
+++ core/Marker.cpp     26 Sep 2007 20:46:32 -0000      1.13
@@ -25,7 +25,7 @@
 #include "TimeLine.h"
 #include "Utils.h"
 
-Marker::Marker(TimeLine* tl, nframes_t when, Type type)
+Marker::Marker(TimeLine* tl, const TimeRef when, Type type)
        : ContextItem()
        , Snappable()
        , m_timeline(tl)

Index: core/Marker.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Marker.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- core/Marker.h       20 Sep 2007 18:25:15 -0000      1.12
+++ core/Marker.h       26 Sep 2007 20:46:32 -0000      1.13
@@ -42,7 +42,7 @@
                TEMP_ENDMARKER
        };
 
-       Marker(TimeLine* tl, nframes_t when, Type type = CDTRACK);
+       Marker(TimeLine* tl, const TimeRef when, Type type = CDTRACK);
        Marker(TimeLine* tl, const QDomNode node);
        ~Marker() {};
        

Index: core/Peak.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- core/Peak.cpp       26 Sep 2007 16:32:52 -0000      1.58
+++ core/Peak.cpp       26 Sep 2007 20:46:33 -0000      1.59
@@ -354,7 +354,7 @@
 }
 
 
-int Peak::prepare_processing()
+int Peak::prepare_processing(int rate)
 {
        PENTER;
        
@@ -394,7 +394,7 @@
                fseek(data->file, data->headerdata.peakDataOffset, SEEK_SET);
                
                data->pd = new Peak::ProcessData;
-               data->pd->stepSize = TimeRef(1, m_source->get_file_rate());
+               data->pd->stepSize = TimeRef(1, rate);
        }
        
        
@@ -582,7 +582,7 @@
 #endif
        int ret = -1;
        
-       if (prepare_processing() < 0) {
+       if (prepare_processing(m_source->get_file_rate()) < 0) {
                return ret;
        }
        

Index: core/Peak.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- core/Peak.h 20 Sep 2007 18:24:10 -0000      1.20
+++ core/Peak.h 26 Sep 2007 20:46:33 -0000      1.21
@@ -107,7 +107,7 @@
        };
                
        void process(uint channel, audio_sample_t* buffer, nframes_t frames);
-       int prepare_processing();
+       int prepare_processing(int rate);
        int finish_processing();
        int calculate_peaks(int chan, float** buffer, int zoomLevel, TimeRef 
startlocation, int count);
 

Index: core/Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -b -r1.139 -r1.140
--- core/Song.cpp       24 Sep 2007 00:57:50 -0000      1.139
+++ core/Song.cpp       26 Sep 2007 20:46:33 -0000      1.140
@@ -348,8 +348,8 @@
                m_rendering = true;
        }
 
-       spec->start_frame = UINT_MAX;
-       spec->end_frame = 0;
+       spec->startLocation = LONG_LONG_MAX;
+       spec->endLocation = 0;
 
        TimeRef endlocation, startlocation;
        int devicerate = audiodevice().get_sample_rate();
@@ -358,17 +358,17 @@
                track->get_render_range(startlocation, endlocation);
 
                if (track->is_solo()) {
-                       spec->end_frame = endlocation.to_frame(devicerate);
-                       spec->start_frame = startlocation.to_frame(devicerate);
+                       spec->endLocation = endlocation;
+                       spec->startLocation = startlocation;
                        break;
                }
 
-               if (endlocation.to_frame(devicerate) > spec->end_frame) {
-                       spec->end_frame = endlocation.to_frame(devicerate);
+               if (endlocation > spec->endLocation) {
+                       spec->endLocation = endlocation;
                }
 
-               if (startlocation.to_frame(devicerate) < 
(uint)spec->start_frame) {
-                       spec->start_frame = startlocation.to_frame(devicerate);
+               if (startlocation < spec->startLocation) {
+                       spec->startLocation = startlocation;
                }
 
        }
@@ -380,34 +380,34 @@
                        PMESG2("  Start marker found at %d", 
startlocation.to_frame(devicerate));
                        // round down to the start of the CD frome (75th of a 
sec)
                        startlocation = 
cd_to_timeref(timeref_to_cd(startlocation));
-                       spec->start_frame = startlocation.to_frame(devicerate);
+                       spec->startLocation = startlocation;
                } else {
                        PMESG2("  No start marker found");
                }
                
                if (m_timeline->get_end_position(endlocation)) {
                        PMESG2("  End marker found at %d", 
endlocation.to_frame(devicerate));
-                       spec->end_frame = endlocation.to_frame(devicerate);
+                       spec->endLocation = endlocation;
                } else {
                        PMESG2("  No end marker found");
                }
        }
 
-       spec->total_frames = spec->end_frame - spec->start_frame;
+       spec->totalTime = spec->endLocation - spec->startLocation;
 
-//     PWARN("Render length is: %s",frame_to_ms_3(spec->total_frames, 
m_project->get_rate()).toAscii().data() );
+//     PWARN("Render length is: 
%s",timeref_to_ms_3(spec->totalTime).toAscii().data() );
 
-       spec->pos = spec->start_frame;
+       spec->pos = spec->startLocation;
        spec->progress = 0;
 
        spec->basename = "Song" + 
QString::number(m_project->get_song_index(m_id)) +"-" + title;
        spec->name = spec->basename;
 
-       if (spec->start_frame == spec->end_frame) {
+       if (spec->startLocation == spec->endLocation) {
                info().warning(tr("No audio to export! (Is everything 
muted?)"));
                return -1;
        }
-       else if (spec->start_frame > spec->end_frame) {
+       else if (spec->startLocation > spec->endLocation) {
                info().warning(tr("Export start frame starts beyond export end 
frame!!"));
                return -1;
        }
@@ -429,7 +429,7 @@
                }
        }
 
-       m_transportLocation.set_position(spec->start_frame, devicerate);
+       m_transportLocation = spec->startLocation;
        
        resize_buffer(false, spec->blocksize);
        
@@ -454,10 +454,12 @@
        uint32_t x;
        int ret = -1;
        int progress;
-       nframes_t this_nframes;
+       
+       nframes_t diff = (spec->endLocation - 
spec->pos).to_frame(audiodevice().get_sample_rate());
        nframes_t nframes = spec->blocksize;
+       nframes_t this_nframes = std::min(diff, nframes);
 
-       if (!spec->running || spec->stop || (this_nframes = std::min 
((nframes_t)(spec->end_frame - spec->pos), nframes)) == 0) {
+       if (!spec->running || spec->stop || this_nframes == 0) {
                process_export (nframes);
                /*              PWARN("Finished Rendering for this song");
                                PWARN("running is %d", spec->running);
@@ -516,12 +518,12 @@
        }
        
 
-       spec->pos += nframes;
+       spec->pos.add_frames(nframes, audiodevice().get_sample_rate());
 
        if (! spec->normalize ) {
-               progress = (int) (( 100.0 * (float)(spec->pos) ) / 
spec->total_frames);
+               progress =  int((double(spec->pos.universal_frame()) / 
spec->totalTime.universal_frame()) * 100);
        } else {
-               progress = (int) (( 100.0 * (float)(spec->pos) ) / 
(spec->total_frames * 2));
+               progress = (int) (double( 100 * spec->pos.universal_frame()) / 
(spec->totalTime.universal_frame() * 2));
                if (spec->renderpass == ExportSpecification::WRITE_TO_HARDDISK) 
{
                        progress += 50;
                }
@@ -818,8 +820,8 @@
                        case 0:
                                // no markers present. We add one at the 
beginning and one at the
                                // end of the render area.
-                               mlist.append(new Marker(m_timeline, 
spec->start_frame, Marker::TEMP_CDTRACK));
-                               mlist.append(new Marker(m_timeline, 
spec->end_frame, Marker::TEMP_ENDMARKER));
+                               mlist.append(new Marker(m_timeline, 
spec->startLocation, Marker::TEMP_CDTRACK));
+                               mlist.append(new Marker(m_timeline, 
spec->endLocation, Marker::TEMP_ENDMARKER));
                                break;
                        case 1:
                                // one marker is present. We add two more at 
the beginning
@@ -828,11 +830,11 @@
 
                                // deactivate the next if-condition (only the 
first one) if you want the
                                // stuff before the first marker to go into the 
pre-gap
-                               if 
(mlist.at(0)->get_when().to_frame(audiodevice().get_sample_rate()) != 
(spec->start_frame)) {
-                                       mlist.append(new Marker(m_timeline, 
spec->start_frame, Marker::TEMP_CDTRACK));
+                               if (mlist.at(0)->get_when() != 
(spec->startLocation)) {
+                                       mlist.append(new Marker(m_timeline, 
spec->startLocation, Marker::TEMP_CDTRACK));
                                }
-                               if (mlist.at(0)->get_when() != spec->end_frame) 
{
-                                       mlist.append(new Marker(m_timeline, 
spec->end_frame, Marker::TEMP_ENDMARKER));
+                               if (mlist.at(0)->get_when() != 
spec->endLocation) {
+                                       mlist.append(new Marker(m_timeline, 
spec->endLocation, Marker::TEMP_ENDMARKER));
                                }
                                break;
                }
@@ -840,7 +842,7 @@
                // would be ok, but let's check if there is an end marker 
present. If not,
                // add one to spec->end_frame
                if (!m_timeline->has_end_marker()) {
-                       mlist.append(new Marker(m_timeline, spec->end_frame, 
Marker::TEMP_ENDMARKER));
+                       mlist.append(new Marker(m_timeline, spec->endLocation, 
Marker::TEMP_ENDMARKER));
                }
        }
 

Index: core/Utils.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Utils.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- core/Utils.cpp      20 Sep 2007 18:36:16 -0000      1.18
+++ core/Utils.cpp      26 Sep 2007 20:46:33 -0000      1.19
@@ -31,36 +31,6 @@
 #include <QChar>
 
 
-// Frame to MM:SS.999 (ms)
-QString frame_to_ms_3 ( nframes_t nframes, int rate )
-{
-       QString spos;
-       long unsigned int remainder;
-       int mins, secs, frames;
-
-       mins = nframes / ( 60 * rate );
-       remainder = nframes - ( mins * 60 * rate );
-       secs = remainder / rate;
-       remainder -= secs * rate;
-       frames = remainder * 1000 / rate;
-       spos.sprintf ( " %02d:%02d%c%03d", mins, secs, 
QLocale::system().decimalPoint().toAscii(), frames );
-
-       return spos;
-}
-
-QString frame_to_hms(double nframes, int rate)
-{
-       long unsigned int remainder;
-       int hours, mins, secs;
-
-       hours = (int) (nframes / (3600 * rate));
-       remainder = (long unsigned int) (nframes - (hours * 3600 * rate));
-       mins = (int) (remainder / ( 60 * rate ));
-       remainder -= mins * 60 * rate;
-       secs = (int) (remainder / rate);
-       return QString().sprintf("%02d:%02d:%02d", hours, mins, secs);
-}
-
 TimeRef msms_to_timeref(QString str)
 {
        TimeRef out = 0;
@@ -133,6 +103,21 @@
        return pixmap;
 }
 
+QString timeref_to_hms(const TimeRef& ref)
+{
+       qint64 remainder;
+       int hours, mins, secs;
+
+       qint64 universalframe = ref.universal_frame();
+       
+       hours = (int) (universalframe / (3600 * UNIVERSAL_SAMPLE_RATE));
+       remainder = (long unsigned int) (universalframe - (hours * 3600 * 
UNIVERSAL_SAMPLE_RATE));
+       mins = (int) (remainder / ( ONE_MINUTE_UNIVERSAL_SAMPLE_RATE ));
+       remainder -= mins * ONE_MINUTE_UNIVERSAL_SAMPLE_RATE;
+       secs = (int) (remainder / UNIVERSAL_SAMPLE_RATE);
+       return QString().sprintf("%02d:%02d:%02d", hours, mins, secs);
+}
+
 QString timeref_to_ms(const TimeRef& ref)
 {
        long unsigned int remainder;

Index: core/Utils.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Utils.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- core/Utils.h        20 Sep 2007 18:36:16 -0000      1.14
+++ core/Utils.h        26 Sep 2007 20:46:33 -0000      1.15
@@ -30,9 +30,7 @@
 
 class QString;
 
-QString frame_to_ms_3(nframes_t nframes, int rate);
-QString frame_to_hms(double nframes, int rate);
-
+QString timeref_to_hms(const TimeRef& ref);
 QString timeref_to_ms(const TimeRef& ref);
 QString timeref_to_ms_2 (const TimeRef& ref);
 QString timeref_to_ms_3 (const TimeRef& ref);

Index: core/WriteSource.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/WriteSource.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- core/WriteSource.cpp        24 Sep 2007 00:57:50 -0000      1.36
+++ core/WriteSource.cpp        26 Sep 2007 20:46:33 -0000      1.37
@@ -87,7 +87,8 @@
                        int err;
 
                        m_src_data.output_frames = m_out_samples_max / 
m_channelCount;
-                       m_src_data.end_of_input = ((m_spec->pos + nframes) >= 
m_spec->end_frame);
+                       int rate = audiodevice().get_sample_rate();
+                       m_src_data.end_of_input = ((m_spec->pos.to_frame(rate) 
+ nframes) >= m_spec->endLocation.to_frame(rate));
                        m_src_data.data_out = m_dataF2;
 
                        if (m_leftover_frames > 0) {
@@ -388,7 +389,7 @@
        
        m_peak = new Peak(this);
 
-       if (m_peak->prepare_processing() < 0) {
+       if (m_peak->prepare_processing(audiodevice().get_sample_rate()) < 0) {
                PERROR("Cannot process peaks realtime");
                m_processPeaks = false;
                delete m_peak;

Index: traverso/dialogs/AudioClipEditDialog.cpp
===================================================================
RCS file: 
/sources/traverso/traverso/src/traverso/dialogs/AudioClipEditDialog.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- traverso/dialogs/AudioClipEditDialog.cpp    24 Sep 2007 16:58:39 -0000      
1.11
+++ traverso/dialogs/AudioClipEditDialog.cpp    26 Sep 2007 20:46:33 -0000      
1.12
@@ -227,7 +227,7 @@
        if (ie().is_holding()) return;
        if (locked) return;
        
-       TimeRef ref(m_clip->get_fade_in()->get_range(), m_clip->get_rate());
+       TimeRef ref(qint64(m_clip->get_fade_in()->get_range()));
        QTime fadeTime = timeref_to_qtime(ref);
        fadeInEdit->setTime(fadeTime);
 }
@@ -236,7 +236,7 @@
 {
        if (locked) return;
 
-       TimeRef ref(m_clip->get_fade_out()->get_range(), m_clip->get_rate());
+       TimeRef ref(qint64(m_clip->get_fade_out()->get_range()));
        QTime fadeTime = timeref_to_qtime(ref);
        fadeOutEdit->setTime(fadeTime);
 }
@@ -264,11 +264,11 @@
        if (ie().is_holding()) return;
 
        locked = true;
-       nframes_t frames = 
qtime_to_timeref(time).to_frame(audiodevice().get_sample_rate());
-       if (frames == 0) {
+       double range = double(qtime_to_timeref(time).universal_frame());
+       if (range == 0) {
                m_clip->set_fade_out(1);
        } else {
-               m_clip->set_fade_out(frames);
+               m_clip->set_fade_out(range);
        }
        locked = false;
 }

Index: traverso/songcanvas/TimeLineView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/TimeLineView.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- traverso/songcanvas/TimeLineView.cpp        26 Sep 2007 19:01:15 -0000      
1.48
+++ traverso/songcanvas/TimeLineView.cpp        26 Sep 2007 20:46:34 -0000      
1.49
@@ -360,20 +360,17 @@
 {
        QPointF point = mapFromScene(cpointer().scene_pos());
        
-       nframes_t when = (uint) (point.x() * m_sv->timeref_scalefactor);
+       TimeRef when(point.x() * m_sv->timeref_scalefactor);
        
        return add_marker_at(when);
 }
 
 Command* TimeLineView::add_marker_at_playhead()
 {
-       TimeRef location = m_sv->get_song()->get_transport_location();
-       nframes_t when = location.to_frame(audiodevice().get_sample_rate());
-       
-       return add_marker_at(when);
+       return add_marker_at(m_sv->get_song()->get_transport_location());
 }
 
-Command* TimeLineView::add_marker_at(nframes_t when)
+Command* TimeLineView::add_marker_at(const TimeRef when)
 {
        CommandGroup* group = new CommandGroup(m_timeline, "");
 
@@ -386,8 +383,8 @@
                }
 
                TimeRef lastlocation = m_sv->get_song()->get_last_location();
-               if (when < 
lastlocation.to_frame(audiodevice().get_sample_rate())) {  // add one at the 
end of the song
-                       Marker* me = new Marker(m_timeline, 
lastlocation.to_frame(audiodevice().get_sample_rate()), Marker::ENDMARKER);
+               if (when < lastlocation) {  // add one at the end of the song
+                       Marker* me = new Marker(m_timeline, lastlocation, 
Marker::ENDMARKER);
                        me->set_description(tr("End"));
                        group->add_command(m_timeline->add_marker(me));
                }

Index: traverso/songcanvas/TimeLineView.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/TimeLineView.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- traverso/songcanvas/TimeLineView.h  10 Sep 2007 18:44:16 -0000      1.12
+++ traverso/songcanvas/TimeLineView.h  26 Sep 2007 20:46:34 -0000      1.13
@@ -62,7 +62,7 @@
 
        QHash<nframes_t, QString>       m_zooms;        
 
-       Command* add_marker_at(nframes_t when);
+       Command* add_marker_at(const TimeRef when);
        void update_softselected_marker(QPoint pos);
        
        

Index: traverso/widgets/InfoWidgets.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/widgets/InfoWidgets.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- traverso/widgets/InfoWidgets.cpp    10 Sep 2007 18:44:16 -0000      1.43
+++ traverso/widgets/InfoWidgets.cpp    26 Sep 2007 20:46:34 -0000      1.44
@@ -325,8 +325,8 @@
                }
                
                uint rate = audiodevice().get_sample_rate();
-               double frames = ( (space * 1048576) / (sizeof(float) * 
recChannelCount));
-               text = frame_to_hms(frames, rate);
+               TimeRef time(qint64((space * 1048576) / (sizeof(float) * 
recChannelCount)), rate);
+               text = timeref_to_hms(time);
                if (text < "00:30:00") {
                        QPalette pal;
                        pal.setColor(QPalette::ButtonText, QColor(Qt::red));




reply via email to

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