Mercurial > hg > sonic-visualiser
comparison audioio/AudioCallbackPlaySource.h @ 32:e3b32dc5180b
* Make resampler quality configurable
* Fall back to linear resampling when playing very fast
* Switch off transient detection in time stretcher when playing very very fast
author | Chris Cannam |
---|---|
date | Thu, 21 Sep 2006 11:17:19 +0000 |
parents | d88d117e0c34 |
children | fbd7a497fd89 |
comparison
equal
deleted
inserted
replaced
31:37af203dbd15 | 32:e3b32dc5180b |
---|---|
16 #ifndef _AUDIO_CALLBACK_PLAY_SOURCE_H_ | 16 #ifndef _AUDIO_CALLBACK_PLAY_SOURCE_H_ |
17 #define _AUDIO_CALLBACK_PLAY_SOURCE_H_ | 17 #define _AUDIO_CALLBACK_PLAY_SOURCE_H_ |
18 | 18 |
19 #include "base/RingBuffer.h" | 19 #include "base/RingBuffer.h" |
20 #include "base/AudioPlaySource.h" | 20 #include "base/AudioPlaySource.h" |
21 #include "base/PropertyContainer.h" | |
21 #include "base/Scavenger.h" | 22 #include "base/Scavenger.h" |
22 | 23 |
23 #include <QObject> | 24 #include <QObject> |
24 #include <QMutex> | 25 #include <QMutex> |
25 #include <QWaitCondition> | 26 #include <QWaitCondition> |
175 * audio data, in all channels. This may safely be called from a | 176 * audio data, in all channels. This may safely be called from a |
176 * realtime thread. | 177 * realtime thread. |
177 */ | 178 */ |
178 size_t getSourceSamples(size_t count, float **buffer); | 179 size_t getSourceSamples(size_t count, float **buffer); |
179 | 180 |
181 /** | |
182 * Set the time stretcher factor (i.e. playback speed). Also | |
183 * specify whether the time stretcher will be variable rate | |
184 * (sharpening transients), and whether time stretching will be | |
185 * carried out on data mixed down to mono for speed. | |
186 */ | |
180 void setTimeStretch(float factor, bool sharpen, bool mono); | 187 void setTimeStretch(float factor, bool sharpen, bool mono); |
188 | |
189 /** | |
190 * Set the resampler quality, 0 - 2 where 0 is fastest and 2 is | |
191 * highest quality. | |
192 */ | |
193 void setResampleQuality(int q); | |
181 | 194 |
182 signals: | 195 signals: |
183 void modelReplaced(); | 196 void modelReplaced(); |
184 | 197 |
185 void playStatusChanged(bool isPlaying); | 198 void playStatusChanged(bool isPlaying); |
189 protected slots: | 202 protected slots: |
190 void selectionChanged(); | 203 void selectionChanged(); |
191 void playLoopModeChanged(); | 204 void playLoopModeChanged(); |
192 void playSelectionModeChanged(); | 205 void playSelectionModeChanged(); |
193 void playParametersChanged(PlayParameters *); | 206 void playParametersChanged(PlayParameters *); |
207 void preferenceChanged(PropertyContainer::PropertyName); | |
194 | 208 |
195 protected: | 209 protected: |
196 ViewManager *m_viewManager; | 210 ViewManager *m_viewManager; |
197 AudioGenerator *m_audioGenerator; | 211 AudioGenerator *m_audioGenerator; |
198 | 212 |
272 | 286 |
273 QMutex m_mutex; | 287 QMutex m_mutex; |
274 QWaitCondition m_condition; | 288 QWaitCondition m_condition; |
275 AudioCallbackPlaySourceFillThread *m_fillThread; | 289 AudioCallbackPlaySourceFillThread *m_fillThread; |
276 SRC_STATE *m_converter; | 290 SRC_STATE *m_converter; |
291 SRC_STATE *m_crapConverter; // for use when playing very fast | |
292 int m_resampleQuality; | |
293 void initialiseConverter(); | |
277 }; | 294 }; |
278 | 295 |
279 #endif | 296 #endif |
280 | 297 |
281 | 298 |