traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src core/Peak.cpp core/Peak.h sheetcan...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src core/Peak.cpp core/Peak.h sheetcan...
Date: Mon, 23 Feb 2009 20:14:59 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       09/02/23 20:14:59

Modified files:
        src/core       : Peak.cpp Peak.h 
        src/sheetcanvas: AudioClipView.cpp 

Log message:
        * do the vertical scaling of the waveform by ourselves again, as the 
scaling by QPainter doesn't work properly on Mac OS X
        @ Nicola: the dB lines aren't painted at the correct position any 
longer due this change, can you have a look at it ?

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.cpp?cvsroot=traverso&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.h?cvsroot=traverso&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/AudioClipView.cpp?cvsroot=traverso&r1=1.17&r2=1.18

Patches:
Index: core/Peak.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- core/Peak.cpp       12 Feb 2009 21:34:27 -0000      1.86
+++ core/Peak.cpp       23 Feb 2009 20:14:59 -0000      1.87
@@ -242,9 +242,7 @@
        float ** buffer,
        TimeRef startlocation,
        int peakDataCount,
-       qreal framesPerPeak,
-       qreal & scaleFactor
-       )
+       qreal framesPerPeak)
 {
        PENTER3;
        
@@ -275,8 +273,6 @@
                        return NO_PEAKDATA_FOUND;
                }
                
-               scaleFactor = qreal(nearestpow2) / framesPerPeak;
-
                
                nframes_t startPos = startlocation.to_frame(44100);
                
@@ -317,13 +313,6 @@
 
        // Micro view mode
        } else {
-               if (framesPerPeak < 1.0) {
-                       scaleFactor = 1.0 / framesPerPeak;
-                       framesPerPeak = 1.0;
-               } else {
-                       scaleFactor = 1.0;
-               }
-               
                // Calculate the amount of frames to be read
                nframes_t toRead = qRound(peakDataCount * framesPerPeak);
                

Index: core/Peak.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- core/Peak.h 30 Jan 2008 12:24:35 -0000      1.33
+++ core/Peak.h 23 Feb 2009 20:14:59 -0000      1.34
@@ -114,7 +114,7 @@
        void process(uint channel, audio_sample_t* buffer, nframes_t frames);
        int prepare_processing(int rate);
        int finish_processing();
-       int calculate_peaks(int chan, float** buffer, TimeRef startlocation, 
int peakDataCount, qreal framesPerPeak, qreal& scaleFactor);
+       int calculate_peaks(int chan, float** buffer, TimeRef startlocation, 
int peakDataCount, qreal framesPerPeak);
 
        void close();
        

Index: sheetcanvas/AudioClipView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/AudioClipView.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- sheetcanvas/AudioClipView.cpp       22 Feb 2009 19:51:46 -0000      1.17
+++ sheetcanvas/AudioClipView.cpp       23 Feb 2009 20:14:59 -0000      1.18
@@ -245,8 +245,6 @@
                curveDefaultValue = curveView->get_default_value();
        }
        
-       qreal xscale;
-
        float curvemixdown[peakdatacount];
        if (mixcurvedata) {
                mixcurvedata |= curveView->get_vector(qRound(xstart) + offset, 
peakdatacount, curvemixdown);
@@ -281,11 +279,8 @@
                                &pixeldata[chan],
                                TimeRef(xstart * m_sv->timeref_scalefactor) + 
clipstartoffset,
                                peakdatacount,
-                               m_sheet->get_hzoom(),
-                               xscale);
+                               m_sheet->get_hzoom());
                                
-               xscale = 1.0;
-//             printf("xscale %f, zoomlevel %f\n", xscale, 
m_sheet->get_hzoom());
                
                if (peakdatacount != availpeaks) {
 //                     PWARN("peakdatacount != availpeaks (%d, %d)", 
peakdatacount, availpeaks);
@@ -373,7 +368,7 @@
                        }
                
                        ytrans = height * chan;
-                       p->setMatrix(matrix().translate(xstart, 
ytrans).scale(xscale, 1), true);
+                       p->setMatrix(matrix().translate(xstart, ytrans), true);
                        p->drawLine(0, 0, pixelcount, 0);
                        p->restore();
                }
@@ -394,7 +389,7 @@
                                ytrans = (height / 2) + (chan * height);
                        }
                        
-                       p->setMatrix(matrix().translate(xstart, 
ytrans).scale(xscale, -scaleFactor), true);
+                       p->setMatrix(matrix().translate(xstart, ytrans), true);
                        
                        if (m_clip->is_selected()) {
                                
p->setPen(themer()->get_color("AudioClip:channelseperator:selected"));
@@ -405,7 +400,7 @@
                        p->drawLine(0, 0, pixelcount, 0);
                        
                        for (int x = 0; x < pixelcount; x++) {
-                               m_polygon.append( QPointF(x, 
pixeldata[chan][bufferPos++]) );
+                               m_polygon.append( QPointF(x, -scaleFactor * 
pixeldata[chan][bufferPos++]) );
                        }
                        
                        if 
(themer()->get_property("AudioClip:wavemicroview:antialiased", 0).toInt()) {
@@ -415,9 +410,6 @@
                        
p->setPen(themer()->get_color("AudioClip:wavemicroview"));
                        p->drawPolyline(m_polygon);
                
-                       p->restore();
-                       p->save();
-
                        // draw lines at 0 and -6 db
                        if (m_drawDbGrid) {
                                if (m_height >= m_mimimumheightforinfoarea) {
@@ -425,7 +417,7 @@
                                }
                                p->setMatrix(matrix().translate(0, ytrans), 
true);
 
-                               int scale = 1;
+                               float scale = scaleFactor;
                                if (m_mergedView) {
                                        scale = channels;
                                }
@@ -487,20 +479,20 @@
                                        ytrans = (height / 2) + (chan * height);
                                }
                        
-                               p->setMatrix(matrix().translate(xstart, 
ytrans).scale(xscale, scaleFactor), true);
+                               p->setMatrix(matrix().translate(xstart, 
ytrans), true);
                                
                                m_polygon.clear();
                                m_polygon.reserve(pixelcount*2);
                                
                                for (int x = 0; x < pixelcount; x++) {
-                                       m_polygon.append( QPointF(x, - 
pixeldata[chan][bufferpos]) );
+                                       m_polygon.append( QPointF(x, 
-scaleFactor * pixeldata[chan][bufferpos]) );
                                        bufferpos+=2;
                                }
                                
                                bufferpos -= 1;
                                
                                for (int x = pixelcount - 1; x >= 0; x--) {
-                                       m_polygon.append( QPointF(x, 
pixeldata[chan][bufferpos]) );
+                                       m_polygon.append( QPointF(x, 
scaleFactor * pixeldata[chan][bufferpos]) );
                                        bufferpos-=2;
                                }
                                
@@ -515,9 +507,6 @@
                                p->setPen(minINFLineColor);
                                p->drawLine(0, 0, pixelcount, 0);
 
-                               p->restore();
-                               p->save();
-
                                // draw lines at 0 and -6 db
                                if (m_drawDbGrid) {
                                        if (m_height >= 
m_mimimumheightforinfoarea) {
@@ -554,13 +543,13 @@
                                        scaleFactor *= channels;
                                }
 
-                               p->setMatrix(matrix().translate(xstart, 
ytrans).scale(xscale, scaleFactor), true);
+                               p->setMatrix(matrix().translate(xstart, 
ytrans), true);
                                
                                m_polygon.clear();
                                m_polygon.reserve(pixelcount + 2);
                                
                                for (int x=0; x<pixelcount; x++) {
-                                       m_polygon.append( QPointF(x, 
pixeldata[chan][bufferpos++]) );
+                                       m_polygon.append( QPointF(x, 
scaleFactor * pixeldata[chan][bufferpos++]) );
                                }
                                
                                m_polygon.append(QPointF(pixelcount, 0));
@@ -571,9 +560,6 @@
                                
                                p->drawPath(path);
 
-                               p->restore();
-                               p->save();
-
                                // draw lines at 0 and -6 db
                                if (m_drawDbGrid) {
                                        if (m_height >= 
m_mimimumheightforinfoarea) {




reply via email to

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