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
This commit is contained in:
Taybin Rutkin
2006-08-10 04:01:15 +00:00
parent d4dd338beb
commit 77a13df5bd
17 changed files with 903 additions and 786 deletions

View File

@@ -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 () { };

View File

@@ -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();

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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__ */

View File

@@ -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";

View File

@@ -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,12 +513,19 @@ 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));
#ifdef VST_SUPPORT
} 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
}
@@ -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
***************************************************************/

View File

@@ -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;

View File

@@ -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);