Update of /cvsroot/audacity/audacity-src/src/effects
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22551
Modified Files:
DtmfGen.cpp
Log Message:
Fix crash when for example:
- duration > 40s
- duty cycle = 90%
Crash was due to an index for a temporary array was trying to go beyond the
array size.
Index: DtmfGen.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/DtmfGen.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- DtmfGen.cpp 12 Mar 2007 09:23:11 -0000 1.8
+++ DtmfGen.cpp 14 Mar 2007 05:47:07 -0000 1.9
@@ -179,8 +179,8 @@
// now generate the wave: 'last' is used to avoid phase errors
// when inside the inner for loop of the Process() function.
- for(sampleCount i=last; i<len+last; i++) {
- buffer[i]=0.5*(sin(A*(i))+sin(B*(i)));
+ for(sampleCount i=0; i<len; i++) {
+ buffer[i]=0.5*(sin(A*(i+last))+sin(B*(i+last)));
}
// generate a fade-in of duration 1/250th of second
@@ -195,8 +195,12 @@
if (last==total-len) {
A=(fs/FADEINOUT);
sampleCount offset=total-(longSampleCount)(fs/FADEINOUT);
- for(sampleCount i=0; i<A; i++) {
- buffer[i+offset]*=(1-(i/A));
+ // protect against negative offset, which can occur if too a
+ // small selection is made
+ if (offset>=0) {
+ for(sampleCount i=0; i<A; i++) {
+ buffer[i+offset]*=(1-(i/A));
+ }
}
}
return true;
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs