Mercurial > hg > sonic-visualiser
diff audioio/AudioCallbackPlaySource.h @ 41:fbd7a497fd89
* Audition effects plugins during playback
author | Chris Cannam |
---|---|
date | Wed, 04 Oct 2006 11:01:39 +0000 |
parents | e3b32dc5180b |
children | c0ae41c72421 |
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.h Tue Oct 03 15:01:50 2006 +0000 +++ b/audioio/AudioCallbackPlaySource.h Wed Oct 04 11:01:39 2006 +0000 @@ -37,6 +37,7 @@ class AudioGenerator; class PlayParameters; class PhaseVocoderTimeStretcher; +class RealTimePluginInstance; /** * AudioCallbackPlaySource manages audio data supply to callback-based @@ -192,6 +193,23 @@ */ void setResampleQuality(int q); + /** + * Set a single real-time plugin as a processing effect for + * auditioning during playback. + * + * The plugin must have been initialised with + * getTargetChannelCount() channels and a getTargetBlockSize() + * sample frame processing block size. + * + * This playback source takes ownership of the plugin, which will + * be deleted at some point after the following call to + * setAuditioningPlugin (depending on real-time constraints). + * + * Pass a null pointer to remove the current auditioning plugin, + * if any. + */ + void setAuditioningPlugin(RealTimePluginInstance *plugin); + signals: void modelReplaced(); @@ -220,23 +238,25 @@ } }; - std::set<Model *> m_models; - RingBufferVector *m_readBuffers; - RingBufferVector *m_writeBuffers; - size_t m_readBufferFill; - size_t m_writeBufferFill; - Scavenger<RingBufferVector> m_bufferScavenger; - size_t m_sourceChannelCount; - size_t m_blockSize; - size_t m_sourceSampleRate; - size_t m_targetSampleRate; - size_t m_playLatency; - bool m_playing; - bool m_exiting; - size_t m_lastModelEndFrame; - static const size_t m_ringBufferSize; - float m_outputLeft; - float m_outputRight; + std::set<Model *> m_models; + RingBufferVector *m_readBuffers; + RingBufferVector *m_writeBuffers; + size_t m_readBufferFill; + size_t m_writeBufferFill; + Scavenger<RingBufferVector> m_bufferScavenger; + size_t m_sourceChannelCount; + size_t m_blockSize; + size_t m_sourceSampleRate; + size_t m_targetSampleRate; + size_t m_playLatency; + bool m_playing; + bool m_exiting; + size_t m_lastModelEndFrame; + static const size_t m_ringBufferSize; + float m_outputLeft; + float m_outputRight; + RealTimePluginInstance *m_auditioningPlugin; + Scavenger<RealTimePluginInstance> m_pluginScavenger; RingBuffer<float> *getWriteRingBuffer(size_t c) { if (m_writeBuffers && c < m_writeBuffers->size()) { @@ -271,6 +291,9 @@ // frame argument passed in, in the case of looping). size_t mixModels(size_t &frame, size_t count, float **buffers); + // Called from getSourceSamples. + void applyAuditioningEffect(size_t count, float **buffers); + class AudioCallbackPlaySourceFillThread : public Thread { public: