Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10098
Modified Files:
Envelope.cpp Envelope.h WaveTrack.cpp
Log Message:
Remove unneeded points during delete.
Index: Envelope.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Envelope.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- Envelope.h 10 Apr 2008 22:39:57 -0000 1.32
+++ Envelope.h 4 May 2009 23:32:48 -0000 1.33
@@ -123,7 +123,7 @@
void CopyFrom(const Envelope * e, double t0, double t1);
void Paste(double t0, Envelope *e);
void InsertSpace(double t0, double tlen);
- void RemoveUnneededPoints(double tolerence = 0.001);
+ void RemoveUnneededPoints(double time = -1, double tolerence = 0.001);
// Control
Index: WaveTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/WaveTrack.cpp,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- WaveTrack.cpp 20 Apr 2009 17:27:22 -0000 1.149
+++ WaveTrack.cpp 4 May 2009 23:32:48 -0000 1.150
@@ -771,6 +771,7 @@
}
if (!clip->Clear(t0,t1))
return false;
+ clip->GetEnvelope()->RemoveUnneededPoints(t0);
}
}
} else
@@ -1461,7 +1462,7 @@
return true;
}
-sampleCount WaveTrack::TimeToLongSamples(double t0) const
+AUDACITY_DLL_API sampleCount WaveTrack::TimeToLongSamples(double t0) const
{
return (sampleCount)floor(t0 * mRate + 0.5);
}
Index: Envelope.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Envelope.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- Envelope.cpp 29 Mar 2009 03:37:42 -0000 1.64
+++ Envelope.cpp 4 May 2009 23:32:48 -0000 1.65
@@ -759,7 +759,12 @@
e->Delete(0); // they were not there when we entered this
}
-void Envelope::RemoveUnneededPoints(double tolerence)
+// Deletes 'unneeded' points, starting from the left.
+// If 'time' is set and positive, just deletes points in a small region
+// around that value.
+// 'Unneeded' means that the envelope doesn't change by more than
+// 'tolerence' without the point being there.
+void Envelope::RemoveUnneededPoints(double time, double tolerence)
{
unsigned int len = mEnv.Count();
unsigned int i;
@@ -770,6 +775,11 @@
for (i = 0; i < len; i++) {
when = mEnv[i]->t;
+ if(time >= 0)
+ {
+ if(fabs(when + mOffset - time) > 0.00025) // 2 samples at 8kHz, 11 at
44.1kHz
+ continue;
+ }
val = mEnv[i]->val;
Delete(i); // try it to see if it's doing anything
val1 = GetValue(when + mOffset);
@@ -777,7 +787,7 @@
{
Insert(when,val); // put it back, we needed it
- //Insert may have modified instead of inserting, if two points were
at the same tinme.
+ //Insert may have modified instead of inserting, if two points were
at the same time.
// in which case len needs to shrink i and len, because the array
size decreased.
if(mEnv.Count()!=len)
{
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs