traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src base.pri core/Peak.cpp traverso/so...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src base.pri core/Peak.cpp traverso/so...
Date: Wed, 26 Sep 2007 16:32:53 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/09/26 16:32:53

Modified files:
        src            : base.pri 
        src/core       : Peak.cpp 
        src/traverso/songcanvas: AudioClipView.cpp ClipsViewPort.cpp 
                                 CurveView.cpp CurveView.h 
                                 TimeLineView.cpp 

Log message:
        * remove Qt 4.3.0 scrollbar 'fix', people should use Qt 4.3.1 instead
        * some audioclipview painting improvements

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/base.pri?cvsroot=traverso&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.cpp?cvsroot=traverso&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/AudioClipView.cpp?cvsroot=traverso&r1=1.96&r2=1.97
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/ClipsViewPort.cpp?cvsroot=traverso&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CurveView.cpp?cvsroot=traverso&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CurveView.h?cvsroot=traverso&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/TimeLineView.cpp?cvsroot=traverso&r1=1.46&r2=1.47

Patches:
Index: base.pri
===================================================================
RCS file: /sources/traverso/traverso/src/base.pri,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- base.pri    24 Sep 2007 16:58:40 -0000      1.46
+++ base.pri    26 Sep 2007 16:32:52 -0000      1.47
@@ -48,11 +48,6 @@
 #  OPTIONS WHO COULD BE USEFULL FOR PACKAGERS  #
 #################################################
 
-#
-# uncomment if you have a patched Qt 4.3.0 !
-#
-# DEFINES += QT_430_SCROLLBAR_FIX
-
 
 # DEFINES += STATIC_BUILD
 

Index: core/Peak.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- core/Peak.cpp       24 Sep 2007 20:25:02 -0000      1.57
+++ core/Peak.cpp       26 Sep 2007 16:32:52 -0000      1.58
@@ -898,7 +898,7 @@
        }
                
        // Make sure the read buffer is big enough for this read
-       buffer->check_buffers_capacity(count, 1);
+       buffer->check_buffers_capacity(count*2, 1);
        
        Q_ASSERT(m_d->file);
 

Index: traverso/songcanvas/AudioClipView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/AudioClipView.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -b -r1.96 -r1.97
--- traverso/songcanvas/AudioClipView.cpp       25 Sep 2007 17:01:33 -0000      
1.96
+++ traverso/songcanvas/AudioClipView.cpp       26 Sep 2007 16:32:53 -0000      
1.97
@@ -238,11 +238,6 @@
        if ( /*microView && */((xstart + pixelcount) > m_boundingRect.width()) 
) {
                pixelcount = (int) m_boundingRect.width() - xstart;
        }
-       int channels = m_clip->get_channels();
-       int peakdatacount = microView ? pixelcount : pixelcount * 2;
-
-       float* pixeldata[channels];
-       float curvemixdown[peakdatacount];
        
        Peak* peak = m_clip->get_peak();
        if (!peak) {
@@ -264,15 +259,20 @@
                adjustforevenpixel -= 1;
        }
        
+       int channels = m_clip->get_channels();
+       int peakdatacount = microView ? pixelcount : pixelcount * 2;
+
+       float* pixeldata[channels];
+       
        // Load peak data for all channels, if no peakdata is returned
        // for a certain Peak object, schedule it for loading.
        for (int chan=0; chan < channels; ++chan) {
                
                int availpeaks = peak->calculate_peaks( chan,
                                                        &pixeldata[chan],
-                                                       m_song->get_hzoom() + 1,
+                                                               microView ? 
m_song->get_hzoom() : m_song->get_hzoom() + 1,
                                                        (xstart * 
m_sv->timeref_scalefactor) + clipstartoffset,
-                                                       peakdatacount);
+                                                       microView ? 
peakdatacount : peakdatacount / 2 + 2);
                
                if (peakdatacount != availpeaks) {
 //                     PWARN("peakdatacount != availpeaks (%d, %d)", 
peakdatacount, availpeaks);
@@ -292,20 +292,28 @@
        }
        
        
+       float curvemixdown[peakdatacount];
        int mixcurvedata = 0;
+       float curveDefaultValue = 1.0;
        int offset = (int)(m_clip->get_source_start_location() / 
m_sv->timeref_scalefactor);
+       mixcurvedata |= curveView->has_nodes();
+       
+       if (mixcurvedata) {
        mixcurvedata |= curveView->get_vector(xstart + offset, pixelcount, 
curvemixdown);
+       } else {
+               curveDefaultValue = curveView->get_default_value();
+       }
        
-       float fademixdown[pixelcount];
        for (int i = 0; i < m_fadeViews.size(); ++i) {
                FadeView* view = m_fadeViews.at(i);
+               float fademixdown[pixelcount];
                int fademix = 0;
                if (mixcurvedata) {
                        fademix = view->get_vector(xstart, pixelcount, 
fademixdown);
                } else {
                        fademix = view->get_vector(xstart, pixelcount, 
curvemixdown);
                }
-               
+               printf("fademix is %d\n", fademix);
                if (mixcurvedata && fademix) {
                        for (int j=0; j<pixelcount; ++j) {
                                curvemixdown[j] *= fademixdown[j];
@@ -320,14 +328,24 @@
        // Merged view: calculate highest value for all channels, 
        // and store it in the first channels pixeldata.
        if (!microView) {
-               for (int chan=0; chan < channels; chan++) {
                        if (!m_classicView) {
+                       for (int chan=0; chan < channels; chan++) {
                                for (int i=0, j=0; i < (pixelcount*2); i+=2, 
++j) {
                                        pixeldata[chan][j] = - 
f_max(pixeldata[chan][i], - pixeldata[chan][i+1]);
                                }
                        }
                }
                
+               if (m_mergedView) {
+                       for (int chan=1; chan < channels; chan++) {
+                               for (int i = 0; i < (pixelcount*2); ++i) {
+                                       pixeldata[0][i] = f_max(pixeldata[chan 
- 1][i], pixeldata[chan][i]);
+                               }
+                       }
+               }
+               
+       }
+       
                if (mixcurvedata) {
                        int curvemixdownpos;
                        for (int chan=0; chan < channels; chan++) {
@@ -348,16 +366,6 @@
                        }
                }
                
-               if (m_mergedView) {
-                       for (int chan=1; chan < channels; chan++) {
-                               for (int i = 0; i < (pixelcount*2); ++i) {
-                                       pixeldata[0][i] = f_max(pixeldata[chan 
- 1][i], pixeldata[chan][i]);
-                               }
-                       }
-               }
-               
-       }
-       
        
        for (int chan=0; chan < channels; chan++) {
                
@@ -376,18 +384,9 @@
                }
        
                
-               float scaleFactor = ( (float) height * 0.90 / 2) * 
m_clip->get_gain();
+               float scaleFactor = ( (float) height * 0.90 / 2) * 
m_clip->get_gain() * curveDefaultValue;
                float ytrans;
                
-               if (m_mergedView) {
-                       if (m_classicView) {
-                               ytrans = (height / 2) * channels;
-                               scaleFactor *= channels;
-                       } else {
-                               ytrans = height * channels;
-                               scaleFactor *= channels;
-                       }
-               }
 
                // Draw channel seperator horizontal lines, if needed.
                if (channels >= 2 && ! m_mergedView && m_classicView && chan 
>=1 ) {
@@ -454,7 +453,17 @@
                        }
                                
                        
-                       scaleFactor = ( (float) height * 0.90 / 
(Peak::MAX_DB_VALUE * 2)) * m_clip->get_gain();
+                       scaleFactor = ( (float) height * 0.90 / 
(Peak::MAX_DB_VALUE * 2)) * m_clip->get_gain() * curveDefaultValue;
+                       
+                       if (m_mergedView) {
+                               if (m_classicView) {
+                                       ytrans = (height / 2) * channels;
+                                       scaleFactor *= channels;
+                               } else {
+                                       ytrans = height * channels;
+                                       scaleFactor *= channels;
+                               }
+                       }
                        
                        QPainterPath path;
                        // in rectified view, we add an additional point, hence 
+ 1
@@ -466,11 +475,9 @@
                                
                                int range = pixelcount;
                                for (int x = 0; x < range; x+=2) {
-                                       if (x <= range) {
                                                polygontop.append( QPointF(x, 
scaleFactor * pixeldata[chan][bufferpos++]) );
                                                polygonbottom.append( 
QPointF(x, -scaleFactor * pixeldata[chan][bufferpos++]) );
                                        }
-                               }
                                
                                path.addPolygon(polygontop);
                                path.lineTo(polygonbottom.last());
@@ -483,7 +490,7 @@
                                }
                        
                        } else {
-                               scaleFactor =  (float) height * 0.95 * 
m_clip->get_gain() / Peak::MAX_DB_VALUE;
+                               scaleFactor =  (float) height * 0.95 * 
m_clip->get_gain() / Peak::MAX_DB_VALUE * curveDefaultValue;
                                ytrans = height + (chan * height);
                
                                if (m_mergedView) {

Index: traverso/songcanvas/ClipsViewPort.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/ClipsViewPort.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- traverso/songcanvas/ClipsViewPort.cpp       10 Sep 2007 18:44:15 -0000      
1.25
+++ traverso/songcanvas/ClipsViewPort.cpp       26 Sep 2007 16:32:53 -0000      
1.26
@@ -48,13 +48,8 @@
        viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
        
 //     setViewportUpdateMode(SmartViewportUpdate);
-#if QT_VERSION == 0x040300 && (! QT_430_SCROLLBAR_FIX)
-       horizontalScrollBar()->setMaximumHeight(0);
-       verticalScrollBar()->setMaximumHeight(0);
-#else 
        setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-#endif 
 }
 
 void ClipsViewPort::get_pointed_context_items(QList<ContextItem* > &list)

Index: traverso/songcanvas/CurveView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/CurveView.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- traverso/songcanvas/CurveView.cpp   24 Sep 2007 20:25:02 -0000      1.59
+++ traverso/songcanvas/CurveView.cpp   26 Sep 2007 16:32:53 -0000      1.60
@@ -311,7 +311,12 @@
 
 int CurveView::get_vector(int xstart, int pixelcount, float* arg)
 {
+       if (m_guicurve->get_nodes()->size() == 1 && 
m_guicurve->get_nodes()->first()->value == 1.0) {
+               return 0;
+       }
+       
        m_guicurve->get_vector(xstart, xstart + pixelcount, arg, pixelcount);
+       
        return 1;
 }
 
@@ -599,5 +604,13 @@
        m_startoffset = offset;
 }
 
-//eof
+bool CurveView::has_nodes() const
+{
+       return m_guicurve->get_nodes()->size() > 1 ? true : false;
+}
+
+float CurveView::get_default_value()
+{
+       return m_guicurve->get_nodes()->first()->value;
+}
 

Index: traverso/songcanvas/CurveView.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/CurveView.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- traverso/songcanvas/CurveView.h     10 Sep 2007 18:44:16 -0000      1.13
+++ traverso/songcanvas/CurveView.h     26 Sep 2007 16:32:53 -0000      1.14
@@ -46,6 +46,8 @@
        
        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, 
QWidget *widget);
        int get_vector(int xstart, int pixelcount, float *arg);
+       bool has_nodes() const;
+       float get_default_value();
        int type() const;
        void calculate_bounding_rect();
        void load_theme_data();

Index: traverso/songcanvas/TimeLineView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/TimeLineView.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- traverso/songcanvas/TimeLineView.cpp        20 Sep 2007 18:25:15 -0000      
1.46
+++ traverso/songcanvas/TimeLineView.cpp        26 Sep 2007 16:32:53 -0000      
1.47
@@ -306,15 +306,15 @@
        
        painter->setMatrixEnabled(false);
 
-       TimeRef firstlocactiondividedbymajorsquare = firstLocation/major*major;
+       TimeRef factor = (firstLocation/major)*major;
        // Draw minor ticks
        for (qint64 i = 0; i < (lastLocation-firstLocation+major) / minor; i++ 
) {
-               int x = (int)((firstlocactiondividedbymajorsquare + i * minor) 
/ m_sv->timeref_scalefactor) - xstartoffset;
+               int x = (int)((factor + i * minor) / m_sv->timeref_scalefactor) 
- xstartoffset;
                painter->drawLine(x, height - 5, x, height - 1);
        }
        
        // Draw major ticks
-       for (TimeRef location = firstlocactiondividedbymajorsquare; location < 
lastLocation; location += major) {
+       for (TimeRef location = factor; location < lastLocation; location += 
major) {
                int x = int(location/m_sv->timeref_scalefactor - xstartoffset);
                painter->drawLine(x, height - 13, x, height - 1);
                if (paintText) {




reply via email to

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