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: Mon, 17 Sep 2007 18:29:27 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/09/17 18:29:27

Modified files:
        src/core       : Peak.cpp 

Log message:
        fix get_max_amplitude, it only used the first channel due last commit 

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

Patches:
Index: Peak.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- Peak.cpp    17 Sep 2007 18:14:30 -0000      1.51
+++ Peak.cpp    17 Sep 2007 18:29:27 -0000      1.52
@@ -665,12 +665,11 @@
 
 audio_sample_t Peak::get_max_amplitude(nframes_t startframe, nframes_t 
endframe)
 {
-       
-       ChannelData* data = m_channelData.at(0);
-       
+       foreach(ChannelData* data, m_channelData) {
        if (!data->file || !peaksAvailable) {
                return 0.0f;
        }
+       }
        
        int startpos = startframe / NORMALIZE_CHUNK_SIZE;
        uint count = (endframe / NORMALIZE_CHUNK_SIZE) - startpos;
@@ -681,7 +680,7 @@
        audio_sample_t maxamp = 0;
        
        // Read in the part not fully occupied by a cached normalize value
-       // and run compute_peak on it.
+       // at the left hand part and run compute_peak on it.
        if (startframe != 0) {
                startpos += 1;
                int toRead = (int) ((startpos * NORMALIZE_CHUNK_SIZE) - 
startframe);
@@ -695,7 +694,7 @@
        
        
        // Read in the part not fully occupied by a cached normalize value
-       // and run compute_peak on it.
+       // at the right hand part and run compute_peak on it.
        float f = (float) endframe / NORMALIZE_CHUNK_SIZE;
        int endpos = (int) f;
        int toRead = (int) ((f - (endframe / NORMALIZE_CHUNK_SIZE)) * 
NORMALIZE_CHUNK_SIZE);
@@ -710,6 +709,7 @@
        // read in the cached normvalues, and calculate the highest value!
        count = endpos - startpos;
        
+       foreach(ChannelData* data, m_channelData) {
        fseek(data->file, data->headerdata.normValuesDataOffset + (startpos * 
sizeof(audio_sample_t)), SEEK_SET);
        
        read = fread(readbuffer, sizeof(audio_sample_t), count, data->file);
@@ -719,6 +719,7 @@
        }
        
        maxamp = Mixer::compute_peak(readbuffer, read, maxamp);
+       }
        
        delete [] readbuffer;
        




reply via email to

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