diff options
author | Taybin Rutkin <taybin@taybin.com> | 2006-08-10 04:01:15 +0000 |
---|---|---|
committer | Taybin Rutkin <taybin@taybin.com> | 2006-08-10 04:01:15 +0000 |
commit | 77a13df5bd70bf87ee856b81acec7eeed5b1f033 (patch) | |
tree | a3b6fcceecc0ab7f5607c986cfc4c4d88b2ad2d4 /libs/ardour | |
parent | d4dd338beb813bcfe7470729cf6611aeea55cfa4 (diff) |
Moved PluginInfo::Type to ARDOUR::PluginType in ardour/types.h.
Figured out (mostly) AUPluginUI hierarchy.
Moved LadspaPluginUI to its own ladspa_pluginui.cc file.
git-svn-id: svn://localhost/ardour2/trunk@782 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/audio_unit.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/insert.h | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/plugin.h | 13 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 10 | ||||
-rw-r--r-- | libs/ardour/ardour/vst_plugin.h | 2 | ||||
-rw-r--r-- | libs/ardour/audio_unit.cc | 2 | ||||
-rw-r--r-- | libs/ardour/insert.cc | 52 | ||||
-rw-r--r-- | libs/ardour/plugin.cc | 8 | ||||
-rw-r--r-- | libs/ardour/plugin_manager.cc | 4 |
9 files changed, 75 insertions, 23 deletions
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 1c8d6cbc2d..348a8ff863 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -96,6 +96,8 @@ class AUPlugin : public ARDOUR::Plugin std::vector<std::pair<uint32_t, uint32_t> > parameter_map; }; +typedef boost::shared_ptr<AUPlugin> AUPluginPtr; + class AUPluginInfo : public PluginInfo { public: AUPluginInfo () { }; diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h index a4c4439942..c81d4e5761 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/insert.h @@ -29,6 +29,7 @@ #include <ardour/ardour.h> #include <ardour/redirect.h> #include <ardour/plugin_state.h> +#include <ardour/types.h> class XMLNode; @@ -39,8 +40,8 @@ namespace MIDI { namespace ARDOUR { class Session; -class Plugin; class Route; +class Plugin; class Insert : public Redirect { @@ -149,6 +150,8 @@ class PluginInsert : public Insert } } + PluginType type (); + string describe_parameter (uint32_t); jack_nframes_t latency(); diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 6b11a975ca..e5a81f1ef9 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -47,27 +47,22 @@ class AudioEngine; class Session; class Plugin; + typedef boost::shared_ptr<Plugin> PluginPtr; class PluginInfo { public: - enum Type { - AudioUnit, - LADSPA, - VST - }; - PluginInfo () { } PluginInfo (const PluginInfo &o) : name(o.name), n_inputs(o.n_inputs), n_outputs(o.n_outputs), unique_id(o.unique_id), path (o.path), index(o.index) {} virtual ~PluginInfo () { } - + string name; string category; uint32_t n_inputs; uint32_t n_outputs; - Type type; + ARDOUR::PluginType type; long unique_id; @@ -187,7 +182,7 @@ class Plugin : public Stateful, public sigc::trackable vector<PortControllable*> controls; }; -PluginPtr find_plugin(ARDOUR::Session&, string name, long unique_id, PluginInfo::Type); +PluginPtr find_plugin(ARDOUR::Session&, string name, long unique_id, ARDOUR::PluginType); } // namespace ARDOUR diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index b2230f12d7..0a3a7b731c 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -243,7 +243,14 @@ namespace ARDOUR { PeakDatum min; PeakDatum max; }; -} + + enum PluginType { + AudioUnit, + LADSPA, + VST + }; + +} // namespace ARDOUR std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf); std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf); @@ -254,7 +261,6 @@ session_frame_to_track_frame (jack_nframes_t session_frame, double speed) return (jack_nframes_t)( (double)session_frame * speed ); } - static inline jack_nframes_t track_frame_to_session_frame (jack_nframes_t track_frame, double speed) { diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 5253da7b0a..4fb5b0babb 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -113,6 +113,8 @@ class VSTPluginInfo : public PluginInfo PluginPtr load (Session& session); }; +typedef boost::shared_ptr<VSTPluginInfo> VSTPluginInfoPtr; + } // namespace ARDOUR #endif /* __ardour_vst_plugin_h__ */ diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 25c8aeb53b..0a31df40ee 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -322,7 +322,7 @@ AUPluginInfo::discover () AUPluginInfoPtr plug(new AUPluginInfo); plug->name = AUPluginInfo::get_name (temp); - plug->type = PluginInfo::AudioUnit; + plug->type = ARDOUR::AudioUnit; plug->n_inputs = 0; plug->n_outputs = 0; plug->category = "AudioUnit"; diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index a057fef931..18727e8b5b 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -30,9 +30,18 @@ #include <ardour/port.h> #include <ardour/route.h> #include <ardour/ladspa_plugin.h> + +#ifdef VST_SUPPORT #include <ardour/vst_plugin.h> +#endif + +#ifdef HAVE_COREAUDIO +#include <ardour/audio_unit.h> +#endif + #include <ardour/audioengine.h> #include <ardour/session.h> +#include <ardour/types.h> #include "i18n.h" @@ -45,7 +54,6 @@ Insert::Insert(Session& s, Placement p) { } - Insert::Insert(Session& s, Placement p, int imin, int imax, int omin, int omax) : Redirect (s, s.next_insert_name(), p, imin, imax, omin, omax) { @@ -505,6 +513,9 @@ PluginInsert::plugin_factory (boost::shared_ptr<Plugin> other) #ifdef VST_SUPPORT boost::shared_ptr<VSTPlugin> vp; #endif +#ifdef HAVE_COREAUDIO + boost::shared_ptr<AUPlugin> ap; +#endif if ((lp = boost::dynamic_pointer_cast<LadspaPlugin> (other)) != 0) { return boost::shared_ptr<Plugin> (new LadspaPlugin (*lp)); @@ -512,6 +523,10 @@ PluginInsert::plugin_factory (boost::shared_ptr<Plugin> other) } else if ((vp = boost::dynamic_pointer_cast<VSTPlugin> (other)) != 0) { return boost::shared_ptr<Plugin> (new VSTPlugin (*vp)); #endif +#ifdef HAVE_COREAUDIO + } else if ((ap = boost::dynamic_pointer_cast<AUPlugin> (other)) != 0) { + return boost::shared_ptr<Plugin> (new AUPlugin (*ap)); +#endif } fatal << string_compose (_("programming error: %1"), @@ -630,7 +645,7 @@ PluginInsert::set_state(const XMLNode& node) XMLPropertyList plist; const XMLProperty *prop; long unique = 0; - PluginInfo::Type type; + ARDOUR::PluginType type; if ((prop = node.property ("type")) == 0) { error << _("XML node describing insert is missing the `type' field") << endmsg; @@ -638,9 +653,9 @@ PluginInsert::set_state(const XMLNode& node) } if (prop->value() == X_("ladspa") || prop->value() == X_("Ladspa")) { /* handle old school sessions */ - type = PluginInfo::LADSPA; + type = ARDOUR::LADSPA; } else if (prop->value() == X_("vst")) { - type = PluginInfo::VST; + type = ARDOUR::VST; } else { error << string_compose (_("unknown plugin type %1 in plugin insert state"), prop->value()) @@ -807,6 +822,35 @@ PluginInsert::state_factory (std::string why) const return state; } +ARDOUR::PluginType +PluginInsert::type () +{ + boost::shared_ptr<LadspaPlugin> lp; +#ifdef VST_SUPPORT + boost::shared_ptr<VSTPlugin> vp; +#endif +#ifdef HAVE_COREAUDIO + boost::shared_ptr<AUPlugin> ap; +#endif + + PluginPtr other = plugin (); + + if ((lp = boost::dynamic_pointer_cast<LadspaPlugin> (other)) != 0) { + return ARDOUR::LADSPA; +#ifdef VST_SUPPORT + } else if ((vp = boost::dynamic_pointer_cast<VSTPlugin> (other)) != 0) { + return ARDOUR::VST; +#endif +#ifdef HAVE_COREAUDIO + } else if ((ap = boost::dynamic_pointer_cast<AUPlugin> (other)) != 0) { + return ARDOUR::AudioUnit; +#endif + } else { + /* NOT REACHED */ + return (ARDOUR::PluginType) 0; + } +} + /*************************************************************** Port inserts: send output to a port, pick up input at a port ***************************************************************/ diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index 8ea95b8903..bedc32a0b3 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -244,25 +244,25 @@ Plugin::save_preset (string name, string domain) } PluginPtr -ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::Type type) +ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginType type) { PluginManager *mgr = PluginManager::the_manager(); PluginInfoList plugs; switch (type) { - case PluginInfo::LADSPA: + case ARDOUR::LADSPA: plugs = mgr->ladspa_plugin_info(); break; #ifdef VST_SUPPORT - case PluginInfo::VST: + case ARDOUR::VST: plugs = mgr->vst_plugin_info(); unique_id = 0; // VST plugins don't have a unique id. break; #endif #ifdef HAVE_COREAUDIO - case PluginInfo::AudioUnit: + case ARDOUR::AudioUnit: plugs = AUPluginInfo::discover (); unique_id = 0; // Neither do AU. break; diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 2a753617e8..5b3a4658a8 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -254,7 +254,7 @@ PluginManager::ladspa_discover (string path) info->index = i; info->n_inputs = 0; info->n_outputs = 0; - info->type = PluginInfo::LADSPA; + info->type = ARDOUR::LADSPA; info->unique_id = descriptor->UniqueID; for (uint32_t n=0; n < descriptor->PortCount; ++n) { @@ -397,7 +397,7 @@ PluginManager::vst_discover (string path) info->index = 0; info->n_inputs = finfo->numInputs; info->n_outputs = finfo->numOutputs; - info->type = PluginInfo::VST; + info->type = ARDOUR::VST; _vst_plugin_info.push_back (info); fst_free_info (finfo); |