2009-02-15 05:15:39 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
///
|
2013-04-17 10:46:57 +00:00
|
|
|
/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo
|
|
|
|
/// while maintaining the original pitch by using a time domain WSOLA-like method
|
2009-02-15 05:15:39 +00:00
|
|
|
/// with several performance-increasing tweaks.
|
|
|
|
///
|
2013-04-17 10:46:57 +00:00
|
|
|
/// Anti-alias filter is used to prevent folding of high frequencies when
|
2009-02-15 05:15:39 +00:00
|
|
|
/// transposing the sample rate with interpolation.
|
|
|
|
///
|
|
|
|
/// Author : Copyright (c) Olli Parviainen
|
|
|
|
/// Author e-mail : oparviai 'at' iki.fi
|
|
|
|
/// SoundTouch WWW: http://www.surina.net/soundtouch
|
|
|
|
///
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2013-04-17 10:46:57 +00:00
|
|
|
// Last changed : $Date: 2008-02-10 14:26:55 -0200 (dom, 10 fev 2008) $
|
2010-03-18 20:04:51 +00:00
|
|
|
// File revision : $Revision: 4 $
|
2009-02-15 05:15:39 +00:00
|
|
|
//
|
2010-03-18 20:04:51 +00:00
|
|
|
// $Id: AAFilter.h 11 2008-02-10 16:26:55Z oparviai $
|
2009-02-15 05:15:39 +00:00
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// License :
|
|
|
|
//
|
|
|
|
// SoundTouch audio processing library
|
|
|
|
// Copyright (c) Olli Parviainen
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef AAFilter_H
|
|
|
|
#define AAFilter_H
|
|
|
|
|
|
|
|
#include "STTypes.h"
|
|
|
|
|
|
|
|
namespace soundtouch
|
|
|
|
{
|
|
|
|
|
|
|
|
class AAFilter
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
class FIRFilter *pFIR;
|
|
|
|
|
|
|
|
/// Low-pass filter cut-off frequency, negative = invalid
|
|
|
|
double cutoffFreq;
|
|
|
|
|
|
|
|
/// num of filter taps
|
|
|
|
uint length;
|
|
|
|
|
|
|
|
/// Calculate the FIR coefficients realizing the given cutoff-frequency
|
|
|
|
void calculateCoeffs();
|
|
|
|
public:
|
|
|
|
AAFilter(uint length);
|
|
|
|
|
|
|
|
~AAFilter();
|
|
|
|
|
2013-04-17 10:46:57 +00:00
|
|
|
/// Sets new anti-alias filter cut-off edge frequency, scaled to sampling
|
|
|
|
/// frequency (nyquist frequency = 0.5). The filter will cut off the
|
2009-02-15 05:15:39 +00:00
|
|
|
/// frequencies than that.
|
|
|
|
void setCutoffFreq(double newCutoffFreq);
|
|
|
|
|
|
|
|
/// Sets number of FIR filter taps, i.e. ~filter complexity
|
|
|
|
void setLength(uint newLength);
|
|
|
|
|
|
|
|
uint getLength() const;
|
|
|
|
|
2013-04-17 10:46:57 +00:00
|
|
|
/// Applies the filter to the given sequence of samples.
|
|
|
|
/// Note : The amount of outputted samples is by value of 'filter length'
|
2009-02-15 05:15:39 +00:00
|
|
|
/// smaller than the amount of input samples.
|
2013-04-17 10:46:57 +00:00
|
|
|
uint evaluate(SAMPLETYPE *dest,
|
|
|
|
const SAMPLETYPE *src,
|
|
|
|
uint numSamples,
|
2009-02-15 05:15:39 +00:00
|
|
|
uint numChannels) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|