fix merge errors with master
[ardour.git] / libs / ardour / ardour / audio_unit.h
index f36e89073bb53cd82e38c5f450cb2c67d9d2cb1e..07f41f55261b0d304673918e9497966e84623339 100644 (file)
 class CAComponent;
 class CAAudioUnit;
 class CAComponentDescription;
-struct AudioBufferList;
+struct LIBARDOUR_API AudioBufferList;
 
 namespace ARDOUR {
 
 class AudioEngine;
 class Session;
 
-struct AUParameterDescriptor : public Plugin::ParameterDescriptor {
+struct LIBARDOUR_API AUParameterDescriptor : public Plugin::ParameterDescriptor {
        // additional fields to make operations more efficient
        AudioUnitParameterID id;
        AudioUnitScope scope;
@@ -58,7 +58,7 @@ struct AUParameterDescriptor : public Plugin::ParameterDescriptor {
        AudioUnitParameterUnit unit;
 };
 
-class AUPlugin : public ARDOUR::Plugin
+class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
 {
   public:
        AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> comp);
@@ -94,17 +94,19 @@ class AUPlugin : public ARDOUR::Plugin
        bool parameter_is_control (uint32_t) const;
        bool parameter_is_input (uint32_t) const;
        bool parameter_is_output (uint32_t) const;
+       
+       void set_info (PluginInfoPtr);
 
        int set_state(const XMLNode& node, int);
 
-       PresetRecord save_preset (std::string name);
        bool load_preset (PresetRecord);
        std::string current_preset() const;
 
        bool has_editor () const;
 
-       bool reconfigurable_io() const { return true; }
-       bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
+       bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
+       ChanCount output_streams() const;
+       ChanCount input_streams() const;
        bool configure_io (ChanCount in, ChanCount out);
        bool requires_fixed_size_buffers() const;
 
@@ -140,6 +142,21 @@ class AUPlugin : public ARDOUR::Plugin
 
        static std::string maybe_fix_broken_au_id (const std::string&);
 
+        /* this MUST be called from thread in which you want to receive notifications
+          about parameter changes.
+       */
+       int create_parameter_listener (AUEventListenerProc callback, void *arg, float interval_secs);
+        /* these can be called from any thread but SHOULD be called from the same thread
+          that will receive parameter change notifications.
+       */
+       int listen_to_parameter (uint32_t param_id);
+       int end_listen_to_parameter (uint32_t param_id);
+
+
+  protected:
+       std::string do_save_preset (std::string name);
+       void do_remove_preset (std::string);
+
   private:
        void find_presets ();
 
@@ -180,29 +197,35 @@ class AUPlugin : public ARDOUR::Plugin
        void discover_parameters ();
        void add_state (XMLNode *) const;
 
-       std::vector<std::pair<uint32_t, uint32_t> > parameter_map;
-       uint32_t current_maxbuf;
-       framecnt_t current_offset;
+       typedef std::map<uint32_t, uint32_t> ParameterMap;
+       ParameterMap parameter_map;
+       uint32_t   input_maxbuf;
+       framecnt_t input_offset;
        framecnt_t cb_offset;
-       BufferSet* current_buffers;
+       BufferSet* input_buffers;
        framecnt_t frames_processed;
 
        std::vector<AUParameterDescriptor> descriptors;
+       AUEventListenerRef _parameter_listener;
+       void * _parameter_listener_arg;
        void init ();
 
        void discover_factory_presets ();
 
        bool      last_transport_rolling;
        float     last_transport_speed;
+
+       static void _parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUnitEvent* event, UInt64 host_time, Float32 new_value);
+       void parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUnitEvent* event, UInt64 host_time, Float32 new_value);
 };
 
 typedef boost::shared_ptr<AUPlugin> AUPluginPtr;
 
-struct AUPluginCachedInfo {
+struct LIBARDOUR_API AUPluginCachedInfo {
        std::vector<std::pair<int,int> > io_configs;
 };
 
-class AUPluginInfo : public PluginInfo {
+class LIBARDOUR_API AUPluginInfo : public PluginInfo {
   public:
         AUPluginInfo (boost::shared_ptr<CAComponentDescription>);
        ~AUPluginInfo ();
@@ -217,6 +240,8 @@ class AUPluginInfo : public PluginInfo {
 
        AUPluginCachedInfo cache;
 
+       bool reconfigurable_io() const { return true; }
+
        static PluginInfoList* discover ();
        static void get_names (CAComponentDescription&, std::string& name, std::string& maker);
        static std::string stringify_descriptor (const CAComponentDescription&);