diff options
author | David Robillard <d@drobilla.net> | 2007-06-20 03:05:16 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-06-20 03:05:16 +0000 |
commit | 8ae580427987b4eefc102f3e801c1b76fdc74d48 (patch) | |
tree | 52d9ffe3e964bc96d60dae929c5c3c834bccf107 /libs/ardour/ardour | |
parent | 996d59663f83200c0716f1ba7bccc486d52bee7e (diff) |
Made plugin input/output counts multi-typed (towards MIDI plugins, instruments, etc).
Cleaning up/genericification of Insert interface.
Fixed meter count for pre-fader metering (was # inputs, not # channels at end of pre-fader redirect list).
Work on redirect list stream handling, better error reporting (towards automatically adding 'adaptors' in the future?).
git-svn-id: svn://localhost/ardour2/trunk@2025 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/chan_count.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/insert.h | 26 | ||||
-rw-r--r-- | libs/ardour/ardour/plugin.h | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 39 |
4 files changed, 44 insertions, 28 deletions
diff --git a/libs/ardour/ardour/chan_count.h b/libs/ardour/ardour/chan_count.h index a859c37b5a..1ed50f7abb 100644 --- a/libs/ardour/ardour/chan_count.h +++ b/libs/ardour/ardour/chan_count.h @@ -47,6 +47,8 @@ public: // -1 is what to_index does. inlined for speed. this should maybe be changed.. inline size_t n_audio() const { return _counts[DataType::AUDIO-1]; } inline size_t n_midi() const { return _counts[DataType::MIDI-1]; } + inline void set_audio(size_t a) { _counts[DataType::AUDIO-1] = a; } + inline void set_midi(size_t m) { _counts[DataType::MIDI-1] = m; } size_t n_total() const { diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h index e58cb71754..10902a76b0 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/insert.h @@ -55,9 +55,13 @@ class Insert : public Redirect virtual void activate () {} virtual void deactivate () {} - virtual int32_t can_support_input_configuration (int32_t in) const = 0; - virtual int32_t configure_io (int32_t magic, int32_t in, int32_t out) = 0; - virtual int32_t compute_output_streams (int32_t cnt) const = 0; + virtual bool can_support_input_configuration (ChanCount in) const = 0; + virtual ChanCount output_for_input_configuration (ChanCount in) const = 0; + virtual bool configure_io (ChanCount in, ChanCount out) = 0; + +protected: + bool _configured; + ChanCount _configured_input; }; class PortInsert : public Insert @@ -81,9 +85,9 @@ class PortInsert : public Insert ChanCount output_streams() const; ChanCount input_streams() const; - int32_t can_support_input_configuration (int32_t) const; - int32_t configure_io (int32_t magic, int32_t in, int32_t out); - int32_t compute_output_streams (int32_t cnt) const; + virtual bool can_support_input_configuration (ChanCount in) const; + virtual ChanCount output_for_input_configuration (ChanCount in) const; + virtual bool configure_io (ChanCount in, ChanCount out); uint32_t bit_slot() const { return bitslot; } @@ -118,12 +122,12 @@ class PluginInsert : public Insert ChanCount natural_output_streams() const; ChanCount natural_input_streams() const; - int set_count (uint32_t num); + bool set_count (uint32_t num); uint32_t get_count () const { return _plugins.size(); } - int32_t can_support_input_configuration (int32_t) const; - int32_t configure_io (int32_t magic, int32_t in, int32_t out); - int32_t compute_output_streams (int32_t cnt) const; + virtual bool can_support_input_configuration (ChanCount in) const; + virtual ChanCount output_for_input_configuration (ChanCount in) const; + virtual bool configure_io (ChanCount in, ChanCount out); bool is_generator() const; @@ -166,6 +170,8 @@ class PluginInsert : public Insert void auto_state_changed (uint32_t which); void automation_list_creation_callback (uint32_t, AutomationList&); + int32_t count_for_configuration (ChanCount in, ChanCount out) const; + boost::shared_ptr<Plugin> plugin_factory (boost::shared_ptr<Plugin>); }; diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index feb86f1b7b..b1a2823b33 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -28,6 +28,7 @@ #include <jack/types.h> #include <ardour/types.h> +#include <ardour/chan_count.h> #include <ardour/plugin_state.h> #include <ardour/cycles.h> @@ -60,8 +61,8 @@ class PluginInfo { string name; string category; - uint32_t n_inputs; - uint32_t n_outputs; + ChanCount n_inputs; + ChanCount n_outputs; ARDOUR::PluginType type; long unique_id; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index ed839f091b..b5d1fa03d6 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -159,15 +159,23 @@ class Route : public IO } ChanCount max_redirect_outs () const { return redirect_max_outs; } + ChanCount pre_fader_streams() const; - // FIXME: remove/replace err_streams parameters with something appropriate - // they are used by 'wierd_plugin_dialog'(sic) to display the number of input streams - // at the insertion point if the insert fails - int add_redirect (boost::shared_ptr<Redirect>, void *src, uint32_t* err_streams = 0); - int add_redirects (const RedirectList&, void *src, uint32_t* err_streams = 0); - int remove_redirect (boost::shared_ptr<Redirect>, void *src, uint32_t* err_streams = 0); - int copy_redirects (const Route&, Placement, uint32_t* err_streams = 0); - int sort_redirects (uint32_t* err_streams = 0); + /** A record of the stream configuration at some point in the redirect list. + * Used to return where and why a redirect list configuration request failed. + */ + struct InsertStreams { + InsertStreams(size_t i=0, ChanCount c=ChanCount()) : index(i), count(c) {} + + size_t index; ///< Index of redirect where configuration failed + ChanCount count; ///< Input requested of redirect + }; + + int add_redirect (boost::shared_ptr<Redirect>, void *src, InsertStreams* err = 0); + int add_redirects (const RedirectList&, void *src, InsertStreams* err = 0); + int remove_redirect (boost::shared_ptr<Redirect>, void *src, InsertStreams* err = 0); + int copy_redirects (const Route&, Placement, InsertStreams* err = 0); + int sort_redirects (InsertStreams* err = 0); void disable_redirects (Placement); void disable_redirects (); void disable_plugins (Placement); @@ -347,22 +355,21 @@ class Route : public IO void output_change_handler (IOChange, void *src); bool legal_redirect (Redirect&); - int reset_plugin_counts (uint32_t*); /* locked */ - int _reset_plugin_counts (uint32_t*); /* unlocked */ + int reset_plugin_counts (InsertStreams*); /* locked */ + int _reset_plugin_counts (InsertStreams*); /* unlocked */ - /* plugin count handling */ + /* insert I/O channels and plugin count handling */ struct InsertCount { boost::shared_ptr<ARDOUR::Insert> insert; - int32_t cnt; - int32_t in; - int32_t out; + ChanCount in; + ChanCount out; - InsertCount (boost::shared_ptr<ARDOUR::Insert> ins) : insert (ins), cnt (-1) {} + InsertCount (boost::shared_ptr<ARDOUR::Insert> ins) : insert(ins) {} }; int32_t apply_some_plugin_counts (std::list<InsertCount>& iclist); - int32_t check_some_plugin_counts (std::list<InsertCount>& iclist, int32_t required_inputs, uint32_t* err_streams); + bool check_some_plugin_counts (std::list<InsertCount>& iclist, ChanCount required_inputs, InsertStreams* err_streams); void set_deferred_state (); void add_redirect_from_xml (const XMLNode&); |