traverso-commit
[Top][All Lists]
Advanced

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

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


From: Ben Levitt
Subject: [Traverso-commit] traverso/src/core AudioClip.cpp Peak.cpp
Date: Mon, 16 Jul 2007 01:48:11 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Ben Levitt <benjie>     07/07/16 01:48:11

Modified files:
        src/core       : AudioClip.cpp Peak.cpp 

Log message:
        On <N> when norm data is not available, do nothing instead of crash.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Peak.cpp?cvsroot=traverso&r1=1.35&r2=1.36

Patches:
Index: AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- AudioClip.cpp       13 Jul 2007 07:41:02 -0000      1.112
+++ AudioClip.cpp       16 Jul 2007 01:48:10 -0000      1.113
@@ -894,15 +894,17 @@
        }
 
        for (uint i=0; i<m_readSource->get_channel_count(); ++i) {
-               maxamp = 
f_max(m_readSource->get_peak(i)->get_max_amplitude(sourceStartFrame, 
sourceEndFrame), maxamp);
-       }
+               double amp = 
m_readSource->get_peak(i)->get_max_amplitude(sourceStartFrame, sourceEndFrame);
 
-       if (maxamp == 0.0f) {
+               if (amp == 0.0f) {
                printf("AudioClip::normalization: max amplitude == 0\n");
                /* don't even try */
                return;
        }
 
+               maxamp = f_max(amp, maxamp);
+       }
+
        if (maxamp == target) {
                printf("AudioClip::normalization: max amplitude == target 
amplitude\n");
                /* we can't do anything useful */

Index: Peak.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Peak.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- Peak.cpp    15 Jul 2007 05:09:46 -0000      1.35
+++ Peak.cpp    16 Jul 2007 01:48:11 -0000      1.36
@@ -647,7 +647,9 @@
 
 audio_sample_t Peak::get_max_amplitude(nframes_t startframe, nframes_t 
endframe)
 {
-       Q_ASSERT(m_file);
+       if (!m_file || !peaksAvailable) {
+               return 0.0f;
+       }
        
        int startpos = startframe / NORMALIZE_CHUNK_SIZE;
        uint count = (endframe / NORMALIZE_CHUNK_SIZE) - startpos;




reply via email to

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