Merged up to trunk R732

git-svn-id: svn://localhost/ardour2/branches/midi@735 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2006-08-01 19:18:12 +00:00
parent 79fc27de2e
commit 0565c75ce8
28 changed files with 450 additions and 99 deletions

View file

@ -451,7 +451,7 @@ libraries['usb'] = conf.Finish ()
libraries['flac'] = LibraryInfo ()
conf = Configure (libraries['flac'])
conf.CheckLib ('FLAC', 'FLAC__stream_decoder_new')
conf.CheckLib ('FLAC', 'FLAC__stream_decoder_new', language='CXX')
libraries['flac'] = conf.Finish ()
#

View file

@ -57,6 +57,9 @@ if gtkardour['FFT_ANALYSIS']:
gtkardour.Merge ([libraries['fftw3f']])
gtkardour.Append(CCFLAGS='-DFFT_ANALYSIS')
if gtkardour['COREAUDIO']:
gtkardour.Append(CCFLAGS='-DHAVE_COREAUDIO')
skipped_files=Split("""
connection_editor.cc
""")

View file

@ -241,7 +241,7 @@ AnalysisWindow::analyze_data (Gtk::Button *button)
if (!pl || !rui)
continue;
FFTResult *res = fft_graph.prepareResult(rui->color(), rui->route().name());
FFTResult *res = fft_graph.prepareResult(rui->color(), rui->route()->name());
// if timeSelection
if (source_selection_ranges_rb.get_active()) {
@ -322,7 +322,7 @@ AnalysisWindow::analyze_data (Gtk::Button *button)
Gtk::TreeModel::Row newrow = *(tlmodel)->append();
newrow[tlcols.trackname] = rui->route().name();
newrow[tlcols.trackname] = rui->route()->name();
newrow[tlcols.visible] = true;
newrow[tlcols.color] = rui->color();
newrow[tlcols.graph] = res;

View file

@ -187,8 +187,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
gettimeofday (&last_shuttle_request, 0);
ARDOUR::AudioDiskstream::DeleteSources.connect (mem_fun(*this, &ARDOUR_UI::delete_sources_in_the_right_thread));
ARDOUR::AudioDiskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
ARDOUR::AudioDiskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
ARDOUR::Diskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
ARDOUR::Diskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
/* handle pending state with a dialog */

View file

@ -57,12 +57,32 @@ static const int32_t sync_mark_width = 9;
AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, AudioRegion& r, double spu,
Gdk::Color& basic_color)
: RegionView (parent, tv, r, spu, basic_color)
, sync_mark(0)
, zero_line(0)
, fade_in_shape(0)
, fade_out_shape(0)
, fade_in_handle(0)
, fade_out_handle(0)
, gain_line(0)
, _amplitude_above_axis(1.0)
, _flags(0)
, fade_color(0)
{
}
AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, AudioRegion& r, double spu,
Gdk::Color& basic_color, TimeAxisViewItem::Visibility visibility)
: RegionView (parent, tv, r, spu, basic_color, visibility)
, sync_mark(0)
, zero_line(0)
, fade_in_shape(0)
, fade_out_shape(0)
, fade_in_handle(0)
, fade_out_handle(0)
, gain_line(0)
, _amplitude_above_axis(1.0)
, _flags(0)
, fade_color(0)
{
}

View file

@ -1115,7 +1115,7 @@ class Editor : public PublicEditor
bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*);
bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*);
bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*);
bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*);
bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);

View file

@ -735,7 +735,7 @@ Editor::canvas_region_view_name_highlight_event (GdkEvent* event, ArdourCanvas::
}
bool
Editor::canvas_region_view_name_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView* rv)
Editor::canvas_region_view_name_event (GdkEvent *event, ArdourCanvas::Item* item, RegionView* rv)
{
bool ret = false;

View file

@ -1,5 +1,5 @@
/*
Copyright (C) 2000-2002 Paul Davis
Copyright (C) 2000-2006 Paul Davis
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
@ -14,8 +14,6 @@
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.
$Id$
*/
#include <cmath>

View file

@ -1,5 +1,5 @@
/*
Copyright (C) 2000 Paul Davis
Copyright (C) 2000-2006 Paul Davis
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
@ -14,8 +14,6 @@
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.
$Id$
*/
#ifndef __ardour_mixer_strip__

View file

@ -14,8 +14,6 @@
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.
$Id$
*/
#include <limits.h>

View file

@ -50,6 +50,8 @@ PluginSelector::PluginSelector (PluginManager *mgr)
session = 0;
o_selected_plug = -1;
i_selected_plug = 0;
current_selection = ARDOUR::PluginInfo::LADSPA;
lmodel = Gtk::ListStore::create(lcols);
ladspa_display.set_model (lmodel);
@ -91,6 +93,25 @@ PluginSelector::PluginSelector (PluginManager *mgr)
column->set_sort_column(i);
}
#endif
#ifdef HAVE_COREAUDIO
aumodel = ListStore::create(aucols);
au_display.set_model (aumodel);
au_display.append_column (_("Available plugins"), aucols.name);
au_display.append_column (_("# Inputs"), aucols.ins);
au_display.append_column (_("# Outputs"), aucols.outs);
au_display.set_headers_visible (true);
au_display.set_reorderable (false);
auscroller.set_border_width(10);
auscroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
auscroller.add(au_display);
for (int i = 0; i <=2; i++) {
Gtk::TreeView::Column* column = au_display.get_column(i);
column->set_sort_column(i);
}
#endif
ascroller.set_border_width(10);
ascroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
ascroller.add(added_list);
@ -124,35 +145,51 @@ PluginSelector::PluginSelector (PluginManager *mgr)
using namespace Gtk::Notebook_Helpers;
notebook.pages().push_back (TabElem (lscroller, _("LADSPA")));
#ifdef VST_SUPPORT
if (Config->get_use_vst()) {
notebook.pages().push_back (TabElem (vscroller, _("VST")));
}
#endif
#ifdef HAVE_COREAUDIO
notebook.pages().push_back (TabElem (auscroller, _("AudioUnit")));
#endif
table->set_name("PluginSelectorTable");
ladspa_display.set_name("PluginSelectorDisplay");
//ladspa_display.set_name("PluginSelectorList");
added_list.set_name("PluginSelectorList");
ladspa_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked));
ladspa_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::ladspa_display_selection_changed));
#ifdef VST_SUPPORT
if (Config->get_use_vst()) {
vst_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked));
vst_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::vst_display_selection_changed));
}
#endif
#ifdef HAVE_COREAUDIO
au_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked));
au_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::au_display_selection_changed));
#endif
btn_update->signal_clicked().connect (mem_fun(*this, &PluginSelector::btn_update_clicked));
btn_add->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_add_clicked));
btn_remove->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_remove_clicked));
ladspa_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::ladspa_display_selection_changed));
added_list.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::added_list_selection_changed));
input_refiller ();
#ifdef VST_SUPPORT
vst_refiller ();
#endif
#ifdef HAVE_COREAUDIO
au_refiller ();
#endif
}
void
@ -193,9 +230,7 @@ PluginSelector::input_refiller ()
list<PluginInfo *>::iterator i;
char ibuf[16], obuf[16];
lmodel->clear();
#ifdef VST_SUPPORT
vmodel->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);
@ -227,6 +262,7 @@ PluginSelector::vst_refiller ()
list<PluginInfo *> &plugs = manager->vst_plugin_info ();
list<PluginInfo *>::iterator i;
char ibuf[16], obuf[16];
vmodel->clear();
// Insert into GTK list
for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) {
@ -242,7 +278,66 @@ PluginSelector::vst_refiller ()
}
vmodel->set_sort_column (0, Gtk::SORT_ASCENDING);
}
#endif
void
PluginSelector::vst_display_selection_changed()
{
if (vst_display.get_selection()->count_selected_rows() != 0) {
btn_add->set_sensitive (true);
} else {
btn_add->set_sensitive (false);
}
current_selection = ARDOUR::PluginInfo::VST;
}
#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 *>::iterator i;
char ibuf[16], obuf[16];
aumodel->clear();
// 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 = *(aumodel->append());
newrow[aucols.name] = (*i)->name.c_str();
newrow[aucols.ins] = ibuf;
newrow[aucols.outs] = obuf;
newrow[aucols.plugin] = *i;
}
aumodel->set_sort_column (0, Gtk::SORT_ASCENDING);
}
void
PluginSelector::au_display_selection_changed()
{
if (au_display.get_selection()->count_selected_rows() != 0) {
btn_add->set_sensitive (true);
} else {
btn_add->set_sensitive (false);
}
current_selection = ARDOUR::PluginInfo::AudioUnit;
}
#endif //HAVE_COREAUDIO
void
PluginSelector::use_plugin (PluginInfo* pi)
@ -263,29 +358,45 @@ PluginSelector::use_plugin (PluginInfo* pi)
void
PluginSelector::btn_add_clicked()
{
bool vst = notebook.get_current_page(); // 0 = LADSPA, 1 = VST
std::string name;
ARDOUR::PluginInfo *pi;
Gtk::TreeModel::Row newrow = *(amodel->append());
if (vst) {
Gtk::TreeModel::Row row;
switch (current_selection) {
case ARDOUR::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:
#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 ARDOUR::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:
error << "Programming error. Unknown plugin selected." << endmsg;
return;
}
newrow[acols.text] = name;
newrow[acols.plugin] = pi;
if (!amodel->children().empty()) {
set_response_sensitive (RESPONSE_APPLY, true);
set_response_sensitive (RESPONSE_APPLY, true);
}
}
@ -313,28 +424,21 @@ PluginSelector::btn_update_clicked()
#ifdef VST_SUPPORT
vst_refiller ();
#endif
}
#ifdef VST_SUPPORT
void
PluginSelector::vst_display_selection_changed()
{
if (vst_display.get_selection()->count_selected_rows() != 0) {
btn_add->set_sensitive (true);
} else {
btn_add->set_sensitive (false);
}
}
#ifdef HAVE_COREAUDIO
au_refiller ();
#endif
}
void
PluginSelector::ladspa_display_selection_changed()
{
if (ladspa_display.get_selection()->count_selected_rows() != 0) {
btn_add->set_sensitive (true);
} else {
btn_add->set_sensitive (false);
}
if (ladspa_display.get_selection()->count_selected_rows() != 0) {
btn_add->set_sensitive (true);
} else {
btn_add->set_sensitive (false);
}
current_selection = ARDOUR::PluginInfo::LADSPA;
}
void
@ -378,4 +482,3 @@ PluginSelector::cleanup ()
added_plugins.clear();
amodel->clear();
}

View file

@ -25,10 +25,11 @@
#include <gtkmm/treeview.h>
#include <gtkmm2ext/selector.h>
#include <ardour/plugin.h>
namespace ARDOUR {
class Session;
class PluginManager;
class Plugin;
class PluginInfo;
}
@ -45,9 +46,12 @@ class PluginSelector : public ArdourDialog
private:
ARDOUR::Session* session;
Gtk::Notebook notebook;
Gtk::ScrolledWindow lscroller;
Gtk::ScrolledWindow vscroller;
Gtk::ScrolledWindow ascroller;
Gtk::ScrolledWindow lscroller; // ladspa
Gtk::ScrolledWindow vscroller; // vst
Gtk::ScrolledWindow auscroller; // AudioUnit
Gtk::ScrolledWindow ascroller; // Added plugins
ARDOUR::PluginInfo::Type current_selection;
// page 1
struct LadspaColumns : public Gtk::TreeModel::ColumnRecord {
@ -105,7 +109,30 @@ class PluginSelector : public ArdourDialog
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;
@ -131,3 +158,4 @@ class PluginSelector : public ArdourDialog
};
#endif // __ardour_plugin_selector_h__

View file

@ -40,7 +40,6 @@ class ControlPoint;
class SelectionRect;
class CrossfadeView;
class RouteTimeAxisView;
class AudioTimeAxisView;
class RegionView;
class AudioRegionView;
class TempoMarker;
@ -149,7 +148,7 @@ class PublicEditor : public Gtk::Window, public Stateful {
virtual bool canvas_fade_out_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
virtual bool canvas_region_view_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
virtual bool canvas_region_view_name_highlight_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
virtual bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*) = 0;
virtual bool canvas_region_view_name_event (GdkEvent* event,ArdourCanvas::Item*, RegionView*) = 0;
virtual bool canvas_stream_view_event (GdkEvent* event,ArdourCanvas::Item*, RouteTimeAxisView*) = 0;
virtual bool canvas_marker_event (GdkEvent* event,ArdourCanvas::Item*, Marker*) = 0;
virtual bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*) = 0;

View file

@ -67,6 +67,15 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
TimeAxisViewItem::ShowNameHighlight|
TimeAxisViewItem::ShowFrame))
, _region (r)
, sync_mark(0)
, no_wave_msg(0)
, editor(0)
, current_visible_sync_position(0.0)
, valid(false)
, _pixel_width(1.0)
, _height(1.0)
, in_destructor(false)
, wait_for_data(false)
{
}
@ -78,6 +87,15 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
TimeAxisViewItem::Visibility visibility)
: TimeAxisViewItem (r.name(), *parent, tv, spu, basic_color, r.position(), r.length(), visibility)
, _region (r)
, sync_mark(0)
, no_wave_msg(0)
, editor(0)
, current_visible_sync_position(0.0)
, valid(false)
, _pixel_width(1.0)
, _height(1.0)
, in_destructor(false)
, wait_for_data(false)
{
}

View file

@ -56,6 +56,7 @@ class PublicEditor;
class RegionView;
class StreamView;
class Selection;
class RegionSelection;
class Selectable;
class AutomationTimeAxisView;
class AutomationLine;

View file

@ -27,9 +27,9 @@
*/
#include <ardour/region.h>
#include <ardour/audioregion.h>
#include "selection.h"
#include "region_view.h"
inline void
Selection::foreach_region (void (ARDOUR::Region::*method)(void)) {

View file

@ -98,7 +98,7 @@ SoundFileBox::SoundFileBox ()
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));

View file

@ -215,7 +215,7 @@ get_font_for_style (string widgetname)
{
Gtk::Window window (WINDOW_TOPLEVEL);
Gtk::Label foobar;
Glib::RefPtr<Style> style;
Glib::RefPtr<Gtk::Style> style;
window.add (foobar);
foobar.set_name (widgetname);
@ -435,12 +435,10 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
if (!special_handling_of_unmodified_accelerators ||
ev->state & (Gdk::MOD1_MASK|
Gdk::MOD2_MASK|
Gdk::MOD3_MASK|
Gdk::MOD4_MASK|
Gdk::MOD5_MASK|
Gdk::CONTROL_MASK|
Gdk::LOCK_MASK)) {
Gdk::CONTROL_MASK)) {
/* no special handling or modifiers in effect: accelerate first */

View file

@ -105,7 +105,7 @@ arch_specific_objects = [ ]
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']:

View file

@ -0,0 +1,35 @@
/*
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__

View file

@ -23,6 +23,8 @@ class 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; }
void refresh ();
int add_ladspa_directory (std::string dirpath);
@ -36,6 +38,7 @@ class PluginManager {
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;
@ -55,6 +58,8 @@ class PluginManager {
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
@ -63,3 +68,4 @@ class PluginManager {
} /* namespace ARDOUR */
#endif /* __ardour_plugin_manager_h__ */

View file

@ -25,6 +25,10 @@
#include <string>
#include <cmath>
#ifdef HAVE_COREAUDIO
#include <CoreFoundation/CoreFoundation.h>
#endif
#include "ardour.h"
class XMLNode;
@ -53,4 +57,8 @@ int touch_file(std::string path);
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__ */

19
libs/ardour/audio_unit.cc Normal file
View file

@ -0,0 +1,19 @@
/*
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.
*/

View file

@ -238,25 +238,6 @@ AudioFileSource::create (const string& idstr, Flag flags)
#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)
{

View file

@ -68,13 +68,13 @@ CoreAudioSource::init (const string& idstr)
FSRef fsr;
err = FSPathMakeRef ((UInt8*)file.c_str(), &fsr, 0);
if (err != noErr) {
cerr << "FSPathMakeRef " << err << endl;
error << string_compose (_("Could not make reference to file: %1"), name()) << endmsg;
throw failed_constructor();
}
err = ExtAudioFileOpen (&fsr, &af);
if (err != noErr) {
cerr << "ExtAudioFileOpen " << err << endl;
error << string_compose (_("Could not open file: %1"), name()) << endmsg;
ExtAudioFileDispose (af);
throw failed_constructor();
}
@ -85,7 +85,7 @@ CoreAudioSource::init (const string& idstr)
err = ExtAudioFileGetProperty(af,
kExtAudioFileProperty_FileDataFormat, &asbd_size, &file_asbd);
if (err != noErr) {
cerr << "ExtAudioFileGetProperty1 " << err << endl;
error << string_compose (_("Could not get file data format for file: %1"), name()) << endmsg;
ExtAudioFileDispose (af);
throw failed_constructor();
}
@ -104,7 +104,7 @@ CoreAudioSource::init (const string& idstr)
err = ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &prop_size, &ca_frames);
if (err != noErr) {
cerr << "ExtAudioFileGetProperty2 " << err << endl;
error << string_compose (_("Could not get file length for file: %1"), name()) << endmsg;
ExtAudioFileDispose (af);
throw failed_constructor();
}
@ -125,14 +125,14 @@ CoreAudioSource::init (const string& idstr)
err = ExtAudioFileSetProperty (af, kExtAudioFileProperty_ClientDataFormat, asbd_size, &client_asbd);
if (err != noErr) {
cerr << "ExtAudioFileSetProperty3 " << err << endl;
error << string_compose (_("Could not set client data format for file: %1"), name()) << endmsg;
ExtAudioFileDispose (af);
throw failed_constructor ();
}
if (_build_peakfiles) {
if (initialize_peakfile (false, file)) {
error << "initialize peakfile failed" << endmsg;
error << string_compose(_("initialize peakfile failed for file %1"), name()) << endmsg;
ExtAudioFileDispose (af);
throw failed_constructor ();
}
@ -212,7 +212,24 @@ CoreAudioSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_
float
CoreAudioSource::sample_rate() const
{
/* XXX taybin fill me in please */
AudioStreamBasicDescription client_asbd;
memset(&client_asbd, 0, sizeof(AudioStreamBasicDescription));
return 44100.0f;
OSStatus err = noErr;
size_t asbd_size = sizeof(AudioStreamBasicDescription);
err = ExtAudioFileSetProperty (af, kExtAudioFileProperty_ClientDataFormat, asbd_size, &client_asbd);
if (err != noErr) {
error << string_compose(_("Could not detect samplerate for: %1"), name()) << endmsg;
return 0.0;
}
return client_asbd.mSampleRate;
}
int
CoreAudioSource::update_header (jack_nframes_t when, struct tm&, time_t)
{
return 0;
}

View file

@ -27,7 +27,7 @@
#include <fst.h>
#include <pbd/basename.h>
#include <string.h>
#endif
#endif // VST_SUPPORT
#include <pbd/pathscanner.h>
@ -41,6 +41,11 @@
#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;
@ -95,7 +100,11 @@ PluginManager::refresh ()
if (Config->get_use_vst()) {
vst_refresh ();
}
#endif
#endif // VST_SUPPORT
#ifdef HAVE_COREAUDIO
au_discover ();
#endif // HAVE_COREAUDIO
}
void
@ -302,10 +311,10 @@ PluginManager::load (Session& session, PluginInfo *info)
} 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 {
@ -342,12 +351,15 @@ ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::T
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);
}
@ -489,4 +501,95 @@ PluginManager::vst_discover (string path)
return 0;
}
#endif
#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

View file

@ -253,3 +253,21 @@ path_expand (string path)
#endif
}
#ifdef HAVE_COREAUDIO
string
CFStringRefToStdString(CFStringRef stringRef)
{
CFIndex size =
CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef) ,
kCFStringEncodingUTF8);
char *buf = new char[size];
std::string result;
if(CFStringGetCString(stringRef, buf, size, kCFStringEncodingUTF8)) {
result = buf;
}
delete [] buf;
return result;
}
#endif // HAVE_COREAUDIO

View file

@ -693,7 +693,7 @@ TranzportControlProtocol::update_state ()
/* per track */
if (route_table[0]) {
AudioTrack* at = dynamic_cast<AudioTrack*> (route_table[0]);
boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack> (route_table[0]);
if (at && at->record_enabled()) {
pending_lights[LightTrackrec] = true;
} else {