changeset 389:a1b6d2e33cab

* document library dependencies * remove dependency of transform on audioio
author Chris Cannam
date Thu, 13 Mar 2008 10:12:14 +0000
parents 370aa9714ef5
children 21e79997e80f
files base/AudioPlaySource.h data/model/SparseModel.h plugin/RealTimePluginInstance.h transform/ModelTransformerFactory.cpp transform/ModelTransformerFactory.h
diffstat 5 files changed, 40 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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;
     }
 }
 
--- 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 <string>
 #include <map>
 
+#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;
--- 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 <iostream>
 #include <set>
 
@@ -71,7 +71,7 @@
 ModelTransformerFactory::getConfigurationForTransform(Transform &transform,
                                                       const std::vector<Model *> &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;
         }
--- 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<Model *> &candidateInputModels,
                                  Model *defaultInputModel,
-                                 AudioCallbackPlaySource *source = 0,
+                                 AudioPlaySource *source = 0,
                                  size_t startFrame = 0,
                                  size_t duration = 0);