make MIDI Patch Manager search in $user_config_dir/patchfiles for midnam files as...
[ardour.git] / libs / ardour / ardour / audio_unit.h
index 0a786d54624acf6d168866a87c798a0b1d06301a..14665da30199c141972bc0a493fff157f67f8a4d 100644 (file)
@@ -94,6 +94,8 @@ 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);
 
@@ -104,6 +106,8 @@ class AUPlugin : public ARDOUR::Plugin
 
        bool reconfigurable_io() const { return true; }
        bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
+       ChanCount output_streams() const;
+       ChanCount input_streams() const;
        bool configure_io (ChanCount in, ChanCount out);
        bool requires_fixed_size_buffers() const;
 
@@ -139,6 +143,17 @@ 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);
@@ -183,20 +198,26 @@ 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;