From df3631599107a6e1ba5221a7919d18b96b309086 Mon Sep 17 00:00:00 2001 From: oparviai Date: Sat, 31 Oct 2009 14:37:24 +0000 Subject: [PATCH] Bugfix: Added a check against zero processing samples into rate transposing routines --- README.html | 5 ++++- source/SoundTouch/RateTransposer.cpp | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.html b/README.html index c5e4486..f37841e 100644 --- a/README.html +++ b/README.html @@ -18,7 +18,7 @@
-

SoundTouch audio processing library v1.4.1 +

SoundTouch audio processing library v1.4.1pre

SoundTouch library Copyright (c) Olli Parviainen 2002-2009

@@ -695,9 +695,12 @@ SoundTouch v1.3.1:

  • Stanislav Brabec
  • Christian Budde
  • Brian Cameron
  • +
  • Jason Champion
  • +
  • Patrick Colis
  • Justin Frankel
  • Jason Garland
  • Takashi Iwai
  • +
  • Paulo Pizarro
  • John Sheehy
  • Moral greetings to all other contributors and users also!

    diff --git a/source/SoundTouch/RateTransposer.cpp b/source/SoundTouch/RateTransposer.cpp index 40179f1..bb2b4c7 100644 --- a/source/SoundTouch/RateTransposer.cpp +++ b/source/SoundTouch/RateTransposer.cpp @@ -248,9 +248,9 @@ void RateTransposer::downsample(const SAMPLETYPE *src, uint nSamples) // If the parameter 'uRate' value is larger than 'SCALE', first apply the // anti-alias filter to remove high frequencies (prevent them from folding - // over the lover frequencies), then transpose. */ + // over the lover frequencies), then transpose. - // Add the new samples to the end of the storeBuffer */ + // Add the new samples to the end of the storeBuffer storeBuffer.putSamples(src, nSamples); // Anti-alias filter the samples to prevent folding and output the filtered @@ -262,6 +262,8 @@ void RateTransposer::downsample(const SAMPLETYPE *src, uint nSamples) count = pAAFilter->evaluate(tempBuffer.ptrEnd(sizeTemp), storeBuffer.ptrBegin(), sizeTemp, (uint)numChannels); + if (count == 0) return; + // Remove the filtered samples from 'storeBuffer' storeBuffer.receiveSamples(count); @@ -398,7 +400,9 @@ uint RateTransposerInteger::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *sr unsigned int i, used; LONG_SAMPLETYPE temp, vol1; - used = 0; + if (nSamples == 0) return 0; // no samples, no work + + used = 0; i = 0; // Process the last sample saved from the previous call first...