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 traverso/songcanvas/...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src core/Peak.cpp traverso/songcanvas/...
Date: Fri, 08 Jun 2007 10:25:14 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/06/08 10:25:14

Modified files:
        src/core       : Peak.cpp 
        src/traverso/songcanvas: AudioClipView.cpp 

Log message:
        fixed Peak render bug. the data points consist of an upper and lower 
sample 'data point'
        But for certain zoomlevels, the divide factor could throw away the last 
(lower) sample 
        resulting in strange painting problems (the last pixels(s) were painted 
wrong)
        Now we don't calculate the last peak data point if the size for a 
certain zoomlevel is odd....

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.cpp?cvsroot=traverso&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/AudioClipView.cpp?cvsroot=traverso&r1=1.73&r2=1.74

Patches:
Index: core/Peak.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- core/Peak.cpp       4 Jun 2007 18:22:52 -0000       1.29
+++ core/Peak.cpp       8 Jun 2007 10:25:14 -0000       1.30
@@ -42,8 +42,8 @@
 const int Peak::MAX_ZOOM_USING_SOURCEFILE      = SAVING_ZOOM_FACTOR - 1;
 
 #define NORMALIZE_CHUNK_SIZE   10000
-#define PEAKFILE_MAJOR_VERSION 0
-#define PEAKFILE_MINOR_VERSION 8
+#define PEAKFILE_MAJOR_VERSION 1
+#define PEAKFILE_MINOR_VERSION 0
 
 int Peak::zoomStep[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 
4096,
                                8192, 16384, 32768, 65536, 131072, 262144, 
524288, 1048576};
@@ -265,6 +265,7 @@
                
                // Check if this zoom level has as many data as requested.
                if ( (pixelcount + offset) > 
m_data.peakDataSizeForLevel[zoomLevel - SAVING_ZOOM_FACTOR]) {
+                       // YES we know that sometimes we ommit the very last 
'pixel' to avoid painting artifacts...
 //                     PERROR("pixelcount exceeds available data size! 
(pixelcount is: %d, available is %d", pixelcount, 
m_data.peakDataSizeForLevel[zoomLevel - SAVING_ZOOM_FACTOR] - offset); 
                        pixelcount = m_data.peakDataSizeForLevel[zoomLevel - 
SAVING_ZOOM_FACTOR] - offset;
                }
@@ -408,6 +409,13 @@
        
        for( int i = SAVING_ZOOM_FACTOR + 1; i < ZOOM_LEVELS+1; ++i) {
                int size = processBufferSize / dividingFactor;
+               // If the size is an odd number, it means we have no data 
available for 
+               // the lower level data point, so we skip that data point.
+               // This does mean that the calculate_peaks() function can start 
to spit
+               // out errors about a missing last datapoint...
+               if (size % 2) {
+                       size -= 1;
+               }
                m_data.peakDataSizeForLevel[i - SAVING_ZOOM_FACTOR] = size;
                totalBufferSize += size;
                dividingFactor *= 2;

Index: traverso/songcanvas/AudioClipView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/AudioClipView.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- traverso/songcanvas/AudioClipView.cpp       30 May 2007 20:44:30 -0000      
1.73
+++ traverso/songcanvas/AudioClipView.cpp       8 Jun 2007 10:25:14 -0000       
1.74
@@ -243,7 +243,7 @@
        bool microView = m_song->get_hzoom() > (Peak::MAX_ZOOM_USING_SOURCEFILE 
- 1) ? 0 : 1;
        // boundary checking, important for microview only, macroview needs the 
additional
        // pixels to paint the waveform correctly
-       if ( microView && ((xstart + pixelcount) > m_boundingRect.width()) ) {
+       if ( /*microView && */((xstart + pixelcount) > m_boundingRect.width()) 
) {
                pixelcount = (int) m_boundingRect.width() - xstart;
        }
        int channels = m_clip->get_channels();




reply via email to

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