# HG changeset patch # User Chris Cannam # Date 1205403134 0 # Node ID a1b6d2e33cabc95e0ffb9e480c674634ee8dbedc # Parent 370aa9714ef5dc0b037bb9c9b397d1d274072e7c * document library dependencies * remove dependency of transform on audioio diff -r 370aa9714ef5 -r a1b6d2e33cab base/AudioPlaySource.h --- a/base/AudioPlaySource.h Wed Mar 12 18:02:17 2008 +0000 +++ b/base/AudioPlaySource.h Thu Mar 13 10:12:14 2008 +0000 @@ -16,6 +16,10 @@ #ifndef _AUDIO_PLAY_SOURCE_H_ #define _AUDIO_PLAY_SOURCE_H_ +struct Auditionable { + virtual ~Auditionable() { } +}; + /** * Simple interface for audio playback. This should be all that the * ViewManager needs to know about to synchronise with playback by @@ -69,7 +73,29 @@ * source and target sample rates differ, resampling will occur. */ virtual size_t getTargetSampleRate() const = 0; - + + /** + * Get the block size of the target audio device. This may be an + * estimate or upper bound, if the target has a variable block + * size; the source should behave itself even if this value turns + * out to be inaccurate. + */ + virtual size_t getTargetBlockSize() const = 0; + + /** + * Get the number of channels of audio that will be provided + * to the play target. This may be more than the source channel + * count: for example, a mono source will provide 2 channels + * after pan. + */ + virtual size_t getTargetChannelCount() const = 0; + + /** + * Set a plugin or other subclass of Auditionable as an + * auditioning effect. + */ + virtual void setAuditioningEffect(Auditionable *) = 0; + }; #endif diff -r 370aa9714ef5 -r a1b6d2e33cab data/model/SparseModel.h --- a/data/model/SparseModel.h Wed Mar 12 18:02:17 2008 +0000 +++ b/data/model/SparseModel.h Thu Mar 13 10:12:14 2008 +0000 @@ -607,6 +607,7 @@ return this; } else { delete this; + return 0; } } diff -r 370aa9714ef5 -r a1b6d2e33cab plugin/RealTimePluginInstance.h --- a/plugin/RealTimePluginInstance.h Wed Mar 12 18:02:17 2008 +0000 +++ b/plugin/RealTimePluginInstance.h Thu Mar 13 10:12:14 2008 +0000 @@ -30,6 +30,8 @@ #include #include +#include "base/AudioPlaySource.h" + class RealTimePluginFactory; /** @@ -72,7 +74,7 @@ static const int SampleRate = 8; } -class RealTimePluginInstance : public Vamp::PluginBase +class RealTimePluginInstance : public Vamp::PluginBase, public Auditionable { public: typedef float sample_t; diff -r 370aa9714ef5 -r a1b6d2e33cab transform/ModelTransformerFactory.cpp --- a/transform/ModelTransformerFactory.cpp Wed Mar 12 18:02:17 2008 +0000 +++ b/transform/ModelTransformerFactory.cpp Thu Mar 13 10:12:14 2008 +0000 @@ -20,6 +20,8 @@ #include "TransformFactory.h" +#include "base/AudioPlaySource.h" + #include "plugin/FeatureExtractionPluginFactory.h" #include "plugin/RealTimePluginFactory.h" #include "plugin/PluginXml.h" @@ -30,8 +32,6 @@ #include "vamp-sdk/PluginHostAdapter.h" -#include "audioio/AudioCallbackPlaySource.h" //!!! shouldn't include here - #include #include @@ -71,7 +71,7 @@ ModelTransformerFactory::getConfigurationForTransform(Transform &transform, const std::vector &candidateInputModels, Model *defaultInputModel, - AudioCallbackPlaySource *source, + AudioPlaySource *source, size_t startFrame, size_t duration) { @@ -179,7 +179,7 @@ plugin = rtp; if (effect && source && rtp) { - source->setAuditioningPlugin(rtp); + source->setAuditioningEffect(rtp); } } @@ -291,7 +291,7 @@ delete dialog; if (effect && source) { - source->setAuditioningPlugin(0); // will delete our plugin + source->setAuditioningEffect(0); // will delete our plugin } else { delete plugin; } diff -r 370aa9714ef5 -r a1b6d2e33cab transform/ModelTransformerFactory.h --- a/transform/ModelTransformerFactory.h Wed Mar 12 18:02:17 2008 +0000 +++ b/transform/ModelTransformerFactory.h Thu Mar 13 10:12:14 2008 +0000 @@ -26,7 +26,7 @@ namespace Vamp { class PluginBase; } -class AudioCallbackPlaySource; +class AudioPlaySource; class ModelTransformerFactory : public QObject { @@ -41,15 +41,14 @@ * Fill out the configuration for the given transform (by asking * the user, most likely). Returns the selected input model and * channel if the transform is acceptable, or an input with a null - * model if the operation should be cancelled. Audio callback - * play source may be used to audition effects plugins, if - * provided. + * model if the operation should be cancelled. Audio play source + * may be used to audition effects plugins, if provided. */ ModelTransformer::Input getConfigurationForTransform(Transform &transform, const std::vector &candidateInputModels, Model *defaultInputModel, - AudioCallbackPlaySource *source = 0, + AudioPlaySource *source = 0, size_t startFrame = 0, size_t duration = 0);