00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 // 00044 // Last changed : $Date$ 00045 // File revision : $Revision$ 00046 // 00047 // $Id$ 00048 // 00050 // 00051 // License : 00052 // 00053 // SoundTouch audio processing library 00054 // Copyright (c) Olli Parviainen 00055 // 00056 // This library is free software; you can redistribute it and/or 00057 // modify it under the terms of the GNU Lesser General Public 00058 // License as published by the Free Software Foundation; either 00059 // version 2.1 of the License, or (at your option) any later version. 00060 // 00061 // This library is distributed in the hope that it will be useful, 00062 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00063 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00064 // Lesser General Public License for more details. 00065 // 00066 // You should have received a copy of the GNU Lesser General Public 00067 // License along with this library; if not, write to the Free Software 00068 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00069 // 00071 00072 #ifndef SoundTouch_H 00073 #define SoundTouch_H 00074 00075 #include "FIFOSamplePipe.h" 00076 #include "STTypes.h" 00077 00078 namespace soundtouch 00079 { 00080 00082 #define SOUNDTOUCH_VERSION "1.3.1" 00083 00085 #define SOUNDTOUCH_VERSION_ID 010301 00086 00087 // 00088 // Available setting IDs for the 'setSetting' & 'get_setting' functions: 00089 00091 #define SETTING_USE_AA_FILTER 0 00092 00094 #define SETTING_AA_FILTER_LENGTH 1 00095 00099 #define SETTING_USE_QUICKSEEK 2 00100 00104 #define SETTING_SEQUENCE_MS 3 00105 00110 #define SETTING_SEEKWINDOW_MS 4 00111 00116 #define SETTING_OVERLAP_MS 5 00117 00118 00119 class SoundTouch : public FIFOProcessor 00120 { 00121 private: 00123 class RateTransposer *pRateTransposer; 00124 00126 class TDStretch *pTDStretch; 00127 00129 float virtualRate; 00130 00132 float virtualTempo; 00133 00135 float virtualPitch; 00136 00138 BOOL bSrateSet; 00139 00142 void calcEffectiveRateAndTempo(); 00143 00144 protected : 00146 uint channels; 00147 00149 float rate; 00150 00152 float tempo; 00153 00154 public: 00155 SoundTouch(); 00156 virtual ~SoundTouch(); 00157 00159 static const char *getVersionString(); 00160 00162 static uint getVersionId(); 00163 00166 void setRate(float newRate); 00167 00170 void setTempo(float newTempo); 00171 00174 void setRateChange(float newRate); 00175 00178 void setTempoChange(float newTempo); 00179 00182 void setPitch(float newPitch); 00183 00186 void setPitchOctaves(float newPitch); 00187 00190 void setPitchSemiTones(int newPitch); 00191 void setPitchSemiTones(float newPitch); 00192 00194 void setChannels(uint numChannels); 00195 00197 void setSampleRate(uint srate); 00198 00201 // 00206 void flush(); 00207 00211 virtual void putSamples( 00212 const SAMPLETYPE *samples, 00213 uint numSamples 00214 00215 00216 ); 00217 00220 virtual void clear(); 00221 00226 BOOL setSetting(uint settingId, 00227 uint value 00228 ); 00229 00234 uint getSetting(uint settingId 00235 ) const; 00236 00238 virtual uint numUnprocessedSamples() const; 00239 00240 00249 }; 00250 00251 } 00252 #endif
1.6.3