#ifdef VST_SUPPORT
vmodel->clear();
#endif
+
+#ifdef HAVE_COREAUDIO
+ aumodel->clear();
+#endif
// Insert into GTK list
for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) {
snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs);
}
vmodel->set_sort_column (0, Gtk::SORT_ASCENDING);
}
-#endif
+#endif //VST_SUPPORT
+
+#ifdef HAVE_COREAUDIO
+
+void
+PluginSelector::_au_refiller (void *arg)
+{
+ ((PluginSelector *) arg)->au_refiller ();
+}
+
+void
+PluginSelector::au_refiller ()
+{
+ guint row;
+// list<PluginInfo *> &plugs = manager->au_plugin_info ();
+ list<PluginInfo *> &plugs;
+ list<PluginInfo *>::iterator i;
+ char ibuf[16], obuf[16];
+
+ // Insert into GTK list
+ for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) {
+
+ snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs);
+ snprintf (obuf, sizeof(obuf)-1, "%d", (*i)->n_outputs);
+
+ Gtk::TreeModel::Row newrow = *(amodel->append());
+ newrow[acols.name] = (*i)->name.c_str();
+ newrow[acols.ins] = ibuf;
+ newrow[acols.outs] = obuf;
+ newrow[acols.plugin] = *i;
+ }
+ amodel->set_sort_column (0, Gtk::SORT_ASCENDING);
+}
+#endif //HAVE_COREAUDIO
void
PluginSelector::use_plugin (PluginInfo* pi)
void
PluginSelector::btn_add_clicked()
{
- bool vst = notebook.get_current_page(); // 0 = LADSPA, 1 = VST
+ // 0 = LADSPA, 1 = VST, 2 = AU
+ unsigned int page = notebook.get_current_page();
std::string name;
ARDOUR::PluginInfo *pi;
Gtk::TreeModel::Row newrow = *(amodel->append());
- if (vst) {
+ Gtk::TreeModel::Row row;
+
+ switch (page) {
+ case 0:
+ row = *(ladspa_display.get_selection()->get_selected());
+ name = row[lcols.name];
+ pi = row[lcols.plugin];
+ added_plugins.push_back (row[lcols.plugin]);
+ break;
+ case 1:
#ifdef VST_SUPPORT
- Gtk::TreeModel::Row row = *(vst_display.get_selection()->get_selected());
- name = row[vcols.name];
- pi = row[vcols.plugin];
- added_plugins.push_back (row[vcols.plugin]);
+ row = *(vst_display.get_selection()->get_selected());
+ name = row[vcols.name];
+ pi = row[vcols.plugin];
+ added_plugins.push_back (row[vcols.plugin]);
#endif
- } else {
- Gtk::TreeModel::Row row = *(ladspa_display.get_selection()->get_selected());
- name = row[lcols.name];
- pi = row[lcols.plugin];
- added_plugins.push_back (row[lcols.plugin]);
+ break;
+ case 2:
+#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;
}
+
newrow[acols.text] = name;
newrow[acols.plugin] = pi;
if (!amodel->children().empty()) {
- set_response_sensitive (RESPONSE_APPLY, true);
+ set_response_sensitive (RESPONSE_APPLY, true);
}
}
#ifdef VST_SUPPORT
vst_refiller ();
#endif
+#ifdef HAVE_COREAUDIO
+// au_refiller ();
+#endif
}
#ifdef VST_SUPPORT
}
#endif
+#ifdef HAVE_COREAUDIO
+void
+PluginSelector::vst_display_selection_changed()
+{
+ if (au_display.get_selection()->count_selected_rows() != 0) {
+ btn_add->set_sensitive (true);
+ } else {
+ btn_add->set_sensitive (false);
+ }
+}
+#endif
+
void
PluginSelector::ladspa_display_selection_changed()
{
static void _vst_refiller (void *);
void vst_refiller ();
void vst_display_selection_changed();
-#endif
+#endif // VST_SUPPORT
+
+#ifdef HAVE_COREAUDIO
+ // page 3
+ struct AUColumns : public Gtk::TreeModel::ColumnRecord {
+ AUColumns () {
+ add (name);
+ add (ins);
+ add (outs);
+ add (plugin);
+ }
+ Gtk::TreeModelColumn<std::string> name;
+ Gtk::TreeModelColumn<std::string> ins;
+ Gtk::TreeModelColumn<std::string> outs;
+ Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
+ };
+ AUColumns aucols;
+ Glib::RefPtr<Gtk::ListStore> aumodel;
+ Glib::RefPtr<Gtk::TreeSelection> auselection;
+ Gtk::TreeView au_display;
+ static void _au_refiller (void *);
+ void au_refiller ();
+ void au_display_selection_changed();
+#endif //HAVE_COREAUDIO
ARDOUR::PluginInfo* i_selected_plug;
};
#endif // __ardour_plugin_selector_h__
+
remove_field_btn.signal_clicked().connect
(mem_fun (*this, &SoundFileBox::remove_field_clicked));
- Gtk::CellRendererText* cell(static_cast<Gtk::CellRendererText*>(field_view.get_column_cell_renderer(1)));
+ Gtk::CellRendererText* cell(dynamic_cast<Gtk::CellRendererText*>(field_view.get_column_cell_renderer(1)));
cell->signal_edited().connect (mem_fun (*this, &SoundFileBox::field_edited));
field_view.get_selection()->signal_changed().connect (mem_fun (*this, &SoundFileBox::field_selected));
osc_files = [ 'osc.cc' ]
vst_files = [ 'vst_plugin.cc', 'session_vst.cc' ]
-coreaudio_files = [ 'coreaudiosource.cc' ]
+coreaudio_files = [ 'audio_unit.cc', 'coreaudiosource.cc' ]
extra_sources = [ ]
if ardour['VST']:
--- /dev/null
+/*
+ Copyright (C) 2006 Paul Davis
+ Written by Taybin Rutkin
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __ardour_audio_unit_h__
+#define __ardour_audio_unit_h__
+
+#include <ardour/plugin.h>
+
+namespace ARDOUR {
+
+class AudioUnit : public ARDOUR::Plugin
+{
+
+};
+
+} // namespace ARDOUR
+
+#endif // __ardour_audio_unit_h__
\ No newline at end of file
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; }
+
void refresh ();
int add_ladspa_directory (std::string dirpath);
ARDOUR::AudioEngine& _engine;
std::list<PluginInfo*> _vst_plugin_info;
std::list<PluginInfo*> _ladspa_plugin_info;
+ std::list<PluginInfo*> _au_plugin_info;
std::map<uint32_t, std::string> rdf_type;
std::string ladspa_path;
int ladspa_discover_from_path (std::string path);
int ladspa_discover (std::string path);
+ int au_discover ();
+
std::string get_ladspa_category (uint32_t id);
static PluginManager* _manager; // singleton
} /* namespace ARDOUR */
#endif /* __ardour_plugin_manager_h__ */
+
#include <string>
#include <cmath>
+#ifdef HAVE_COREAUDIO
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
#include "ardour.h"
class XMLNode;
std::string region_name_from_path (std::string path);
std::string path_expand (std::string);
+#ifdef HAVE_COREAUDIO
+std::string CFStringRefToStdString(CFStringRef stringRef);
+#endif // HAVE_COREAUDIO
+
#endif /* __ardour_utils_h__ */
--- /dev/null
+/*
+ Copyright (C) 2006 Paul Davis
+ Written by Taybin Rutkin
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
#endif // HAVE_COREAUDIO
-#ifdef HAVE_COREAUDIO
-std::string
-CFStringRefToStdString(CFStringRef stringRef)
-{
- CFIndex size =
- CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef) ,
- kCFStringEncodingASCII);
- char *buf = new char[size];
-
- std::string result;
-
- if(CFStringGetCString(stringRef, buf, size, kCFStringEncodingASCII)) {
- result = buf;
- }
- delete [] buf;
- return result;
-}
-#endif // HAVE_COREAUDIO
-
bool
AudioFileSource::get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg)
{
#include <fst.h>
#include <pbd/basename.h>
#include <string.h>
-#endif
+#endif // VST_SUPPORT
#include <pbd/pathscanner.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;
if (Config->get_use_vst()) {
vst_refresh ();
}
-#endif
+#endif // VST_SUPPORT
+
+#ifdef HAVE_COREAUDIO
+ au_discover ();
+#endif // HAVE_COREAUDIO
}
void
} else {
error << _("You asked ardour to not use any VST plugins") << endmsg;
}
-#else
+#else // !VST_SUPPORT
error << _("This version of ardour has no support for VST plugins") << endmsg;
return boost::shared_ptr<Plugin> ((Plugin*) 0);
-#endif
+#endif // !VST_SUPPORT
} else {
unique_id = 0; // VST plugins don't have a unique id.
break;
case PluginInfo::AudioUnit:
+ plugs = &mgr->au_plugin_info();
+ unique_id = 0;
+ break;
default:
return boost::shared_ptr<Plugin> ((Plugin *) 0);
}
for (i = plugs->begin(); i != plugs->end(); ++i) {
- if ((name == "" || (*i)->name == name) &&
+ if ((name == "" || (*i)->name == name) &&
(unique_id == 0 || (*i)->unique_id == unique_id)) {
return mgr->load (session, *i);
}
return 0;
}
-#endif
+#endif // VST_SUPPORT
+
+#ifdef HAVE_COREAUDIO
+
+int
+PluginManager::au_discover ()
+{
+ int mNumUnits = 0;
+ 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;
+
+ for (int i = 0; i < numTypes; ++i) {
+ if (i == 1) {
+ desc.componentType = kAudioUnitType_MusicEffect;
+ } else {
+ desc.componentType = kAudioUnitType_Effect;
+ }
+
+ int n = CountComponents (&desc);
+
+ mNumUnits += n;
+ }
+ cout << "Number of AU plugins: " << mNumUnits << endl;
+
+ ComponentDescription* mCompDescs = new ComponentDescription[mNumUnits];
+
+ int n = 0;
+ 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);
+ mCompDescs[n++] = temp;
+ comp = FindNextComponent (comp, &desc);
+ }
+ }
+
+ for (int i = 0; i < mNumUnits; ++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, &(mCompDescs[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(mCompDescs[i].componentType);
+ CFStringRef compSubTypeString = UTCreateStringForOSType(mCompDescs[i].componentSubType);
+ CFStringRef compManufacturerString = UTCreateStringForOSType(mCompDescs[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);
+ cout << realname << endl;
+ }
+
+ delete[] mCompDescs;
+
+ return 0;
+}
+
+#endif // HAVE_COREAUDIO
+
#endif
}
+#ifdef HAVE_COREAUDIO
+string
+CFStringRefToStdString(CFStringRef stringRef)
+{
+ CFIndex size =
+ CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef) ,
+ kCFStringEncodingASCII);
+ char *buf = new char[size];
+
+ std::string result;
+
+ if(CFStringGetCString(stringRef, buf, size, kCFStringEncodingASCII)) {
+ result = buf;
+ }
+ delete [] buf;
+ return result;
+}
+#endif // HAVE_COREAUDIO