Added LADSPA_PATH to ardev_common.sh
Removed redundent added_plugins list from PluginSelector Started refactoring of PluginManager into PluginInfo PluginManager now uses shared_ptr<PluginInfo> git-svn-id: svn://localhost/ardour2/trunk@738 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -6,3 +6,6 @@ export LD_LIBRARY_PATH=../libs/surfaces/control_protocol:../libs/ardour:../libs/
|
||||
|
||||
# DYLD_LIBRARY_PATH is for darwin.
|
||||
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
||||
|
||||
# LADSPA_PATH for OSX
|
||||
export LADSPA_PATH=$LADSPA_PATH:/Library/Audio/Plug-Ins/LADSPA
|
||||
|
||||
@@ -51,7 +51,7 @@ PluginSelector::PluginSelector (PluginManager *mgr)
|
||||
o_selected_plug = -1;
|
||||
i_selected_plug = 0;
|
||||
|
||||
current_selection = ARDOUR::PluginInfo::LADSPA;
|
||||
current_selection = PluginInfo::LADSPA;
|
||||
|
||||
lmodel = Gtk::ListStore::create(lcols);
|
||||
ladspa_display.set_model (lmodel);
|
||||
@@ -226,8 +226,8 @@ void
|
||||
PluginSelector::input_refiller ()
|
||||
{
|
||||
guint row;
|
||||
list<PluginInfo *> &plugs = manager->ladspa_plugin_info ();
|
||||
list<PluginInfo *>::iterator i;
|
||||
PluginInfoList &plugs = manager->ladspa_plugin_info ();
|
||||
PluginInfoList::iterator i;
|
||||
char ibuf[16], obuf[16];
|
||||
lmodel->clear();
|
||||
|
||||
@@ -259,8 +259,8 @@ void
|
||||
PluginSelector::vst_refiller ()
|
||||
{
|
||||
guint row;
|
||||
list<PluginInfo *> &plugs = manager->vst_plugin_info ();
|
||||
list<PluginInfo *>::iterator i;
|
||||
PluginInfoList &plugs = manager->vst_plugin_info ();
|
||||
PluginInfoList::iterator i;
|
||||
char ibuf[16], obuf[16];
|
||||
vmodel->clear();
|
||||
|
||||
@@ -288,7 +288,7 @@ PluginSelector::vst_display_selection_changed()
|
||||
btn_add->set_sensitive (false);
|
||||
}
|
||||
|
||||
current_selection = ARDOUR::PluginInfo::VST;
|
||||
current_selection = PluginInfo::VST;
|
||||
}
|
||||
|
||||
#endif //VST_SUPPORT
|
||||
@@ -305,8 +305,8 @@ void
|
||||
PluginSelector::au_refiller ()
|
||||
{
|
||||
guint row;
|
||||
list<PluginInfo *> &plugs = manager->au_plugin_info ();
|
||||
list<PluginInfo *>::iterator i;
|
||||
PluginInfoList &plugs = manager->au_plugin_info ();
|
||||
PluginInfoList::iterator i;
|
||||
char ibuf[16], obuf[16];
|
||||
aumodel->clear();
|
||||
|
||||
@@ -334,17 +334,15 @@ PluginSelector::au_display_selection_changed()
|
||||
btn_add->set_sensitive (false);
|
||||
}
|
||||
|
||||
current_selection = ARDOUR::PluginInfo::AudioUnit;
|
||||
current_selection = PluginInfo::AudioUnit;
|
||||
}
|
||||
|
||||
#endif //HAVE_COREAUDIO
|
||||
|
||||
void
|
||||
PluginSelector::use_plugin (PluginInfo* pi)
|
||||
PluginSelector::use_plugin (PluginInfoPtr pi)
|
||||
{
|
||||
list<PluginInfo *>::iterator i;
|
||||
|
||||
if (pi == 0 || session == 0) {
|
||||
if (session == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -359,32 +357,29 @@ void
|
||||
PluginSelector::btn_add_clicked()
|
||||
{
|
||||
std::string name;
|
||||
ARDOUR::PluginInfo *pi;
|
||||
PluginInfoPtr pi;
|
||||
Gtk::TreeModel::Row newrow = *(amodel->append());
|
||||
|
||||
Gtk::TreeModel::Row row;
|
||||
|
||||
switch (current_selection) {
|
||||
case ARDOUR::PluginInfo::LADSPA:
|
||||
case PluginInfo::LADSPA:
|
||||
row = *(ladspa_display.get_selection()->get_selected());
|
||||
name = row[lcols.name];
|
||||
pi = row[lcols.plugin];
|
||||
added_plugins.push_back (row[lcols.plugin]);
|
||||
break;
|
||||
case ARDOUR::PluginInfo::VST:
|
||||
case PluginInfo::VST:
|
||||
#ifdef VST_SUPPORT
|
||||
row = *(vst_display.get_selection()->get_selected());
|
||||
name = row[vcols.name];
|
||||
pi = row[vcols.plugin];
|
||||
added_plugins.push_back (row[vcols.plugin]);
|
||||
#endif
|
||||
break;
|
||||
case ARDOUR::PluginInfo::AudioUnit:
|
||||
case PluginInfo::AudioUnit:
|
||||
#ifdef HAVE_COREAUDIO
|
||||
row = *(au_display.get_selection()->get_selected());
|
||||
name = row[aucols.name];
|
||||
pi = row[aucols.plugin];
|
||||
added_plugins.push_back (row[aucols.plugin]);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
@@ -403,17 +398,12 @@ PluginSelector::btn_add_clicked()
|
||||
void
|
||||
PluginSelector::btn_remove_clicked()
|
||||
{
|
||||
list<PluginInfo*>::iterator i;
|
||||
Gtk::TreeModel::iterator iter = added_list.get_selection()->get_selected();
|
||||
for (i = added_plugins.begin(); (*i) != (*iter)[acols.plugin]; ++i);
|
||||
|
||||
added_plugins.erase(i);
|
||||
|
||||
amodel->erase(iter);
|
||||
if (amodel->children().empty()) {
|
||||
set_response_sensitive (RESPONSE_APPLY, false);
|
||||
set_response_sensitive (RESPONSE_APPLY, false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -438,7 +428,7 @@ PluginSelector::ladspa_display_selection_changed()
|
||||
btn_add->set_sensitive (false);
|
||||
}
|
||||
|
||||
current_selection = ARDOUR::PluginInfo::LADSPA;
|
||||
current_selection = PluginInfo::LADSPA;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -455,14 +445,14 @@ int
|
||||
PluginSelector::run ()
|
||||
{
|
||||
ResponseType r;
|
||||
list<PluginInfo*>::iterator i;
|
||||
TreeModel::Children::iterator i;
|
||||
|
||||
r = (ResponseType) Dialog::run ();
|
||||
|
||||
switch (r) {
|
||||
case RESPONSE_APPLY:
|
||||
for (i = added_plugins.begin(); i != added_plugins.end(); ++i){
|
||||
use_plugin (*i);
|
||||
for (i = amodel->children().begin(); i != amodel->children().end(); ++i) {
|
||||
use_plugin ((*i)[acols.plugin]);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -479,6 +469,5 @@ void
|
||||
PluginSelector::cleanup ()
|
||||
{
|
||||
hide();
|
||||
added_plugins.clear();
|
||||
amodel->clear();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class PluginSelector : public ArdourDialog
|
||||
Gtk::TreeModelColumn<std::string> type;
|
||||
Gtk::TreeModelColumn<std::string> ins;
|
||||
Gtk::TreeModelColumn<std::string> outs;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
|
||||
};
|
||||
LadspaColumns lcols;
|
||||
Glib::RefPtr<Gtk::ListStore> lmodel;
|
||||
@@ -81,7 +81,7 @@ class PluginSelector : public ArdourDialog
|
||||
add (plugin);
|
||||
}
|
||||
Gtk::TreeModelColumn<std::string> text;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
|
||||
};
|
||||
AddedColumns acols;
|
||||
Glib::RefPtr<Gtk::ListStore> amodel;
|
||||
@@ -100,7 +100,7 @@ class PluginSelector : public ArdourDialog
|
||||
Gtk::TreeModelColumn<std::string> name;
|
||||
Gtk::TreeModelColumn<std::string> ins;
|
||||
Gtk::TreeModelColumn<std::string> outs;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
|
||||
};
|
||||
VstColumns vcols;
|
||||
Glib::RefPtr<Gtk::ListStore> vmodel;
|
||||
@@ -123,7 +123,7 @@ class PluginSelector : public ArdourDialog
|
||||
Gtk::TreeModelColumn<std::string> name;
|
||||
Gtk::TreeModelColumn<std::string> ins;
|
||||
Gtk::TreeModelColumn<std::string> outs;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
|
||||
};
|
||||
AUColumns aucols;
|
||||
Glib::RefPtr<Gtk::ListStore> aumodel;
|
||||
@@ -141,7 +141,6 @@ class PluginSelector : public ArdourDialog
|
||||
gint o_selected_plug;
|
||||
|
||||
ARDOUR::PluginManager *manager;
|
||||
list<ARDOUR::PluginInfo*> added_plugins;
|
||||
|
||||
static void _input_refiller (void *);
|
||||
|
||||
@@ -153,7 +152,7 @@ class PluginSelector : public ArdourDialog
|
||||
void added_list_selection_changed();
|
||||
void ladspa_display_selection_changed();
|
||||
void btn_apply_clicked();
|
||||
void use_plugin (ARDOUR::PluginInfo*);
|
||||
void use_plugin (ARDOUR::PluginInfoPtr);
|
||||
void cleanup ();
|
||||
};
|
||||
|
||||
|
||||
@@ -21,15 +21,40 @@
|
||||
#ifndef __ardour_audio_unit_h__
|
||||
#define __ardour_audio_unit_h__
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <ardour/plugin.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
struct ComponentDescription;
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
class AudioUnit : public ARDOUR::Plugin
|
||||
class AUPlugin : public ARDOUR::Plugin
|
||||
{
|
||||
|
||||
public:
|
||||
AUPlugin (AudioEngine& engine, Session& session) : Plugin(engine, session) {};
|
||||
virtual ~AUPlugin () {};
|
||||
};
|
||||
|
||||
class AUPluginInfo : public PluginInfo {
|
||||
public:
|
||||
typedef boost::shared_ptr<ComponentDescription> CompDescPtr;
|
||||
|
||||
AUPluginInfo () { };
|
||||
~AUPluginInfo () { };
|
||||
|
||||
CompDescPtr desc;
|
||||
|
||||
static PluginInfoList discover ();
|
||||
|
||||
private:
|
||||
friend class PluginManager;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<AUPluginInfo> AUPluginInfoPtr;
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
||||
#endif // __ardour_audio_unit_h__
|
||||
@@ -73,6 +73,9 @@ class PluginInfo {
|
||||
uint32_t index;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<PluginInfo> PluginInfoPtr;
|
||||
typedef std::list<PluginInfoPtr> PluginInfoList;
|
||||
|
||||
class Plugin : public Stateful, public sigc::trackable
|
||||
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <ardour/types.h>
|
||||
#include <ardour/plugin.h>
|
||||
#include <ardour/audio_unit.h>
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
@@ -21,24 +23,24 @@ class PluginManager {
|
||||
PluginManager (ARDOUR::AudioEngine&);
|
||||
~PluginManager ();
|
||||
|
||||
std::list<PluginInfo*> &vst_plugin_info () { return _vst_plugin_info; }
|
||||
std::list<PluginInfo*> &ladspa_plugin_info () { return _ladspa_plugin_info; }
|
||||
std::list<PluginInfo*> &au_plugin_info () { return _au_plugin_info; }
|
||||
ARDOUR::PluginInfoList &vst_plugin_info () { return _vst_plugin_info; }
|
||||
ARDOUR::PluginInfoList &ladspa_plugin_info () { return _ladspa_plugin_info; }
|
||||
ARDOUR::PluginInfoList &au_plugin_info () { return _au_plugin_info; }
|
||||
|
||||
void refresh ();
|
||||
|
||||
int add_ladspa_directory (std::string dirpath);
|
||||
int add_vst_directory (std::string dirpath);
|
||||
|
||||
boost::shared_ptr<Plugin> load (ARDOUR::Session& s, PluginInfo* info);
|
||||
boost::shared_ptr<Plugin> load (ARDOUR::Session& s, PluginInfoPtr info);
|
||||
|
||||
static PluginManager* the_manager() { return _manager; }
|
||||
|
||||
private:
|
||||
ARDOUR::AudioEngine& _engine;
|
||||
std::list<PluginInfo*> _vst_plugin_info;
|
||||
std::list<PluginInfo*> _ladspa_plugin_info;
|
||||
std::list<PluginInfo*> _au_plugin_info;
|
||||
ARDOUR::PluginInfoList _vst_plugin_info;
|
||||
ARDOUR::PluginInfoList _ladspa_plugin_info;
|
||||
ARDOUR::PluginInfoList _au_plugin_info;
|
||||
std::map<uint32_t, std::string> rdf_type;
|
||||
|
||||
std::string ladspa_path;
|
||||
|
||||
@@ -17,3 +17,96 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <ardour/audio_unit.h>
|
||||
#include <ardour/utils.h>
|
||||
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
|
||||
using namespace ARDOUR;
|
||||
|
||||
PluginInfoList
|
||||
AUPluginInfo::discover ()
|
||||
{
|
||||
PluginInfoList plugs;
|
||||
|
||||
int numTypes = 2; // this magic number was retrieved from the apple AUHost example.
|
||||
|
||||
ComponentDescription desc;
|
||||
desc.componentFlags = 0;
|
||||
desc.componentFlagsMask = 0;
|
||||
desc.componentSubType = 0;
|
||||
desc.componentManufacturer = 0;
|
||||
|
||||
vector<ComponentDescription> vCompDescs;
|
||||
|
||||
for (int i = 0; i < numTypes; ++i) {
|
||||
if (i == 1) {
|
||||
desc.componentType = kAudioUnitType_MusicEffect;
|
||||
} else {
|
||||
desc.componentType = kAudioUnitType_Effect;
|
||||
}
|
||||
|
||||
Component comp = 0;
|
||||
|
||||
comp = FindNextComponent (NULL, &desc);
|
||||
while (comp != NULL) {
|
||||
ComponentDescription temp;
|
||||
GetComponentInfo (comp, &temp, NULL, NULL, NULL);
|
||||
vCompDescs.push_back(temp);
|
||||
comp = FindNextComponent (comp, &desc);
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < vCompDescs.size(); ++i) {
|
||||
|
||||
// the following large block is just for determining the name of the plugin.
|
||||
CFStringRef itemName = NULL;
|
||||
// Marc Poirier -style item name
|
||||
Component auComponent = FindNextComponent (0, &(vCompDescs[i]));
|
||||
if (auComponent != NULL) {
|
||||
ComponentDescription dummydesc;
|
||||
Handle nameHandle = NewHandle(sizeof(void*));
|
||||
if (nameHandle != NULL) {
|
||||
OSErr err = GetComponentInfo(auComponent, &dummydesc, nameHandle, NULL, NULL);
|
||||
if (err == noErr) {
|
||||
ConstStr255Param nameString = (ConstStr255Param) (*nameHandle);
|
||||
if (nameString != NULL) {
|
||||
itemName = CFStringCreateWithPascalString(kCFAllocatorDefault, nameString, CFStringGetSystemEncoding());
|
||||
}
|
||||
}
|
||||
DisposeHandle(nameHandle);
|
||||
}
|
||||
}
|
||||
|
||||
// if Marc-style fails, do the original way
|
||||
if (itemName == NULL) {
|
||||
CFStringRef compTypeString = UTCreateStringForOSType(vCompDescs[i].componentType);
|
||||
CFStringRef compSubTypeString = UTCreateStringForOSType(vCompDescs[i].componentSubType);
|
||||
CFStringRef compManufacturerString = UTCreateStringForOSType(vCompDescs[i].componentManufacturer);
|
||||
|
||||
itemName = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ - %@ - %@"),
|
||||
compTypeString, compManufacturerString, compSubTypeString);
|
||||
|
||||
if (compTypeString != NULL)
|
||||
CFRelease(compTypeString);
|
||||
if (compSubTypeString != NULL)
|
||||
CFRelease(compSubTypeString);
|
||||
if (compManufacturerString != NULL)
|
||||
CFRelease(compManufacturerString);
|
||||
}
|
||||
string realname = CFStringRefToStdString(itemName);
|
||||
|
||||
AUPluginInfoPtr plug(new AUPluginInfo);
|
||||
plug->name = realname;
|
||||
plug->type = PluginInfo::AudioUnit;
|
||||
plug->n_inputs = 0;
|
||||
plug->n_outputs = 0;
|
||||
plug->category = "AudioUnit";
|
||||
|
||||
plugs.push_back(plug);
|
||||
}
|
||||
|
||||
return plugs;
|
||||
}
|
||||
|
||||
@@ -37,15 +37,11 @@
|
||||
#include <ardour/plugin.h>
|
||||
#include <ardour/ladspa_plugin.h>
|
||||
#include <ardour/vst_plugin.h>
|
||||
#include <ardour/audio_unit.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/stl_delete.h>
|
||||
|
||||
#ifdef HAVE_COREAUDIO
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
#endif // HAVE_COREAUDIO
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
@@ -103,17 +99,13 @@ PluginManager::refresh ()
|
||||
#endif // VST_SUPPORT
|
||||
|
||||
#ifdef HAVE_COREAUDIO
|
||||
au_discover ();
|
||||
_au_plugin_info = AUPluginInfo::discover ();
|
||||
#endif // HAVE_COREAUDIO
|
||||
}
|
||||
|
||||
void
|
||||
PluginManager::ladspa_refresh ()
|
||||
{
|
||||
for (std::list<PluginInfo*>::iterator i = _ladspa_plugin_info.begin(); i != _ladspa_plugin_info.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
|
||||
_ladspa_plugin_info.clear ();
|
||||
|
||||
if (ladspa_path.length() == 0) {
|
||||
@@ -234,7 +226,6 @@ PluginManager::add_lrdf_data (const string &path)
|
||||
int
|
||||
PluginManager::ladspa_discover (string path)
|
||||
{
|
||||
PluginInfo *info;
|
||||
void *module;
|
||||
const LADSPA_Descriptor *descriptor;
|
||||
LADSPA_Descriptor_Function dfunc;
|
||||
@@ -259,7 +250,7 @@ PluginManager::ladspa_discover (string path)
|
||||
break;
|
||||
}
|
||||
|
||||
info = new PluginInfo;
|
||||
PluginInfoPtr info(new PluginInfo);
|
||||
info->name = descriptor->Name;
|
||||
info->category = get_ladspa_category(descriptor->UniqueID);
|
||||
info->path = path;
|
||||
@@ -290,7 +281,7 @@ PluginManager::ladspa_discover (string path)
|
||||
}
|
||||
|
||||
boost::shared_ptr<Plugin>
|
||||
PluginManager::load (Session& session, PluginInfo *info)
|
||||
PluginManager::load (Session& session, PluginInfoPtr info)
|
||||
{
|
||||
void *module;
|
||||
|
||||
@@ -339,8 +330,7 @@ boost::shared_ptr<Plugin>
|
||||
ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::Type type)
|
||||
{
|
||||
PluginManager *mgr = PluginManager::the_manager();
|
||||
list<PluginInfo *>::iterator i;
|
||||
list<PluginInfo *>* plugs = 0;
|
||||
PluginInfoList* plugs = 0;
|
||||
|
||||
switch (type) {
|
||||
case PluginInfo::LADSPA:
|
||||
@@ -358,6 +348,7 @@ ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::T
|
||||
return boost::shared_ptr<Plugin> ((Plugin *) 0);
|
||||
}
|
||||
|
||||
PluginInfoList::iterator i;
|
||||
for (i = plugs->begin(); i != plugs->end(); ++i) {
|
||||
if ((name == "" || (*i)->name == name) &&
|
||||
(unique_id == 0 || (*i)->unique_id == unique_id)) {
|
||||
@@ -409,10 +400,6 @@ PluginManager::get_ladspa_category (uint32_t plugin_id)
|
||||
void
|
||||
PluginManager::vst_refresh ()
|
||||
{
|
||||
for (std::list<PluginInfo*>::iterator i = _vst_plugin_info.begin(); i != _vst_plugin_info.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
|
||||
_vst_plugin_info.clear ();
|
||||
|
||||
if (vst_path.length() == 0) {
|
||||
@@ -466,7 +453,6 @@ int
|
||||
PluginManager::vst_discover (string path)
|
||||
{
|
||||
FSTInfo* finfo;
|
||||
PluginInfo* info;
|
||||
|
||||
if ((finfo = fst_get_info (const_cast<char *> (path.c_str()))) == 0) {
|
||||
return -1;
|
||||
@@ -478,7 +464,7 @@ PluginManager::vst_discover (string path)
|
||||
<< endl;
|
||||
}
|
||||
|
||||
info = new PluginInfo;
|
||||
PluginInfoPtr info(new PluginInfo);
|
||||
|
||||
/* what a goddam joke freeware VST is */
|
||||
|
||||
@@ -502,94 +488,3 @@ PluginManager::vst_discover (string path)
|
||||
}
|
||||
|
||||
#endif // VST_SUPPORT
|
||||
|
||||
#ifdef HAVE_COREAUDIO
|
||||
|
||||
int
|
||||
PluginManager::au_discover ()
|
||||
{
|
||||
_au_plugin_info.clear ();
|
||||
|
||||
int numTypes = 2; // this magic number was retrieved from the apple AUHost example.
|
||||
|
||||
ComponentDescription desc;
|
||||
desc.componentFlags = 0;
|
||||
desc.componentFlagsMask = 0;
|
||||
desc.componentSubType = 0;
|
||||
desc.componentManufacturer = 0;
|
||||
|
||||
vector<ComponentDescription> vCompDescs;
|
||||
|
||||
for (int i = 0; i < numTypes; ++i) {
|
||||
if (i == 1) {
|
||||
desc.componentType = kAudioUnitType_MusicEffect;
|
||||
} else {
|
||||
desc.componentType = kAudioUnitType_Effect;
|
||||
}
|
||||
|
||||
Component comp = 0;
|
||||
|
||||
comp = FindNextComponent (NULL, &desc);
|
||||
while (comp != NULL) {
|
||||
ComponentDescription temp;
|
||||
GetComponentInfo (comp, &temp, NULL, NULL, NULL);
|
||||
vCompDescs.push_back(temp);
|
||||
comp = FindNextComponent (comp, &desc);
|
||||
}
|
||||
}
|
||||
|
||||
PluginInfo* plug;
|
||||
for (unsigned int i = 0; i < vCompDescs.size(); ++i) {
|
||||
|
||||
// the following large block is just for determining the name of the plugin.
|
||||
CFStringRef itemName = NULL;
|
||||
// Marc Poirier -style item name
|
||||
Component auComponent = FindNextComponent (0, &(vCompDescs[i]));
|
||||
if (auComponent != NULL) {
|
||||
ComponentDescription dummydesc;
|
||||
Handle nameHandle = NewHandle(sizeof(void*));
|
||||
if (nameHandle != NULL) {
|
||||
OSErr err = GetComponentInfo(auComponent, &dummydesc, nameHandle, NULL, NULL);
|
||||
if (err == noErr) {
|
||||
ConstStr255Param nameString = (ConstStr255Param) (*nameHandle);
|
||||
if (nameString != NULL) {
|
||||
itemName = CFStringCreateWithPascalString(kCFAllocatorDefault, nameString, CFStringGetSystemEncoding());
|
||||
}
|
||||
}
|
||||
DisposeHandle(nameHandle);
|
||||
}
|
||||
}
|
||||
|
||||
// if Marc-style fails, do the original way
|
||||
if (itemName == NULL) {
|
||||
CFStringRef compTypeString = UTCreateStringForOSType(vCompDescs[i].componentType);
|
||||
CFStringRef compSubTypeString = UTCreateStringForOSType(vCompDescs[i].componentSubType);
|
||||
CFStringRef compManufacturerString = UTCreateStringForOSType(vCompDescs[i].componentManufacturer);
|
||||
|
||||
itemName = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ - %@ - %@"),
|
||||
compTypeString, compManufacturerString, compSubTypeString);
|
||||
|
||||
if (compTypeString != NULL)
|
||||
CFRelease(compTypeString);
|
||||
if (compSubTypeString != NULL)
|
||||
CFRelease(compSubTypeString);
|
||||
if (compManufacturerString != NULL)
|
||||
CFRelease(compManufacturerString);
|
||||
}
|
||||
string realname = CFStringRefToStdString(itemName);
|
||||
|
||||
plug = new PluginInfo;
|
||||
plug->name = realname;
|
||||
plug->type = PluginInfo::AudioUnit;
|
||||
plug->n_inputs = 0;
|
||||
plug->n_outputs = 0;
|
||||
plug->category = "AudioUnit";
|
||||
|
||||
_au_plugin_info.push_back(plug);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // HAVE_COREAUDIO
|
||||
|
||||
|
||||
Reference in New Issue
Block a user