SoundTouch.h | SoundTouch.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
/// tempo and pitch in the same ratio) of the sound. The third available control | /// tempo and pitch in the same ratio) of the sound. The third available control | |||
/// 'pitch' (change pitch but maintain tempo) is produced by a combinatio n of | /// 'pitch' (change pitch but maintain tempo) is produced by a combinatio n of | |||
/// combining the two other controls. | /// combining the two other controls. | |||
/// | /// | |||
/// Author : Copyright (c) Olli Parviainen | /// Author : Copyright (c) Olli Parviainen | |||
/// Author e-mail : oparviai 'at' iki.fi | /// Author e-mail : oparviai 'at' iki.fi | |||
/// SoundTouch WWW: http://www.surina.net/soundtouch | /// SoundTouch WWW: http://www.surina.net/soundtouch | |||
/// | /// | |||
/////////////////////////////////////////////////////////////////////////// ///// | /////////////////////////////////////////////////////////////////////////// ///// | |||
// | // | |||
// Last changed : $Date: 2015-05-18 15:28:41 +0000 (Mon, 18 May 2015) $ | // Last changed : $Date: 2015-09-08 10:04:44 +0300 (Tue, 08 Sep 2015) $ | |||
// File revision : $Revision: 4 $ | // File revision : $Revision: 4 $ | |||
// | // | |||
// $Id: SoundTouch.h 216 2015-05-18 15:28:41Z oparviai $ | // $Id: SoundTouch.h 227 2015-09-08 07:04:44Z oparviai $ | |||
// | // | |||
/////////////////////////////////////////////////////////////////////////// ///// | /////////////////////////////////////////////////////////////////////////// ///// | |||
// | // | |||
// License : | // License : | |||
// | // | |||
// SoundTouch audio processing library | // SoundTouch audio processing library | |||
// Copyright (c) Olli Parviainen | // Copyright (c) Olli Parviainen | |||
// | // | |||
// This library is free software; you can redistribute it and/or | // This library is free software; you can redistribute it and/or | |||
// modify it under the terms of the GNU Lesser General Public | // modify it under the terms of the GNU Lesser General Public | |||
skipping to change at line 82 | skipping to change at line 82 | |||
#ifndef SoundTouch_H | #ifndef SoundTouch_H | |||
#define SoundTouch_H | #define SoundTouch_H | |||
#include "FIFOSamplePipe.h" | #include "FIFOSamplePipe.h" | |||
#include "STTypes.h" | #include "STTypes.h" | |||
namespace soundtouch | namespace soundtouch | |||
{ | { | |||
/// Soundtouch library version string | /// Soundtouch library version string | |||
#define SOUNDTOUCH_VERSION "1.9.0" | #define SOUNDTOUCH_VERSION "1.9.1" | |||
/// SoundTouch library version id | /// SoundTouch library version id | |||
#define SOUNDTOUCH_VERSION_ID (10900) | #define SOUNDTOUCH_VERSION_ID (10901) | |||
// | // | |||
// Available setting IDs for the 'setSetting' & 'get_setting' functions: | // Available setting IDs for the 'setSetting' & 'get_setting' functions: | |||
/// Enable/disable anti-alias filter in pitch transposer (0 = disable) | /// Enable/disable anti-alias filter in pitch transposer (0 = disable) | |||
#define SETTING_USE_AA_FILTER 0 | #define SETTING_USE_AA_FILTER 0 | |||
/// Pitch transposer anti-alias filter length (8 .. 128 taps, default = 32) | /// Pitch transposer anti-alias filter length (8 .. 128 taps, default = 32) | |||
#define SETTING_AA_FILTER_LENGTH 1 | #define SETTING_AA_FILTER_LENGTH 1 | |||
skipping to change at line 152 | skipping to change at line 152 | |||
class SoundTouch : public FIFOProcessor | class SoundTouch : public FIFOProcessor | |||
{ | { | |||
private: | private: | |||
/// Rate transposer class instance | /// Rate transposer class instance | |||
class RateTransposer *pRateTransposer; | class RateTransposer *pRateTransposer; | |||
/// Time-stretch class instance | /// Time-stretch class instance | |||
class TDStretch *pTDStretch; | class TDStretch *pTDStretch; | |||
/// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. | /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. | |||
float virtualRate; | double virtualRate; | |||
/// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. | /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. | |||
float virtualTempo; | double virtualTempo; | |||
/// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. | /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. | |||
float virtualPitch; | double virtualPitch; | |||
/// Flag: Has sample rate been set? | /// Flag: Has sample rate been set? | |||
bool bSrateSet; | bool bSrateSet; | |||
/// Accumulator for how many samples in total will be expected as outpu | ||||
t vs. samples put in, | ||||
/// considering current processing settings. | ||||
double samplesExpectedOut; | ||||
/// Accumulator for how many samples in total have been read out from t | ||||
he processing so far | ||||
long samplesOutput; | ||||
/// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtu alTempo' and | /// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtu alTempo' and | |||
/// 'virtualPitch' parameters. | /// 'virtualPitch' parameters. | |||
void calcEffectiveRateAndTempo(); | void calcEffectiveRateAndTempo(); | |||
protected : | protected : | |||
/// Number of channels | /// Number of channels | |||
uint channels; | uint channels; | |||
/// Effective 'rate' value calculated from 'virtualRate', 'virtualTempo ' and 'virtualPitch' | /// Effective 'rate' value calculated from 'virtualRate', 'virtualTempo ' and 'virtualPitch' | |||
float rate; | double rate; | |||
/// Effective 'tempo' value calculated from 'virtualRate', 'virtualTemp o' and 'virtualPitch' | /// Effective 'tempo' value calculated from 'virtualRate', 'virtualTemp o' and 'virtualPitch' | |||
float tempo; | double tempo; | |||
public: | public: | |||
SoundTouch(); | SoundTouch(); | |||
virtual ~SoundTouch(); | virtual ~SoundTouch(); | |||
/// Get SoundTouch library version string | /// Get SoundTouch library version string | |||
static const char *getVersionString(); | static const char *getVersionString(); | |||
/// Get SoundTouch library version Id | /// Get SoundTouch library version Id | |||
static uint getVersionId(); | static uint getVersionId(); | |||
/// Sets new rate control value. Normal rate = 1.0, smaller values | /// Sets new rate control value. Normal rate = 1.0, smaller values | |||
/// represent slower rate, larger faster rates. | /// represent slower rate, larger faster rates. | |||
void setRate(float newRate); | void setRate(double newRate); | |||
/// Sets new tempo control value. Normal tempo = 1.0, smaller values | /// Sets new tempo control value. Normal tempo = 1.0, smaller values | |||
/// represent slower tempo, larger faster tempo. | /// represent slower tempo, larger faster tempo. | |||
void setTempo(float newTempo); | void setTempo(double newTempo); | |||
/// Sets new rate control value as a difference in percents compared | /// Sets new rate control value as a difference in percents compared | |||
/// to the original rate (-50 .. +100 %) | /// to the original rate (-50 .. +100 %) | |||
void setRateChange(float newRate); | void setRateChange(double newRate); | |||
/// Sets new tempo control value as a difference in percents compared | /// Sets new tempo control value as a difference in percents compared | |||
/// to the original tempo (-50 .. +100 %) | /// to the original tempo (-50 .. +100 %) | |||
void setTempoChange(float newTempo); | void setTempoChange(double newTempo); | |||
/// Sets new pitch control value. Original pitch = 1.0, smaller values | /// Sets new pitch control value. Original pitch = 1.0, smaller values | |||
/// represent lower pitches, larger values higher pitch. | /// represent lower pitches, larger values higher pitch. | |||
void setPitch(float newPitch); | void setPitch(double newPitch); | |||
/// Sets pitch change in octaves compared to the original pitch | /// Sets pitch change in octaves compared to the original pitch | |||
/// (-1.00 .. +1.00) | /// (-1.00 .. +1.00) | |||
void setPitchOctaves(float newPitch); | void setPitchOctaves(double newPitch); | |||
/// Sets pitch change in semi-tones compared to the original pitch | /// Sets pitch change in semi-tones compared to the original pitch | |||
/// (-12 .. +12) | /// (-12 .. +12) | |||
void setPitchSemiTones(int newPitch); | void setPitchSemiTones(int newPitch); | |||
void setPitchSemiTones(float newPitch); | void setPitchSemiTones(double newPitch); | |||
/// Sets the number of channels, 1 = mono, 2 = stereo | /// Sets the number of channels, 1 = mono, 2 = stereo | |||
void setChannels(uint numChannels); | void setChannels(uint numChannels); | |||
/// Sets sample rate. | /// Sets sample rate. | |||
void setSampleRate(uint srate); | void setSampleRate(uint srate); | |||
/// Flushes the last samples from the processing pipeline to the output . | /// Flushes the last samples from the processing pipeline to the output . | |||
/// Clears also the internal processing buffers. | /// Clears also the internal processing buffers. | |||
// | // | |||
skipping to change at line 241 | skipping to change at line 248 | |||
/// Adds 'numSamples' pcs of samples from the 'samples' memory position into | /// Adds 'numSamples' pcs of samples from the 'samples' memory position into | |||
/// the input of the object. Notice that sample rate _has_to_ be set be fore | /// the input of the object. Notice that sample rate _has_to_ be set be fore | |||
/// calling this function, otherwise throws a runtime_error exception. | /// calling this function, otherwise throws a runtime_error exception. | |||
virtual void putSamples( | virtual void putSamples( | |||
const SAMPLETYPE *samples, ///< Pointer to sample buffer. | const SAMPLETYPE *samples, ///< Pointer to sample buffer. | |||
uint numSamples ///< Number of samples in buffer. Notice | uint numSamples ///< Number of samples in buffer. Notice | |||
///< that in case of st ereo-sound a single sample | ///< that in case of st ereo-sound a single sample | |||
///< contains data for both channels. | ///< contains data for both channels. | |||
); | ); | |||
/// Output samples from beginning of the sample buffer. Copies requeste | ||||
d samples to | ||||
/// output buffer and removes them from the sample buffer. If there are | ||||
less than | ||||
/// 'numsample' samples in the buffer, returns all that available. | ||||
/// | ||||
/// \return Number of samples returned. | ||||
virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to co | ||||
py output samples. | ||||
uint maxSamples ///< How many samples to receive at | ||||
max. | ||||
); | ||||
/// Adjusts book-keeping so that given number of samples are removed fr | ||||
om beginning of the | ||||
/// sample buffer without copying them anywhere. | ||||
/// | ||||
/// Used to reduce the number of samples in the buffer when accessing t | ||||
he sample buffer directly | ||||
/// with 'ptrBegin' function. | ||||
virtual uint receiveSamples(uint maxSamples ///< Remove this many sam | ||||
ples from the beginning of pipe. | ||||
); | ||||
/// Clears all the samples in the object's output and internal processi ng | /// Clears all the samples in the object's output and internal processi ng | |||
/// buffers. | /// buffers. | |||
virtual void clear(); | virtual void clear(); | |||
/// Changes a setting controlling the processing system behaviour. See the | /// Changes a setting controlling the processing system behaviour. See the | |||
/// 'SETTING_...' defines for available setting ID's. | /// 'SETTING_...' defines for available setting ID's. | |||
/// | /// | |||
/// \return 'true' if the setting was succesfully changed | /// \return 'true' if the setting was succesfully changed | |||
bool setSetting(int settingId, ///< Setting ID number. see SETTING_.. . defines. | bool setSetting(int settingId, ///< Setting ID number. see SETTING_.. . defines. | |||
int value ///< New setting value. | int value ///< New setting value. | |||
End of changes. 18 change blocks. | ||||
16 lines changed or deleted | 49 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |