1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-08 06:03:49 +01:00
This commit is contained in:
Paul Licameli
2016-08-22 15:04:38 -04:00
parent 26b94a447b
commit 477d8d9d1d
2 changed files with 12 additions and 11 deletions

View File

@@ -532,24 +532,24 @@ bool EffectDtmf::MakeDtmfTone(float *buffer, sampleCount len, float fs, wxChar t
}
// generate a fade-in of duration 1/250th of second
if (last==0) {
A=(fs/kFadeInOut);
for(sampleCount i=0; i<A; i++) {
buffer[i]*=i/A;
if (last == 0) {
A = (fs / kFadeInOut);
for(sampleCount i = 0; i < A; i++) {
buffer[i] *= i/A;
}
}
// generate a fade-out of duration 1/250th of second
if (last==total-len) {
if (last == total - len) {
// we are at the last buffer of 'len' size, so, offset is to
// backup 'A' samples, from 'len'
A=(fs/kFadeInOut);
sampleCount offset=len-(sampleCount)(fs/kFadeInOut);
A = (fs / kFadeInOut);
sampleCount offset = len - (sampleCount)(fs / kFadeInOut);
// 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));
if (offset >= 0) {
for(sampleCount i = 0; i < A; i++) {
buffer[i + offset] *= (1 - (i / A));
}
}
}