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


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/core Peak.cpp
Date: Wed, 27 Jun 2007 17:51:45 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/06/27 17:51:45

Modified files:
        src/core       : Peak.cpp 

Log message:
        fixed wrong readbuffer size in get_max_amplitude() 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.cpp?cvsroot=traverso&r1=1.32&r2=1.33

Patches:
Index: Peak.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- Peak.cpp    26 Jun 2007 14:31:37 -0000      1.32
+++ Peak.cpp    27 Jun 2007 17:51:45 -0000      1.33
@@ -633,10 +633,13 @@
 {
        Q_ASSERT(m_file);
        
-       audio_sample_t* readbuffer =  new 
audio_sample_t[NORMALIZE_CHUNK_SIZE*2];
+       int startpos = startframe / NORMALIZE_CHUNK_SIZE;
+       uint count = (endframe / NORMALIZE_CHUNK_SIZE) - startpos;
+       
+       uint buffersize = count < NORMALIZE_CHUNK_SIZE*2 ? 
NORMALIZE_CHUNK_SIZE*2 : count;
+       audio_sample_t* readbuffer =  new audio_sample_t[buffersize];
        
        audio_sample_t maxamp = 0;
-       int startpos = startframe / NORMALIZE_CHUNK_SIZE;
        
        // Read in the part not fully occupied by a cached normalize value
        // and run compute_peak on it.
@@ -650,8 +653,6 @@
                maxamp = Mixer::compute_peak(buf, read, maxamp);
        }
        
-       int count = (endframe / NORMALIZE_CHUNK_SIZE) - startpos;
-       
        
        // Read in the part not fully occupied by a cached normalize value
        // and run compute_peak on it.




reply via email to

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