Update of /cvsroot/audacity/audacity-src/src/effects In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv32006
Modified Files: Equalization.cpp Log Message: This is just an idea, see Re: [Audacity-devel] Effect design: limiting unecessary processing of whitespace WAS: Audacity CRASH bug doing EQ on Audacity-devel. Feel free to revert/change. Index: Equalization.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/effects/Equalization.cpp,v retrieving revision 1.103 retrieving revision 1.104 diff -u -d -r1.103 -r1.104 --- Equalization.cpp 12 Sep 2009 20:40:19 -0000 1.103 +++ Equalization.cpp 12 Sep 2009 23:39:04 -0000 1.104 @@ -599,14 +599,17 @@ // (this could be enhanced in the future to use the tails) double offsetT0 = t->LongSamplesToTime((sampleCount)offset); double lenT = t->LongSamplesToTime(originalLen); + // 'start' is the sample offset in 't', the passed in track + // 'startT' is the equivalent time value + // 'output' starts at zero + double startT = t->LongSamplesToTime(start); //output has one waveclip for the total length, even though //t might have whitespace seperating multiple clips //we want to maintain the original clip structure, so //only paste the intersections of the new clip. - //We have to clear the old audio which removes the clip, making the iterator invalid - //thus we do two passes with the first to collect start/end times. + //Find the bits of clips that need replacing std::vector<std::pair<double, double> > clipStartEndTimes; for (WaveClipList::compatibility_iterator it=t->GetClipIterator(); it; it=it->GetNext()) { @@ -617,17 +620,25 @@ clip = it->GetData(); clipStartT = clip->GetStartTime(); clipEndT = clip->GetEndTime(); + if( clipEndT <= startT ) + continue; // clip is not within selection + if( clipStartT >= startT + lenT ) + continue; // clip is not within selection + if( clipStartT < startT ) // does selection cover the whole clip? + clipStartT = startT; // don't copy all the new clip + if( clipEndT > startT + lenT ) // does selection cover the whole clip? + clipEndT = startT + lenT; // don't copy all the new clip //save them clipStartEndTimes.push_back(std::pair<double,double>(clipStartT,clipEndT)); } - //now go thru and replace the old lips with new + //now go thru and replace the old clips with new for(unsigned int i=0;i<clipStartEndTimes.size();i++) { Track *toClipOutput; //remove the old audio and get the new t->Clear(clipStartEndTimes[i].first,clipStartEndTimes[i].second); - output->Copy(offsetT0+clipStartEndTimes[i].first,offsetT0+clipStartEndTimes[i].second, &toClipOutput); + output->Copy(clipStartEndTimes[i].first-startT+offsetT0,clipStartEndTimes[i].second-startT+offsetT0, &toClipOutput); if(toClipOutput) { //put the processed audio in ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Audacity-cvs mailing list Audacity-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/audacity-cvs