1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-07 07:12:34 +02: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

@ -314,7 +314,8 @@ sampleCount VoiceKey::OnBackward (WaveTrack & t, sampleCount end, sampleCount le
//Initialize these trend markers atrend and ztrend. They keep track of the
//up/down trends at the start and end of the evaluation window.
int atrend = sgn(buffer[remaining - 2]-buffer[remaining - 1]);
int ztrend = sgn(buffer[remaining - WindowSizeInt-2]-buffer[remaining - WindowSizeInt-2]);
int ztrend = sgn(buffer[remaining - WindowSizeInt - 2] -
buffer[remaining - WindowSizeInt - 2]);
double erg=0;
double sc = 0;

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));
}
}
}