summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/ardour_ui.cc5
-rw-r--r--gtk2_ardour/ardour_ui2.cc4
-rw-r--r--gtk2_ardour/ardour_ui_dependents.cc4
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc4
-rw-r--r--gtk2_ardour/au_pluginui.h19
-rw-r--r--gtk2_ardour/au_pluginui.mm289
-rw-r--r--gtk2_ardour/audio_clock.cc3
-rw-r--r--gtk2_ardour/automation_time_axis.cc3
-rw-r--r--gtk2_ardour/cocoacarbon.mm215
-rw-r--r--gtk2_ardour/editor.cc1
-rw-r--r--gtk2_ardour/editor_canvas.cc4
-rw-r--r--gtk2_ardour/editor_drag.cc20
-rw-r--r--gtk2_ardour/editor_export_audio.cc1
-rw-r--r--gtk2_ardour/editor_mixer.cc4
-rw-r--r--gtk2_ardour/editor_route_groups.cc4
-rw-r--r--gtk2_ardour/editor_routes.cc6
-rw-r--r--gtk2_ardour/editor_rulers.cc5
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc4
-rw-r--r--gtk2_ardour/gtk_pianokeyboard.c2
-rw-r--r--gtk2_ardour/io_selector.cc2
-rw-r--r--gtk2_ardour/keyeditor.cc23
-rw-r--r--gtk2_ardour/latency_gui.cc1
-rw-r--r--gtk2_ardour/location_ui.cc19
-rw-r--r--gtk2_ardour/main.cc2
-rw-r--r--gtk2_ardour/midi_region_view.cc8
-rw-r--r--gtk2_ardour/midi_tracer.cc1
-rw-r--r--gtk2_ardour/mixer_strip.cc2
-rw-r--r--gtk2_ardour/mixer_ui.cc4
-rw-r--r--gtk2_ardour/monitor_section.cc6
-rw-r--r--gtk2_ardour/plugin_ui.cc8
-rw-r--r--gtk2_ardour/plugin_ui.h2
-rw-r--r--gtk2_ardour/public_editor.h4
-rw-r--r--gtk2_ardour/rc_option_editor.cc6
-rw-r--r--gtk2_ardour/sfdb_ui.cc4
-rw-r--r--gtk2_ardour/startup.cc8
-rw-r--r--gtk2_ardour/step_editor.cc4
-rw-r--r--gtk2_ardour/utils.cc4
-rw-r--r--gtk2_ardour/wscript20
-rw-r--r--libs/appleutility/AUOutputBL.h4
-rw-r--r--libs/appleutility/AUParamInfo.h4
-rw-r--r--libs/appleutility/CAAudioChannelLayout.h4
-rw-r--r--libs/appleutility/CAReferenceCounted.h4
-rw-r--r--libs/appleutility/wscript14
-rw-r--r--libs/ardour/ardour/audio_unit.h146
-rw-r--r--libs/ardour/ardour/caimportable.h3
-rw-r--r--libs/ardour/ardour/coreaudiosource.h9
-rw-r--r--libs/ardour/ardour/plugin.h4
-rw-r--r--libs/ardour/ardour/utils.h8
-rw-r--r--libs/ardour/audio_unit.cc1255
-rw-r--r--libs/ardour/caimportable.cc2
-rw-r--r--libs/ardour/coreaudiosource.cc21
-rw-r--r--libs/ardour/globals.cc1
-rw-r--r--libs/ardour/lv2_event_buffer.cc1
-rw-r--r--libs/ardour/panner.cc1
-rw-r--r--libs/ardour/plugin.cc2
-rw-r--r--libs/ardour/plugin_manager.cc1
-rw-r--r--libs/ardour/rb_effect.cc2
-rw-r--r--libs/ardour/reverse.cc2
-rw-r--r--libs/ardour/send.cc2
-rw-r--r--libs/ardour/session_state.cc1
-rw-r--r--libs/ardour/uri_map.cc1
-rw-r--r--libs/ardour/utils.cc5
-rw-r--r--libs/ardour/wscript9
-rw-r--r--libs/evoral/src/SMF.cpp1
-rw-r--r--libs/evoral/src/Sequence.cpp1
-rw-r--r--libs/gtkmm2ext/gtkapplication_quartz.mm73
-rw-r--r--libs/pbd/cocoa_open_uri.mm19
-rw-r--r--libs/pbd/openuri.cc1
-rw-r--r--libs/pbd/wscript8
-rw-r--r--libs/surfaces/generic_midi/generic_midi_control_protocol.cc1
-rw-r--r--wscript74
71 files changed, 1538 insertions, 871 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index ef727c1e5e..ad802b72a1 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -17,7 +17,10 @@
*/
-#define __STDC_FORMAT_MACROS 1
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <stdint.h>
#include <algorithm>
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc
index 6c957033e7..d92df90f8e 100644
--- a/gtk2_ardour/ardour_ui2.cc
+++ b/gtk2_ardour/ardour_ui2.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc
index 4d38c51e20..f7e6a89eb0 100644
--- a/gtk2_ardour/ardour_ui_dependents.cc
+++ b/gtk2_ardour/ardour_ui_dependents.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
/* this file exists solely to break compilation dependencies that
would connect changes to the mixer or editor objects.
*/
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 6b4a1b035b..c962c63f4e 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
/* This file contains any ARDOUR_UI methods that require knowledge of
the editor, and exists so that no compilation dependency exists
between the main ARDOUR_UI modules and the PublicEditor class. This
diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h
index 445ab27ec5..d4cff951b7 100644
--- a/gtk2_ardour/au_pluginui.h
+++ b/gtk2_ardour/au_pluginui.h
@@ -28,6 +28,16 @@ namespace ARDOUR {
class IOProcessor;
}
+class AUPluginUI;
+
+@interface NotificationObject : NSObject {
+ @private
+ AUPluginUI* plugin_ui;
+ NSWindow* cocoa_parent;
+ NSWindow* top_level_parent;
+}
+@end
+
class AUPluginUI : public PlugUIBase, public Gtk::VBox
{
public:
@@ -42,13 +52,20 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
void activate ();
void deactivate ();
+ bool non_gtk_gui() const { return true; }
+
void lower_box_realized ();
+ void cocoa_view_resized ();
void on_realize ();
void on_show ();
void on_hide ();
bool on_map_event (GdkEventAny*);
bool on_focus_in_event (GdkEventFocus*);
bool on_focus_out_event (GdkEventFocus*);
+ void forward_key_event (GdkEventKey*);
+
+ bool on_window_show (const std::string& /*title*/);
+ void on_window_hide ();
OSStatus carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event);
@@ -80,7 +97,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox
WindowRef carbon_window;
EventHandlerRef carbon_event_handler;
bool _activating_from_app;
- NSView* packView;
+ NotificationObject* _notify;
bool test_cocoa_view_support ();
bool test_carbon_view_support ();
diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm
index cb58f67f6f..0f10af054d 100644
--- a/gtk2_ardour/au_pluginui.mm
+++ b/gtk2_ardour/au_pluginui.mm
@@ -1,9 +1,12 @@
+#include <gtkmm/stock.h>
+
#undef Marker
#define Marker FuckYouAppleAndYourLackOfNameSpaces
+#include "pbd/convert.h"
#include "pbd/error.h"
#include "ardour/audio_unit.h"
-#include "ardour/insert.h"
+#include "ardour/plugin_insert.h"
#undef check // stupid gtk, stupid apple
@@ -15,8 +18,8 @@
#include "au_pluginui.h"
#include "gui_thread.h"
-#include <appleutility/CAAudioUnit.h>
-#include <appleutility/CAComponent.h>
+#include "appleutility/CAAudioUnit.h"
+#include "appleutility/CAComponent.h"
#import <AudioUnit/AUCocoaUIView.h>
#import <CoreAudioKit/AUGenericView.h>
@@ -45,6 +48,65 @@ static const gchar* _automation_mode_strings[] = {
0
};
+@implementation NotificationObject
+
+- (NotificationObject*) initWithPluginUI: (AUPluginUI*) apluginui andCocoaParent: (NSWindow*) cp andTopLevelParent: (NSWindow*) tlp
+{
+ self = [ super init ];
+
+ if (self) {
+ plugin_ui = apluginui;
+ cocoa_parent = cp;
+ top_level_parent = tlp;
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(cocoaParentActivationHandler:)
+ name:NSWindowDidBecomeMainNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(cocoaParentBecameKeyHandler:)
+ name:NSWindowDidBecomeKeyNotification
+ object:nil];
+ }
+
+ return self;
+}
+
+- (void)cocoaParentActivationHandler:(NSNotification *)notification
+{
+ NSWindow* notification_window = (NSWindow *)[notification object];
+
+ if (top_level_parent == notification_window || cocoa_parent == notification_window) {
+ if ([notification_window isMainWindow]) {
+ plugin_ui->activate();
+ } else {
+ plugin_ui->deactivate();
+ }
+ }
+}
+
+- (void)cocoaParentBecameKeyHandler:(NSNotification *)notification
+{
+ NSWindow* notification_window = (NSWindow *)[notification object];
+
+ if (top_level_parent == notification_window || cocoa_parent == notification_window) {
+ if ([notification_window isKeyWindow]) {
+ plugin_ui->activate();
+ } else {
+ plugin_ui->deactivate();
+ }
+ }
+}
+
+- (void)auViewResized:(NSNotification *)notification;
+{
+ (void) notification;
+ plugin_ui->cocoa_view_resized();
+}
+
+@end
+
AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
: PlugUIBase (insert)
, automation_mode_label (_("Automation"))
@@ -67,11 +129,15 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
HBox* smaller_hbox = manage (new HBox);
- smaller_hbox->pack_start (preset_label, false, false, 10);
+ smaller_hbox->set_spacing (6);
+ smaller_hbox->pack_start (preset_label, false, false, 4);
smaller_hbox->pack_start (preset_combo, false, false);
smaller_hbox->pack_start (save_button, false, false);
+#if 0
+ /* one day these might be useful with an AU plugin, but not yet */
smaller_hbox->pack_start (automation_mode_label, false, false);
smaller_hbox->pack_start (automation_mode_selector, false, false);
+#endif
smaller_hbox->pack_start (bypass_button, false, true);
VBox* v1_box = manage (new VBox);
@@ -101,9 +167,10 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
_activating_from_app = false;
cocoa_parent = 0;
+ _notify = 0;
cocoa_window = 0;
au_view = 0;
- packView = 0;
+ editView = 0;
/* prefer cocoa, fall back to cocoa, but use carbon if its there */
@@ -122,19 +189,26 @@ AUPluginUI::~AUPluginUI ()
{
if (cocoa_parent) {
NSWindow* win = get_nswindow();
- RemoveEventHandler(carbon_event_handler);
+ [[NSNotificationCenter defaultCenter] removeObserver:_notify];
[win removeChildWindow:cocoa_parent];
- } else if (carbon_window) {
- /* never parented */
+
+ }
+
+ if (carbon_window) {
+ /* not parented, just overlaid on top of our window */
DisposeWindow (carbon_window);
}
- if (packView) {
+ if (editView) {
+ CloseComponent (editView);
+ }
+
+ if (au_view) {
/* remove whatever we packed into low_box so that GTK doesn't
mess with it.
*/
- [packView removeFromSuperview];
+ [au_view removeFromSuperview];
}
}
@@ -288,17 +362,29 @@ AUPluginUI::create_cocoa_view ()
[(AUGenericView *)au_view setShowsExpertParameters:YES];
}
- packView = au_view;
-
+ // watch for size changes of the view
+
+ [[NSNotificationCenter defaultCenter] addObserver:_notify
+ selector:@selector(auViewResized:) name:NSWindowDidResizeNotification
+ object:au_view];
+
// Get the size of the new AU View's frame
+
NSRect packFrame;
packFrame = [au_view frame];
prefwidth = packFrame.size.width;
prefheight = packFrame.size.height;
-
+ low_box.set_size_request (prefwidth, prefheight);
+
return 0;
}
+void
+AUPluginUI::cocoa_view_resized ()
+{
+ NSRect packFrame = [au_view frame];
+}
+
int
AUPluginUI::create_carbon_view ()
{
@@ -321,11 +407,14 @@ AUPluginUI::create_carbon_view ()
if ((err = CreateNewWindow(kDocumentWindowClass, attr, &r, &carbon_window)) != noErr) {
error << string_compose (_("AUPluginUI: cannot create carbon window (err: %1)"), err) << endmsg;
+ CloseComponent (editView);
return -1;
}
if ((err = GetRootControl(carbon_window, &root_control)) != noErr) {
error << string_compose (_("AUPlugin: cannot get root control of carbon window (err: %1)"), err) << endmsg;
+ DisposeWindow (carbon_window);
+ CloseComponent (editView);
return -1;
}
@@ -335,6 +424,8 @@ AUPluginUI::create_carbon_view ()
if ((err = AudioUnitCarbonViewCreate (editView, *au->get_au(), carbon_window, root_control, &location, &size, &viewPane)) != noErr) {
error << string_compose (_("AUPluginUI: cannot create carbon plugin view (err: %1)"), err) << endmsg;
+ DisposeWindow (carbon_window);
+ CloseComponent (editView);
return -1;
}
@@ -377,70 +468,14 @@ AUPluginUI::get_nswindow ()
void
AUPluginUI::activate ()
{
- if (carbon_window && cocoa_parent) {
- cerr << "APP activated, activate carbon window " << insert->name() << endl;
- _activating_from_app = true;
- ActivateWindow (carbon_window, TRUE);
- _activating_from_app = false;
- [cocoa_parent makeKeyAndOrderFront:nil];
- }
+ ActivateWindow (carbon_window, TRUE);
+ // [cocoa_parent makeKeyAndOrderFront:nil];
}
void
AUPluginUI::deactivate ()
{
- return;
- cerr << "APP DEactivated, for " << insert->name() << endl;
- _activating_from_app = true;
ActivateWindow (carbon_window, FALSE);
- _activating_from_app = false;
-}
-
-
-OSStatus
-_carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event, void *userData)
-{
- return ((AUPluginUI*)userData)->carbon_event (nextHandlerRef, event);
-}
-
-OSStatus
-AUPluginUI::carbon_event (EventHandlerCallRef nextHandlerRef, EventRef event)
-{
- cerr << "CARBON EVENT\n";
-
- UInt32 eventKind = GetEventKind(event);
- ClickActivationResult howToHandleClick;
- NSWindow* win = get_nswindow ();
-
- cerr << "window " << win << " carbon event type " << eventKind << endl;
-
- switch (eventKind) {
- case kEventWindowHandleActivate:
- cerr << "carbon window for " << insert->name() << " activated\n";
- if (_activating_from_app) {
- cerr << "app activation, ignore window activation\n";
- return noErr;
- }
- [win makeMainWindow];
- return eventNotHandledErr;
- break;
-
- case kEventWindowHandleDeactivate:
- cerr << "carbon window for " << insert->name() << " would have been deactivated\n";
- // never deactivate the carbon window
- return noErr;
- break;
-
- case kEventWindowGetClickActivation:
- cerr << "carbon window CLICK activated\n";
- [win makeKeyAndOrderFront:nil];
- howToHandleClick = kActivateAndHandleClick;
- SetEventParameter(event, kEventParamClickActivation, typeClickActivationResult,
- sizeof(ClickActivationResult), &howToHandleClick);
- break;
- }
-
- return noErr;
}
int
@@ -479,18 +514,9 @@ AUPluginUI::parent_carbon_window ()
// create the cocoa window for the carbon one and make it visible
cocoa_parent = [[NSWindow alloc] initWithWindowRef: carbon_window];
- EventTypeSpec windowEventTypes[] = {
- {kEventClassWindow, kEventWindowGetClickActivation },
- {kEventClassWindow, kEventWindowHandleDeactivate }
- };
-
- EventHandlerUPP ehUPP = NewEventHandlerUPP(_carbon_event);
- OSStatus result = InstallWindowEventHandler (carbon_window, ehUPP,
- sizeof(windowEventTypes) / sizeof(EventTypeSpec),
- windowEventTypes, this, &carbon_event_handler);
- if (result != noErr) {
- return -1;
- }
+ SetWindowActivationScope (carbon_window, kWindowActivationScopeNone);
+
+ _notify = [ [NotificationObject alloc] initWithPluginUI:this andCocoaParent:cocoa_parent andTopLevelParent:win ];
[win addChildWindow:cocoa_parent ordered:NSWindowAbove];
@@ -501,7 +527,6 @@ int
AUPluginUI::parent_cocoa_window ()
{
NSWindow* win = get_nswindow ();
- NSRect packFrame;
if (!win) {
return -1;
@@ -515,21 +540,59 @@ AUPluginUI::parent_cocoa_window ()
error << _("AUPluginUI: no top level window!") << endmsg;
return -1;
}
-
- // Get the size of the new AU View's frame
- packFrame = [au_view frame];
- NSView* view = gdk_quartz_window_get_nsview (low_box.get_window()->gobj());
-
+ NSView* view = gdk_quartz_window_get_nsview (get_toplevel()->get_window()->gobj());
+ GtkRequisition a = top_box.size_request ();
- [view setFrame:packFrame];
- [view addSubview:packView];
+ /* move the au_view down so that it doesn't overlap the top_box contents */
- low_box.set_size_request (packFrame.size.width, packFrame.size.height);
+ NSPoint origin = { 0, a.height };
+
+ [au_view setFrameOrigin:origin];
+ [view addSubview:au_view];
return 0;
}
+static void
+dump_view_tree (NSView* view, int depth)
+{
+ NSArray* subviews = [view subviews];
+ unsigned long cnt = [subviews count];
+
+ for (int d = 0; d < depth; d++) {
+ cerr << '\t';
+ }
+ cerr << " view @ " << view << endl;
+
+ for (unsigned long i = 0; i < cnt; ++i) {
+ NSView* subview = [subviews objectAtIndex:i];
+ dump_view_tree (subview, depth+1);
+ }
+}
+
+void
+AUPluginUI::forward_key_event (GdkEventKey* ev)
+{
+ NSEvent* nsevent = gdk_quartz_event_get_nsevent ((GdkEvent*)ev);
+
+ if (au_view && nsevent) {
+
+ /* filter on nsevent type here because GDK massages FlagsChanged
+ messages into GDK_KEY_{PRESS,RELEASE} but Cocoa won't
+ handle a FlagsChanged message as a keyDown or keyUp
+ */
+
+ if ([nsevent type] == NSKeyDown) {
+ [[[au_view window] firstResponder] keyDown:nsevent];
+ } else if ([nsevent type] == NSKeyUp) {
+ [[[au_view window] firstResponder] keyUp:nsevent];
+ } else if ([nsevent type] == NSFlagsChanged) {
+ [[[au_view window] firstResponder] flagsChanged:nsevent];
+ }
+ }
+}
+
void
AUPluginUI::on_realize ()
{
@@ -553,44 +616,48 @@ AUPluginUI::lower_box_realized ()
}
}
-void
-AUPluginUI::on_hide ()
-{
- // VBox::on_hide ();
- cerr << "AU plugin window hidden\n";
-}
-
bool
-AUPluginUI::on_map_event (GdkEventAny* ev)
+AUPluginUI::on_map_event (GdkEventAny*)
{
return false;
}
void
-AUPluginUI::on_show ()
+AUPluginUI::on_window_hide ()
{
- cerr << "AU plugin window shown\n";
+ if (carbon_window) {
+ HideWindow (carbon_window);
+ ActivateWindow (carbon_window, FALSE);
+ }
- VBox::on_show ();
+ hide_all ();
+}
+
+bool
+AUPluginUI::on_window_show (const string& /*title*/)
+{
+ /* this is idempotent so just call it every time we show the window */
gtk_widget_realize (GTK_WIDGET(low_box.gobj()));
- if (au_view) {
- show_all ();
- } else if (carbon_window) {
- [cocoa_parent setIsVisible:YES];
+ show_all ();
+
+ if (carbon_window) {
ShowWindow (carbon_window);
+ ActivateWindow (carbon_window, TRUE);
}
+
+ return true;
}
bool
-AUPluginUI::start_updating (GdkEventAny* any)
+AUPluginUI::start_updating (GdkEventAny*)
{
return false;
}
bool
-AUPluginUI::stop_updating (GdkEventAny* any)
+AUPluginUI::stop_updating (GdkEventAny*)
{
return false;
}
@@ -604,7 +671,7 @@ create_au_gui (boost::shared_ptr<PluginInsert> plugin_insert, VBox** box)
}
bool
-AUPluginUI::on_focus_in_event (GdkEventFocus* ev)
+AUPluginUI::on_focus_in_event (GdkEventFocus*)
{
//cerr << "au plugin focus in\n";
//Keyboard::magic_widget_grab_focus ();
@@ -612,7 +679,7 @@ AUPluginUI::on_focus_in_event (GdkEventFocus* ev)
}
bool
-AUPluginUI::on_focus_out_event (GdkEventFocus* ev)
+AUPluginUI::on_focus_out_event (GdkEventFocus*)
{
//cerr << "au plugin focus out\n";
//Keyboard::magic_widget_drop_focus ();
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index 3f60c6d3b1..3916830eae 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -23,6 +23,7 @@
#include "pbd/convert.h"
#include "pbd/enumwriter.h"
+#include <gtkmm/style.h>
#include <gtkmm2ext/utils.h>
#include "ardour/ardour.h"
@@ -2084,7 +2085,7 @@ AudioClock::set_bbt_reference (framepos_t pos)
}
void
-AudioClock::on_style_changed (const Glib::RefPtr<Style>& old_style)
+AudioClock::on_style_changed (const Glib::RefPtr<Gtk::Style>& old_style)
{
HBox::on_style_changed (old_style);
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 6c67d2f8fe..d316e74160 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -973,7 +973,8 @@ AutomationTimeAxisView::set_state (const XMLNode& node, int version)
}
int
-AutomationTimeAxisView::set_state_2X (const XMLNode& node, int version)
+
+AutomationTimeAxisView::set_state_2X (const XMLNode& node, int /*version*/)
{
if (node.name() == X_("gain") && _control->parameter() == Evoral::Parameter (GainAutomation)) {
XMLProperty const * shown = node.property (X_("shown"));
diff --git a/gtk2_ardour/cocoacarbon.mm b/gtk2_ardour/cocoacarbon.mm
index 84e34bd74d..072008e9a1 100644
--- a/gtk2_ardour/cocoacarbon.mm
+++ b/gtk2_ardour/cocoacarbon.mm
@@ -16,171 +16,116 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <Carbon/Carbon.h>
-#undef check // stupid, stupid carbon
-#undef YES // stupid, stupid gtkmm and/or NSObjC
-#undef NO // ditto
-
-#ifdef GTKOSX
-#include <objc/objc.h>
-#ifdef nil
- /*Stupid OS X defining nil*/
-#undef nil
-#endif
-#endif
+#include <string>
+#include <ctype.h>
+#include <stdlib.h>
+#include <pbd/error.h>
+#include <gtkmm2ext/gtkapplication.h>
+#include <gdk/gdkquartz.h>
+#undef check
+#undef YES
+#undef NO
#include "ardour_ui.h"
#include "actions.h"
#include "opts.h"
-#include <gtkmm2ext/sync-menu.h>
-
-#include <Appkit/Appkit.h>
-#include <gdk/gdkquartz.h>
-sigc::signal<void,bool> ApplicationActivationChanged;
-static EventHandlerRef application_event_handler_ref;
+#include <CoreFoundation/CFLocale.h>
+#import <CoreFoundation/CFString.h>
+#import <Foundation/NSString.h>
+#import <Foundation/NSAutoreleasePool.h>
-/* Called for clicks on the dock icon. Can be used to unminimize or
- * create a new window for example.
- */
+using namespace std;
+using namespace PBD;
-static OSErr
-handle_reopen_application (const AppleEvent *inAppleEvent,
- AppleEvent *outAppleEvent,
- long inHandlerRefcon)
+void
+ARDOUR_UI::platform_specific ()
{
- return noErr;
-}
+ gtk_application_ready ();
+ if (!ARDOUR_COMMAND_LINE::finder_invoked_ardour) {
+
+ /* if invoked from the command line, make sure we're visible */
+
+ [NSApp activateIgnoringOtherApps:1];
+ }
+}
-static OSErr
-handle_print_documents (const AppleEvent *inAppleEvent,
- AppleEvent *outAppleEvent,
- long inHandlerRefcon)
+void
+ARDOUR_UI::platform_setup ()
{
- return noErr;
}
-
-static OSErr
-handle_open_documents (const AppleEvent *inAppleEvent,
- AppleEvent *outAppleEvent,
- long inHandlerRefcon)
+bool
+cocoa_open_url (const char* uri)
{
- AEDescList docs;
-
- if (AEGetParamDesc(inAppleEvent, keyDirectObject, typeAEList, &docs) == noErr) {
- long n = 0;
- AECountItems(&docs, &n);
- UInt8 strBuffer[PATH_MAX+1];
-
- /* ardour only opens 1 session at a time */
-
- FSRef ref;
-
- if (AEGetNthPtr(&docs, 1, typeFSRef, 0, 0, &ref, sizeof(ref), 0) == noErr) {
- if (FSRefMakePath(&ref, strBuffer, sizeof(strBuffer)) == noErr) {
- Glib::ustring utf8_path ((const char*) strBuffer);
- ARDOUR_UI::instance()->idle_load (utf8_path);
- }
- }
- }
+ NSString* struri = [[NSString alloc] initWithUTF8String:uri];
+ NSURL* nsurl = [[NSURL alloc] initWithString:struri];
- return noErr;
-}
+ bool ret = [[NSWorkspace sharedWorkspace] openURL:nsurl];
-static OSErr
-handle_open_application (const AppleEvent *inAppleEvent,
- AppleEvent *outAppleEvent,
- long inHandlerRefcon)
-{
- return noErr;
-}
+ [struri release];
+ [nsurl release];
-static OSStatus
-application_event_handler (EventHandlerCallRef nextHandlerRef, EventRef event, void *userData)
-{
- UInt32 eventKind = GetEventKind (event);
-
- switch (eventKind) {
- case kEventAppActivated:
- ApplicationActivationChanged (true); // EMIT SIGNAL
- return eventNotHandledErr;
-
- case kEventAppDeactivated:
- ApplicationActivationChanged (false); // EMIT SIGNAL
- return eventNotHandledErr;
-
- default:
- // pass-thru all kEventClassApplication events we're not interested in.
- break;
- }
- return eventNotHandledErr;
+ return ret;
}
void
-ARDOUR_UI::platform_specific ()
+set_language_preference ()
{
- Gtk::Widget* widget = ActionManager::get_widget ("/ui/Main/Session/Quit");
- if (widget) {
- ige_mac_menu_set_quit_menu_item ((GtkMenuItem*) widget->gobj());
- }
+ gtk_disable_setlocale ();
- IgeMacMenuGroup* group = ige_mac_menu_add_app_menu_group ();
-
- widget = ActionManager::get_widget ("/ui/Main/Session/About");
- if (widget) {
- ige_mac_menu_add_app_menu_item (group, (GtkMenuItem*) widget->gobj(), 0);
+ if (g_getenv ("LANGUAGE") || g_getenv ("LC_ALL") || g_getenv ("LANG")) {
+ return;
}
- widget = ActionManager::get_widget ("/ui/Main/Session/ToggleOptionsEditor");
- if (widget) {
- ige_mac_menu_add_app_menu_item (group, (GtkMenuItem*) widget->gobj(), 0);
+ if (g_getenv ("ARDOUR_EN")) {
+ return;
}
-}
-void
-ARDOUR_UI::platform_setup ()
-{
- AEInstallEventHandler (kCoreEventClass, kAEOpenDocuments,
- handle_open_documents, 0, true);
-
- AEInstallEventHandler (kCoreEventClass, kAEOpenApplication,
- handle_open_application, 0, true);
-
- AEInstallEventHandler (kCoreEventClass, kAEReopenApplication,
- handle_reopen_application, 0, true);
+ /* the gettext manual is potentially misleading about the utility of
+ LANGUAGE. It notes that if LANGUAGE is set to include a dialect/region-free
+ language code, like "it", it will assume that you mean the main
+ dialect (e.g. "it_IT"). But in reality, it doesn't bother looking for
+ locale dirs with the full name, only the short code (it doesn't
+ know any better).
+
+ Since Apple's preferred language list only consists of short language codes,
+ if we set LANGUAGE then gettext will not look for the relevant long-form
+ variants.
+ */
+
+ /* how to get language preferences with CoreFoundation
+ */
+
+ NSArray* languages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
+
+ /* push into LANGUAGE */
- AEInstallEventHandler (kCoreEventClass, kAEPrintDocuments,
- handle_print_documents, 0, true);
+ if (languages && [languages count] > 0) {
- EventTypeSpec applicationEventTypes[] = {
- {kEventClassApplication, kEventAppActivated },
- {kEventClassApplication, kEventAppDeactivated }
- };
-
- EventHandlerUPP ehUPP = NewEventHandlerUPP (application_event_handler);
-
- InstallApplicationEventHandler (ehUPP, sizeof(applicationEventTypes) / sizeof(EventTypeSpec),
- applicationEventTypes, 0, &application_event_handler_ref);
- if (!ARDOUR_COMMAND_LINE::finder_invoked_ardour) {
-
- /* if invoked from the command line, make sure we're visible */
-
- [NSApp activateIgnoringOtherApps:1];
- }
-}
+ int i, count = [languages count];
+ for (i = 0; i < count; ++i) {
+ if ([[languages objectAtIndex:i]
+ isEqualToString:@"en"]) {
+ count = i+1;
+ break;
+ }
+ }
+ NSRange r = { 0, count };
+ setenv ("LANGUAGE", [[[languages subarrayWithRange:r] componentsJoinedByString:@":"] UTF8String], 0);
+ cout << "LANGUAGE set to " << getenv ("LANGUAGE") << endl;
+ }
-bool
-cocoa_open_url (const char* uri)
-{
- NSString* struri = [[NSString alloc] initWithUTF8String:uri];
- NSURL* nsurl = [[NSURL alloc] initWithString:struri];
+ /* now get AppleLocale value and use that for LANG */
- bool ret = [[NSWorkspace sharedWorkspace] openURL:nsurl];
+ CFLocaleRef cflocale = CFLocaleCopyCurrent();
+ NSString* nslocale = (NSString*) CFLocaleGetValue (cflocale, kCFLocaleIdentifier);
- [struri release];
- [nsurl release];
+ /* the full POSIX locale specification allows for lots of things. that could be an issue. Silly Apple.
+ */
- return ret;
+ cout << "LANG set to " << [nslocale UTF8String] << endl;
+ setenv ("LANG", [nslocale UTF8String], 0);
+ CFRelease (cflocale);
}
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index c245c0b45b..7bbf4493fe 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -19,7 +19,6 @@
/* Note: public Editor methods are documented in public_editor.h */
-#define __STDC_LIMIT_MACROS 1
#include <stdint.h>
#include <unistd.h>
#include <cstdlib>
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 28c0708f62..7da8d08f52 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <libgnomecanvasmm/init.h>
#include <libgnomecanvasmm/pixbuf.h>
#include <jack/types.h>
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 2a3b6a6edb..b4cfbf06ae 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <stdint.h>
#include "pbd/memento_command.h"
@@ -795,11 +799,7 @@ RegionMoveDrag::finished (GdkEvent *, bool movement_occurred)
}
void
-RegionMoveDrag::finished_copy (
- bool const changed_position,
- bool const changed_tracks,
- framecnt_t const drag_delta
- )
+RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed_tracks*/, framecnt_t const drag_delta)
{
RegionSelection new_views;
PlaylistSet modified_playlists;
@@ -1362,7 +1362,7 @@ RegionCreateDrag::motion (GdkEvent* event, bool first_move)
}
void
-RegionCreateDrag::finished (GdkEvent* event, bool movement_occurred)
+RegionCreateDrag::finished (GdkEvent*, bool movement_occurred)
{
if (!movement_occurred) {
add_region ();
@@ -1514,7 +1514,7 @@ TrimDrag::TrimDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<Region
}
void
-TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
+TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
{
double speed = 1.0;
TimeAxisView* tvp = &_primary->get_time_axis_view ();
@@ -2863,7 +2863,7 @@ FeatureLineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
}
void
-FeatureLineDrag::motion (GdkEvent* event, bool)
+FeatureLineDrag::motion (GdkEvent*, bool)
{
double dx = _drags->current_pointer_x() - last_pointer_x();
@@ -2887,7 +2887,7 @@ FeatureLineDrag::motion (GdkEvent* event, bool)
}
void
-FeatureLineDrag::finished (GdkEvent* event, bool)
+FeatureLineDrag::finished (GdkEvent*, bool)
{
_arv = reinterpret_cast<AudioRegionView*> (_item->get_data ("regionview"));
_arv->update_transient(_before, _line->property_x1());
@@ -3978,7 +3978,7 @@ AutomationRangeDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
}
void
-AutomationRangeDrag::motion (GdkEvent* event, bool first_move)
+AutomationRangeDrag::motion (GdkEvent*, bool /*first_move*/)
{
if (_nothing_to_drag) {
return;
diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc
index 342ccb80e0..444c77437e 100644
--- a/gtk2_ardour/editor_export_audio.cc
+++ b/gtk2_ardour/editor_export_audio.cc
@@ -19,7 +19,6 @@
/* Note: public Editor methods are documented in public_editor.h */
-#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
#include <unistd.h>
#include <climits>
diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc
index de06c146b1..c5006b2ae0 100644
--- a/gtk2_ardour/editor_mixer.cc
+++ b/gtk2_ardour/editor_mixer.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <glibmm/miscutils.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/window_title.h>
diff --git a/gtk2_ardour/editor_route_groups.cc b/gtk2_ardour/editor_route_groups.cc
index ad7c2e4ac6..abdb4d7873 100644
--- a/gtk2_ardour/editor_route_groups.cc
+++ b/gtk2_ardour/editor_route_groups.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <cstdlib>
#include <cmath>
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index f8bd503244..dd50bb93d8 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -249,7 +249,7 @@ EditorRoutes::focus_out (GdkEventFocus*)
}
bool
-EditorRoutes::enter_notify (GdkEventCrossing* ev)
+EditorRoutes::enter_notify (GdkEventCrossing*)
{
/* arm counter so that ::selection_filter() will deny selecting anything for the
next two attempts to change selection status.
@@ -261,7 +261,7 @@ EditorRoutes::enter_notify (GdkEventCrossing* ev)
}
bool
-EditorRoutes::leave_notify (GdkEventCrossing* ev)
+EditorRoutes::leave_notify (GdkEventCrossing*)
{
selection_countdown = 0;
@@ -1018,7 +1018,7 @@ EditorRoutes::button_press (GdkEventButton* ev)
}
bool
-EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const &path , bool selected)
+EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const&, bool /*selected*/)
{
if (selection_countdown) {
if (--selection_countdown == 0) {
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index ff759f4b76..152fef8f83 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -17,7 +17,10 @@
*/
-#define __STDC_FORMAT_MACROS 1
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <cstdio> // for sprintf, grrr
#include <cmath>
#include <inttypes.h>
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index 98186a8e77..0d0fd4e841 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <cstdio> // for sprintf, grrr
#include <cstdlib>
#include <cmath>
diff --git a/gtk2_ardour/gtk_pianokeyboard.c b/gtk2_ardour/gtk_pianokeyboard.c
index 4e91c0a671..f9ab9068e4 100644
--- a/gtk2_ardour/gtk_pianokeyboard.c
+++ b/gtk2_ardour/gtk_pianokeyboard.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2007, 2008 Edward Tomasz Napierała <trasz@FreeBSD.org>
+ * Copyright (c) 2007, 2008 Edward Tomasz Napierała <trasz@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc
index 3e8feba60c..30c581367d 100644
--- a/gtk2_ardour/io_selector.cc
+++ b/gtk2_ardour/io_selector.cc
@@ -254,7 +254,7 @@ IOSelectorWindow::on_show ()
}
void
-IOSelectorWindow::io_name_changed (void* src)
+IOSelectorWindow::io_name_changed (void*)
{
ENSURE_GUI_THREAD (*this, &IOSelectorWindow::io_name_changed, src)
diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc
index 2a72adb5dd..83481d8172 100644
--- a/gtk2_ardour/keyeditor.cc
+++ b/gtk2_ardour/keyeditor.cc
@@ -1,3 +1,26 @@
+/*
+ Copyright (C) 2002 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
+ 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.
+
+*/
+
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <map>
#include "ardour/profile.h"
diff --git a/gtk2_ardour/latency_gui.cc b/gtk2_ardour/latency_gui.cc
index 87ca39326e..73b6bf1a30 100644
--- a/gtk2_ardour/latency_gui.cc
+++ b/gtk2_ardour/latency_gui.cc
@@ -1,4 +1,3 @@
-#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
#include <iomanip>
diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc
index 25a7eee1f8..aadbbfc5b7 100644
--- a/gtk2_ardour/location_ui.cc
+++ b/gtk2_ardour/location_ui.cc
@@ -557,10 +557,8 @@ LocationEditRow::end_changed (ARDOUR::Location *loc)
}
void
-LocationEditRow::start_changed (ARDOUR::Location *loc)
+LocationEditRow::start_changed (ARDOUR::Location*)
{
- ENSURE_GUI_THREAD (*this, &LocationEditRow::start_changed, loc)
-
if (!location) return;
// update end and length
@@ -578,10 +576,8 @@ LocationEditRow::start_changed (ARDOUR::Location *loc)
}
void
-LocationEditRow::name_changed (ARDOUR::Location *loc)
+LocationEditRow::name_changed (ARDOUR::Location *)
{
- ENSURE_GUI_THREAD (*this, &LocationEditRow::name_changed, loc)
-
if (!location) return;
// update end and length
@@ -595,9 +591,8 @@ LocationEditRow::name_changed (ARDOUR::Location *loc)
}
void
-LocationEditRow::location_changed (ARDOUR::Location *loc)
+LocationEditRow::location_changed (ARDOUR::Location*)
{
- ENSURE_GUI_THREAD (*this, &LocationEditRow::location_changed, loc)
if (!location) return;
@@ -614,7 +609,7 @@ LocationEditRow::location_changed (ARDOUR::Location *loc)
}
void
-LocationEditRow::flags_changed (ARDOUR::Location *loc, void *src)
+LocationEditRow::flags_changed (ARDOUR::Location*, void *)
{
if (!location) {
return;
@@ -630,7 +625,7 @@ LocationEditRow::flags_changed (ARDOUR::Location *loc, void *src)
}
void
-LocationEditRow::lock_changed (ARDOUR::Location *loc)
+LocationEditRow::lock_changed (ARDOUR::Location*)
{
if (!location) {
return;
@@ -646,7 +641,7 @@ LocationEditRow::lock_changed (ARDOUR::Location *loc)
}
void
-LocationEditRow::position_lock_style_changed (ARDOUR::Location* loc)
+LocationEditRow::position_lock_style_changed (ARDOUR::Location*)
{
if (!location) {
return;
@@ -826,8 +821,6 @@ struct LocationSortByStart {
void
LocationUI::location_added (Location* location)
{
- ENSURE_GUI_THREAD (*this, &LocationUI::location_added, location)
-
if (location->is_auto_punch()) {
punch_edit_row.set_location(location);
} else if (location->is_auto_loop()) {
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index 07dd846ae2..fa038b30bb 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -488,7 +488,7 @@ session at this time, because we would lose your connection information.\n"), PR
}
static void
-sigpipe_handler (int sig)
+sigpipe_handler (int /*signal*/)
{
/* XXX fix this so that we do this again after a reconnect to JACK
*/
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 6fd96f3481..fcc8b6d0b3 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -317,7 +317,7 @@ MidiRegionView::enter_notify (GdkEventCrossing* ev)
}
bool
-MidiRegionView::leave_notify (GdkEventCrossing* ev)
+MidiRegionView::leave_notify (GdkEventCrossing*)
{
trackview.editor().hide_verbose_canvas_cursor ();
delete _ghost_note;
@@ -2677,7 +2677,7 @@ MidiRegionView::note_entered(ArdourCanvas::CanvasNoteEvent* ev)
}
void
-MidiRegionView::note_left (ArdourCanvas::CanvasNoteEvent* note)
+MidiRegionView::note_left (ArdourCanvas::CanvasNoteEvent*)
{
Editor* editor = dynamic_cast<Editor*>(&trackview.editor());
@@ -2694,7 +2694,7 @@ MidiRegionView::note_left (ArdourCanvas::CanvasNoteEvent* note)
}
void
-MidiRegionView::note_mouse_position (float x_fraction, float y_fraction, bool can_set_cursor)
+MidiRegionView::note_mouse_position (float x_fraction, float /*y_fraction*/, bool can_set_cursor)
{
Editor* editor = dynamic_cast<Editor*>(&trackview.editor());
@@ -3027,7 +3027,7 @@ MidiRegionView::drop_down_keys ()
}
void
-MidiRegionView::maybe_select_by_position (GdkEventButton* ev, double x, double y)
+MidiRegionView::maybe_select_by_position (GdkEventButton* ev, double /*x*/, double y)
{
double note = midi_stream_view()->y_to_note(y);
Events e;
diff --git a/gtk2_ardour/midi_tracer.cc b/gtk2_ardour/midi_tracer.cc
index 8a50a83314..51c9ae174f 100644
--- a/gtk2_ardour/midi_tracer.cc
+++ b/gtk2_ardour/midi_tracer.cc
@@ -17,7 +17,6 @@
*/
-#define __STDC_FORMAT_MACROS 1
#include <stdint.h>
#include <sstream>
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index ec4111bc6e..e11f1712da 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -1386,7 +1386,7 @@ MixerStrip::route_group_changed ()
void
-MixerStrip::route_gui_changed (string what_changed, void* ignored)
+MixerStrip::route_gui_changed (string what_changed, void*)
{
ENSURE_GUI_THREAD (*this, &MixerStrip::route_gui_changed, what_changed, ignored)
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 11be303099..4a3ec325a1 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <algorithm>
#include <map>
#include <sigc++/bind.h>
diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc
index 4ec4166dd1..8173e8833d 100644
--- a/gtk2_ardour/monitor_section.cc
+++ b/gtk2_ardour/monitor_section.cc
@@ -954,7 +954,7 @@ MonitorSection::solo_blink (bool onoff)
}
bool
-MonitorSection::cancel_solo (GdkEventButton* ev)
+MonitorSection::cancel_solo (GdkEventButton*)
{
if (_session) {
if (_session->soloing()) {
@@ -968,7 +968,7 @@ MonitorSection::cancel_solo (GdkEventButton* ev)
}
bool
-MonitorSection::cancel_isolate (GdkEventButton* ev)
+MonitorSection::cancel_isolate (GdkEventButton*)
{
if (_session) {
boost::shared_ptr<RouteList> rl (_session->get_routes ());
@@ -979,7 +979,7 @@ MonitorSection::cancel_isolate (GdkEventButton* ev)
}
bool
-MonitorSection::cancel_audition (GdkEventButton* ev)
+MonitorSection::cancel_audition (GdkEventButton*)
{
if (_session) {
_session->cancel_audition();
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index 90f5a6cbd1..291800615d 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -277,13 +277,13 @@ PluginUIWindow::create_vst_editor(boost::shared_ptr<PluginInsert>)
}
bool
-#if defined (HAVE_AUDIOUNITS) && defined (GTKOSX)
+#ifdef GTKOSX
PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert> insert)
#else
PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert>)
#endif
{
-#if !defined(HAVE_AUDIOUNITS) || !defined(GTKOSX)
+#ifndef GTKOSX
return false;
#else
VBox* box;
@@ -299,13 +299,13 @@ PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert>)
}
void
-#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
+#ifdef GTKOSX
PluginUIWindow::app_activated (bool yn)
#else
PluginUIWindow::app_activated (bool)
#endif
{
-#if defined (HAVE_AUDIOUNITS) && defined(GTKOSX)
+#ifdef GTKOSX
cerr << "APP activated ? " << yn << endl;
if (_pluginui) {
if (yn) {
diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h
index adc3f1dc2b..c279268d94 100644
--- a/gtk2_ardour/plugin_ui.h
+++ b/gtk2_ardour/plugin_ui.h
@@ -325,7 +325,7 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox
};
#endif // VST_SUPPORT
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNITS
/* this function has to be in a .mm file */
extern PlugUIBase* create_au_gui (boost::shared_ptr<ARDOUR::PluginInsert>, Gtk::VBox**);
#endif
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 341b023c12..711b069e25 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -20,6 +20,10 @@
#ifndef __gtk_ardour_public_editor_h__
#define __gtk_ardour_public_editor_h__
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <map>
#include <string>
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc
index b3ef8189cd..1cb29e5be2 100644
--- a/gtk2_ardour/rc_option_editor.cc
+++ b/gtk2_ardour/rc_option_editor.cc
@@ -1,3 +1,7 @@
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <gtkmm/liststore.h>
#include <gtkmm/stock.h>
#include <gtkmm/scale.h>
@@ -715,7 +719,7 @@ RCOptionEditor::RCOptionEditor ()
if (hwcpus > 1) {
add_option (_("Misc"), new OptionEditorHeading (_("DSP CPU Utilization")));
- ComboOption<uint32_t>* procs = new ComboOption<uint32_t> (
+ ComboOption<int32_t>* procs = new ComboOption<int32_t> (
"processor-usage",
_("Signal processing uses"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_processor_usage),
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index d6bd6341cf..aed3d52089 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <map>
#include <cerrno>
#include <sstream>
diff --git a/gtk2_ardour/startup.cc b/gtk2_ardour/startup.cc
index 186608e596..c32b798651 100644
--- a/gtk2_ardour/startup.cc
+++ b/gtk2_ardour/startup.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <fstream>
#include <algorithm>
@@ -674,7 +678,7 @@ ArdourStartup::setup_new_session_page ()
new_folder_chooser.set_title (_("Select folder for session"));
#ifdef GTKOSX
- new_folder_chooser->add_shortcut_folder ("/Volumes");
+ new_folder_chooser.add_shortcut_folder ("/Volumes");
#endif
vbox1->pack_start (*hbox2, false, false);
@@ -928,7 +932,7 @@ ArdourStartup::setup_existing_session_page ()
existing_session_chooser.signal_file_set().connect (sigc::mem_fun (*this, &ArdourStartup::existing_session_selected));
#ifdef GTKOSX
- existing_session_chooser->add_shortcut_folder ("/Volumes");
+ existing_session_chooser.add_shortcut_folder ("/Volumes");
#endif
HBox* hbox = manage (new HBox);
diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc
index 481c60d7aa..5e7969bb3a 100644
--- a/gtk2_ardour/step_editor.cc
+++ b/gtk2_ardour/step_editor.cc
@@ -186,13 +186,13 @@ StepEditor::check_step_edit ()
}
int
-StepEditor::step_add_bank_change (uint8_t channel, uint8_t bank)
+StepEditor::step_add_bank_change (uint8_t /*channel*/, uint8_t /*bank*/)
{
return 0;
}
int
-StepEditor::step_add_program_change (uint8_t channel, uint8_t program)
+StepEditor::step_add_program_change (uint8_t /*channel*/, uint8_t /*program*/)
{
return 0;
}
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index fe81ce54ff..621cdb0dd9 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -17,6 +17,10 @@
*/
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
#include <pango/pangoft2.h> // for fontmap resolution control for GnomeCanvas
#include <pango/pangocairo.h> // for fontmap resolution control for GnomeCanvas
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index 52a28f286f..c54287e666 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -277,9 +277,10 @@ def build(bld):
obj.target = 'ardour-3.0'
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
obj.uselib = 'UUID FLAC GLIBMM GTHREAD GTK GNOMECANVAS OGG ALSA CURL DL'
- obj.uselib += ' GTKMM GNOMECANVASMM OSX GTKOSX COREAUDIO'
+ obj.uselib += ' GTKMM GNOMECANVASMM '
+ obj.uselib += ' AUDIOUNITS OSX GTKOSX '
obj.uselib_local = '''libpbd libmidipp libtaglib libardour libardour_cp
- libgtkmm2ext libtaglib'''
+ libgtkmm2ext libappleutility libtaglib'''
obj.cflags = ['-DPACKAGE="gtk2_ardour"']
obj.cxxflags = ['-DPACKAGE="gtk2_ardour"']
obj.cxxflags += ['-DVERSIONSTRING="' + bld.env['VERSION'] + '"']
@@ -289,6 +290,7 @@ def build(bld):
obj.cxxflags += ['-DLOCALEDIR="' + os.path.join(
os.path.normpath(bld.env['DATADIR']), 'locale') + '"']
obj.cxxflags += ['-DPROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"']
+ obj.cxxflags += ['-I../libs']
if bld.env['HAVE_SLV2']:
obj.source += [ 'lv2_plugin_ui.cc' ]
@@ -304,14 +306,10 @@ def build(bld):
if bld.env['PHONE_HOME']:
obj.cxxflags += [ '-DPHONE_HOME' ]
- if bld.env['GTKOSX']:
+ if bld.env['COREAUDIO']:
TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
- obj.source += [ 'cocoacarbon.mm' ]
-
- if bld.env['AUDIOUNITS']:
- obj.source += [ 'au_pluginui.mm' ]
- obj.uselib_local += ' libappleutility '
-
+ obj.source += [ 'cocoacarbon.mm', 'au_pluginui.mm' ]
+ obj.uselib_local += ' libappleutility '
else:
obj.source += [ 'x11.cc' ]
@@ -346,13 +344,13 @@ def build(bld):
obj = bld.new_task_gen('subst')
obj.source = 'ardev_common.sh.in'
obj.target = 'ardev_common_waf.sh'
- obj.chmod = 0o755
+ obj.chmod = 0755
obj.dict = wrapper_subst_dict
obj = bld.new_task_gen('subst')
obj.source = 'ardour.sh.in'
obj.target = 'ardour3'
- obj.chmod = 0o755
+ obj.chmod = 0755
obj.dict = wrapper_subst_dict
obj.install_path = bld.env['BINDIR']
diff --git a/libs/appleutility/AUOutputBL.h b/libs/appleutility/AUOutputBL.h
index b80588abac..e76d1bfe28 100644
--- a/libs/appleutility/AUOutputBL.h
+++ b/libs/appleutility/AUOutputBL.h
@@ -108,8 +108,8 @@ private:
UInt32 mFrames;
// don't want to copy these.. can if you want, but more code to write!
- AUOutputBL (const AUOutputBL &c) {}
- AUOutputBL& operator= (const AUOutputBL& c) { return *this; }
+ AUOutputBL (const AUOutputBL &) {}
+ AUOutputBL& operator= (const AUOutputBL&) { return *this; }
};
#endif // __AUOutputBL_h__
diff --git a/libs/appleutility/AUParamInfo.h b/libs/appleutility/AUParamInfo.h
index 9d342080b1..8e446394c4 100644
--- a/libs/appleutility/AUParamInfo.h
+++ b/libs/appleutility/AUParamInfo.h
@@ -102,6 +102,6 @@ private:
// disallow
AUParamInfo () {}
- AUParamInfo (const AUParamInfo &c) {}
- AUParamInfo& operator= (const AUParamInfo& c) { return *this; }
+ AUParamInfo (const AUParamInfo &) {}
+ AUParamInfo& operator= (const AUParamInfo&) { return *this; }
};
diff --git a/libs/appleutility/CAAudioChannelLayout.h b/libs/appleutility/CAAudioChannelLayout.h
index 8f995b8614..796f197c3b 100644
--- a/libs/appleutility/CAAudioChannelLayout.h
+++ b/libs/appleutility/CAAudioChannelLayout.h
@@ -150,8 +150,8 @@ private:
private:
ACLRefCounter () : mLayout(NULL) { }
- ACLRefCounter(const ACLRefCounter& c) : mLayout(NULL) { }
- ACLRefCounter& operator=(const ACLRefCounter& c) { return *this; }
+ ACLRefCounter(const ACLRefCounter&) : mLayout(NULL) { }
+ ACLRefCounter& operator=(const ACLRefCounter&) { return *this; }
};
ACLRefCounter *mLayoutHolder;
diff --git a/libs/appleutility/CAReferenceCounted.h b/libs/appleutility/CAReferenceCounted.h
index d57f97c31f..fc18dc8ca4 100644
--- a/libs/appleutility/CAReferenceCounted.h
+++ b/libs/appleutility/CAReferenceCounted.h
@@ -75,8 +75,8 @@ protected:
private:
SInt32 mRefCount;
- CAReferenceCounted(const CAReferenceCounted &a) : mRefCount(0) { }
- CAReferenceCounted operator=(const CAReferenceCounted &a) { return *this; }
+ CAReferenceCounted(const CAReferenceCounted &) : mRefCount(0) { }
+ CAReferenceCounted operator=(const CAReferenceCounted &) { return *this; }
};
diff --git a/libs/appleutility/wscript b/libs/appleutility/wscript
index 87b713a0dc..9bcecd06df 100644
--- a/libs/appleutility/wscript
+++ b/libs/appleutility/wscript
@@ -27,14 +27,14 @@ def configure(conf):
autowaf.configure(conf)
def build(bld):
- obj = bld.new_task_gen('cxx', 'shlib',
- uselib = 'COREAUDIO CORESERVICES COREFOUNDATION AUDIOTOOLBOX AUDIOUNITS OSX GTKOSX')
- obj.source = libappleutility_sources
+ obj = bld.new_task_gen('cxx', 'shlib')
+ obj.uselib = 'AUDIOUNITS OSX'
+ obj.source = libappleutility_sources
obj.export_incdirs = ['.']
- obj.includes = ['.']
- obj.name = 'libappleutility'
- obj.target = 'appleutility'
- obj.install_path = os.path.join(bld.env['LIBDIR'], 'appleutility')
+ obj.includes = ['.']
+ obj.name = 'libappleutility'
+ obj.target = 'appleutility'
+ obj.install_path = os.path.join(bld.env['LIBDIR'], 'appleutility')
def shutdown():
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h
index 3ec17cda59..4d12df9bcf 100644
--- a/libs/ardour/ardour/audio_unit.h
+++ b/libs/ardour/ardour/audio_unit.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2006 Paul Davis
+ Copyright (C) 2006 Paul Davis
Written by Taybin Rutkin
This program is free software; you can redistribute it and/or modify
@@ -30,14 +30,14 @@
#include <vector>
#include <map>
+#include "ardour/plugin.h"
+
#include <AudioUnit/AudioUnit.h>
-#include <appleutility/AUParamInfo.h>
+#include <AudioUnit/AudioUnitProperties.h>
+#include "appleutility/AUParamInfo.h"
#include <boost/shared_ptr.hpp>
-#include "ardour/plugin.h"
-#include "ardour/chan_mapping.h"
-
class CAComponent;
class CAAudioUnit;
class CAComponentDescription;
@@ -64,102 +64,144 @@ class AUPlugin : public ARDOUR::Plugin
AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> comp);
AUPlugin (const AUPlugin& other);
virtual ~AUPlugin ();
-
- std::string unique_id () const;
+
+ std::string unique_id () const;
const char * label () const;
const char * name () const { return _info->name.c_str(); }
const char * maker () const { return _info->creator.c_str(); }
uint32_t parameter_count () const;
float default_value (uint32_t port);
- nframes_t latency () const;
+ nframes_t signal_latency() const;
void set_parameter (uint32_t which, float val);
float get_parameter (uint32_t which) const;
-
+
int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
uint32_t nth_parameter (uint32_t which, bool& ok) const;
void activate ();
void deactivate ();
- void set_block_size (nframes_t nframes);
-
- int connect_and_run (std::vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset);
- std::set<uint32_t> automatable() const;
- std::string describe_parameter (uint32_t);
+ void flush ();
+ int set_block_size (nframes_t nframes);
+
+ int connect_and_run (BufferSet& bufs,
+ ChanMapping in, ChanMapping out,
+ nframes_t nframes, nframes_t offset);
+ std::set<Evoral::Parameter> automatable() const;
+ std::string describe_parameter (Evoral::Parameter);
std::string state_node_name () const { return "audiounit"; }
void print_parameter (uint32_t, char*, uint32_t len) const;
-
+
bool parameter_is_audio (uint32_t) const;
bool parameter_is_control (uint32_t) const;
bool parameter_is_input (uint32_t) const;
bool parameter_is_output (uint32_t) const;
-
+
XMLNode& get_state();
- int set_state(const XMLNode& node);
-
+ int set_state(const XMLNode& node, int);
+
bool save_preset (std::string name);
bool load_preset (const std::string& preset_label);
- std::vector<std::string> get_presets ();
+ std::vector<PresetRecord> get_presets ();
std::string current_preset() const;
bool has_editor () const;
+
+ bool reconfigurable_io() const { return true; }
+ bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
+ bool configure_io (ChanCount in, ChanCount out);
+ bool requires_fixed_size_buffers() const;
- int32_t can_do (int32_t in, int32_t& out);
- ChanCount output_streams() const;
- ChanCount input_streams() const;
- int32_t configure_io (int32_t in, int32_t out);
+ void set_fixed_size_buffers (bool yn) {
+ _requires_fixed_size_buffers = yn;
+ }
boost::shared_ptr<CAAudioUnit> get_au () { return unit; }
boost::shared_ptr<CAComponent> get_comp () const { return comp; }
+
+ OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList* ioData);
- OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags,
- const AudioTimeStamp *inTimeStamp,
- UInt32 inBusNumber,
- UInt32 inNumberFrames,
- AudioBufferList* ioData);
- private:
- boost::shared_ptr<CAComponent> comp;
- boost::shared_ptr<CAAudioUnit> unit;
+ /* "host" callbacks */
+
+ OSStatus get_beat_and_tempo_callback (Float64* outCurrentBeat,
+ Float64* outCurrentTempo);
+
+ OSStatus get_musical_time_location_callback (UInt32* outDeltaSampleOffsetToNextBeat,
+ Float32* outTimeSig_Numerator,
+ UInt32* outTimeSig_Denominator,
+ Float64* outCurrentMeasureDownBeat);
- bool initialized;
- ChanCount input_channels;
- ChanCount output_channels;
+ OSStatus get_transport_state_callback (Boolean* outIsPlaying,
+ Boolean* outTransportStateChanged,
+ Float64* outCurrentSampleInTimeLine,
+ Boolean* outIsCycling,
+ Float64* outCycleStartBeat,
+ Float64* outCycleEndBeat);
+
+ static std::string maybe_fix_broken_au_id (const std::string&);
+
+ private:
+ boost::shared_ptr<CAComponent> comp;
+ boost::shared_ptr<CAAudioUnit> unit;
+
+ bool initialized;
+ int32_t input_channels;
+ int32_t output_channels;
std::vector<std::pair<int,int> > io_configs;
+ nframes_t _current_block_size;
+ nframes_t _last_nframes;
+ bool _requires_fixed_size_buffers;
AudioBufferList* buffers;
- /* XXX this should really be shared across all AUPlugin instances */
+ /* despite all the cool work that apple did on their AU preset
+ system, they left factory presets and user presets as two
+ entirely different kinds of things, handled by two entirely
+ different parts of the API. Resolve this.
+ */
- typedef std::map<std::string,std::string> PresetMap;
- PresetMap preset_map;
+ /* XXX these two maps should really be shared across all instances of this AUPlugin */
+
+ typedef std::map<std::string,std::string> UserPresetMap;
+ UserPresetMap user_preset_map;
+ typedef std::map<std::string,int> FactoryPresetMap;
+ FactoryPresetMap factory_preset_map;
UInt32 global_elements;
UInt32 output_elements;
UInt32 input_elements;
-
+
int set_output_format (AudioStreamBasicDescription&);
int set_input_format (AudioStreamBasicDescription&);
int set_stream_format (int scope, uint32_t cnt, AudioStreamBasicDescription&);
- int _set_block_size (nframes_t nframes);
void discover_parameters ();
std::vector<std::pair<uint32_t, uint32_t> > parameter_map;
uint32_t current_maxbuf;
- nframes_t current_offset;
- nframes_t cb_offset;
- std::vector<Sample*>* current_buffers;
- nframes_t frames_processed;
-
+ nframes_t current_offset;
+ nframes_t cb_offset;
+ BufferSet* current_buffers;
+ nframes_t frames_processed;
+
std::vector<AUParameterDescriptor> descriptors;
void init ();
-};
+ void discover_factory_presets ();
+
+ bool last_transport_rolling;
+ float last_transport_speed;
+};
+
typedef boost::shared_ptr<AUPlugin> AUPluginPtr;
-struct AUPluginCachedInfo {
+struct AUPluginCachedInfo {
std::vector<std::pair<int,int> > io_configs;
};
class AUPluginInfo : public PluginInfo {
- public:
- AUPluginInfo (boost::shared_ptr<CAComponentDescription>);
+ public:
+ AUPluginInfo (boost::shared_ptr<CAComponentDescription>);
~AUPluginInfo ();
PluginPtr load (Session& session);
@@ -175,19 +217,19 @@ class AUPluginInfo : public PluginInfo {
private:
boost::shared_ptr<CAComponentDescription> descriptor;
UInt32 version;
-
+
static void discover_music (PluginInfoList&);
static void discover_fx (PluginInfoList&);
static void discover_generators (PluginInfoList&);
static void discover_by_description (PluginInfoList&, CAComponentDescription&);
- static std::string au_cache_path ();
+ static Glib::ustring au_cache_path ();
typedef std::map<std::string,AUPluginCachedInfo> CachedInfoMap;
static CachedInfoMap cached_info;
-
+
static bool cached_io_configuration (const std::string&, UInt32, CAComponent&, AUPluginCachedInfo&, const std::string& name);
static void add_cached_info (const std::string&, AUPluginCachedInfo&);
- static void save_cached_info ();
+ static void save_cached_info ();
};
typedef boost::shared_ptr<AUPluginInfo> AUPluginInfoPtr;
diff --git a/libs/ardour/ardour/caimportable.h b/libs/ardour/ardour/caimportable.h
index 1fe94b8953..2e86ff2c90 100644
--- a/libs/ardour/ardour/caimportable.h
+++ b/libs/ardour/ardour/caimportable.h
@@ -35,10 +35,11 @@ class CAImportableSource : public ImportableSource {
nframes_t read (Sample* buffer, nframes_t nframes);
uint32_t channels() const;
- nframes_t length() const;
+ framecnt_t length() const;
nframes_t samplerate() const;
void seek (nframes_t pos);
framepos_t natural_position() const { return 0; }
+ bool clamped_at_unity () const { return false; }
protected:
mutable CAAudioFile af;
diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h
index c83b63934f..be28662cb0 100644
--- a/libs/ardour/ardour/coreaudiosource.h
+++ b/libs/ardour/ardour/coreaudiosource.h
@@ -41,19 +41,20 @@ class CoreAudioSource : public AudioFileSource {
int flush_header () {return 0;};
void set_header_timeline_position () {};
+ bool clamped_at_unity () const { return false; }
static int get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg);
protected:
- nframes_t read_unlocked (Sample *dst, framepos_t start, nframes_t cnt) const;
- nframes_t write_unlocked (Sample *dst, nframes_t cnt) { return 0; }
-
+ framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const;
+ framecnt_t write_unlocked (Sample *, framecnt_t) { return 0; }
+
private:
mutable CAAudioFile af;
uint16_t n_channels;
void init_cafile ();
- int safe_read (Sample*, nframes_t start, nframes_t cnt, AudioBufferList&) const;
+ int safe_read (Sample*, nframes_t start, framecnt_t cnt, AudioBufferList&) const;
};
}; /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index 4f9ce3e7ea..3d7c8d9c33 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -140,6 +140,8 @@ class Plugin : public PBD::StatefulDestructible, public Latent
virtual std::vector<PresetRecord> get_presets();
virtual std::string current_preset() const { return std::string(); }
+ static PBD::Signal0<bool> PresetFileExists;
+
const PresetRecord* preset_by_label(const std::string& label);
const PresetRecord* preset_by_uri(const std::string& uri);
@@ -169,7 +171,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent
virtual ChanCount output_streams() const;
virtual ChanCount input_streams() const;
- PluginInfoPtr get_info() { return _info; }
+ PluginInfoPtr get_info() const { return _info; }
void set_info (const PluginInfoPtr inf) { _info = inf; }
ARDOUR::AudioEngine& engine() const { return _engine; }
diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h
index 1eab554178..8c3145a28b 100644
--- a/libs/ardour/ardour/utils.h
+++ b/libs/ardour/ardour/utils.h
@@ -28,9 +28,9 @@
#include <string>
#include <cmath>
-#if defined(HAVE_COREAUDIO) || defined(HAVE_AUDIOUNITS)
+#if __APPLE__
#include <CoreFoundation/CoreFoundation.h>
-#endif
+#endif /* __APPLE__ */
bool string_is_affirmative (const std::string&);
@@ -107,9 +107,9 @@ float meter_falloff_to_db_per_sec (float);
const char* native_header_format_extension (ARDOUR::HeaderFormat, const ARDOUR::DataType& type);
bool matching_unsuffixed_filename_exists_in (const std::string& dir, const std::string& name);
-#if defined(HAVE_COREAUDIO) || defined(HAVE_AUDIOUNITS)
+#if __APPLE__
std::string CFStringRefToStdString(CFStringRef stringRef);
-#endif // HAVE_COREAUDIO
+#endif // __APPLE__
#endif /* __ardour_utils_h__ */
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 3eb4672160..19f7df3c34 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -1,5 +1,6 @@
/*
- Copyright (C) 2006 Paul Davis
+ Copyright (C) 2006-2009 Paul Davis
+ Some portions Copyright (C) Sophia Poirier.
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
@@ -20,11 +21,15 @@
#include <sstream>
#include <errno.h>
#include <string.h>
+#include <math.h>
+#include <ctype.h>
#include "pbd/transmitter.h"
#include "pbd/xml++.h"
+#include "pbd/convert.h"
#include "pbd/whitespace.h"
#include "pbd/pathscanner.h"
+#include "pbd/locale_guard.h"
#include <glibmm/thread.h>
#include <glibmm/fileutils.h>
@@ -32,16 +37,21 @@
#include "ardour/ardour.h"
#include "ardour/audioengine.h"
+#include "ardour/audio_buffer.h"
+#include "ardour/filesystem_paths.h"
#include "ardour/io.h"
#include "ardour/audio_unit.h"
#include "ardour/session.h"
+#include "ardour/tempo.h"
#include "ardour/utils.h"
-#include <appleutility/CAAudioUnit.h>
-#include <appleutility/CAAUParameter.h>
+#include "appleutility/CAAudioUnit.h"
+#include "appleutility/CAAUParameter.h"
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
+#include <AudioUnit/AudioUnit.h>
+#include <AudioToolbox/AudioUnitUtilities.h>
#include "i18n.h"
@@ -49,6 +59,13 @@ using namespace std;
using namespace PBD;
using namespace ARDOUR;
+//#define TRACE_AU_API
+#ifdef TRACE_AU_API
+#define TRACE_API(fmt,...) fprintf (stderr, fmt, ## __VA_ARGS__)
+#else
+#define TRACE_API(fmt,...)
+#endif
+
#ifndef AU_STATE_SUPPORT
static bool seen_get_state_message = false;
static bool seen_set_state_message = false;
@@ -61,8 +78,9 @@ AUPluginInfo::CachedInfoMap AUPluginInfo::cached_info;
static string preset_search_path = "/Library/Audio/Presets:/Network/Library/Audio/Presets";
static string preset_suffix = ".aupreset";
static bool preset_search_path_initialized = false;
+static bool debug_io_config = true;
-static OSStatus
+static OSStatus
_render_callback(void *userData,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
@@ -70,18 +88,67 @@ _render_callback(void *userData,
UInt32 inNumberFrames,
AudioBufferList* ioData)
{
- return ((AUPlugin*)userData)->render_callback (ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData);
+ if (userData) {
+ return ((AUPlugin*)userData)->render_callback (ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, ioData);
+ }
+ return paramErr;
}
-static int
-save_property_list (CFPropertyListRef propertyList, string path)
+static OSStatus
+_get_beat_and_tempo_callback (void* userData,
+ Float64* outCurrentBeat,
+ Float64* outCurrentTempo)
+{
+ if (userData) {
+ return ((AUPlugin*)userData)->get_beat_and_tempo_callback (outCurrentBeat, outCurrentTempo);
+ }
+
+ return paramErr;
+}
+
+static OSStatus
+_get_musical_time_location_callback (void * userData,
+ UInt32 * outDeltaSampleOffsetToNextBeat,
+ Float32 * outTimeSig_Numerator,
+ UInt32 * outTimeSig_Denominator,
+ Float64 * outCurrentMeasureDownBeat)
+{
+ if (userData) {
+ return ((AUPlugin*)userData)->get_musical_time_location_callback (outDeltaSampleOffsetToNextBeat,
+ outTimeSig_Numerator,
+ outTimeSig_Denominator,
+ outCurrentMeasureDownBeat);
+ }
+ return paramErr;
+}
+
+static OSStatus
+_get_transport_state_callback (void* userData,
+ Boolean* outIsPlaying,
+ Boolean* outTransportStateChanged,
+ Float64* outCurrentSampleInTimeLine,
+ Boolean* outIsCycling,
+ Float64* outCycleStartBeat,
+ Float64* outCycleEndBeat)
+{
+ if (userData) {
+ return ((AUPlugin*)userData)->get_transport_state_callback (outIsPlaying, outTransportStateChanged,
+ outCurrentSampleInTimeLine, outIsCycling,
+ outCycleStartBeat, outCycleEndBeat);
+ }
+ return paramErr;
+}
+
+
+static int
+save_property_list (CFPropertyListRef propertyList, Glib::ustring path)
{
CFDataRef xmlData;
int fd;
// Convert the property list into XML data.
-
+
xmlData = CFPropertyListCreateXMLData( kCFAllocatorDefault, propertyList);
if (!xmlData) {
@@ -110,7 +177,7 @@ save_property_list (CFPropertyListRef propertyList, string path)
size_t cnt = CFDataGetLength (xmlData);
- if (write (fd, CFDataGetBytePtr (xmlData), cnt) != cnt) {
+ if (write (fd, CFDataGetBytePtr (xmlData), cnt) != (ssize_t) cnt) {
CFRelease (xmlData);
close (fd);
return -1;
@@ -119,23 +186,23 @@ save_property_list (CFPropertyListRef propertyList, string path)
close (fd);
return 0;
}
+
-
-static CFPropertyListRef
-load_property_list (string path)
+static CFPropertyListRef
+load_property_list (Glib::ustring path)
{
int fd;
- CFPropertyListRef propertyList;
+ CFPropertyListRef propertyList = 0;
CFDataRef xmlData;
CFStringRef errorString;
// Read the XML file.
-
+
if ((fd = open (path.c_str(), O_RDONLY)) < 0) {
return propertyList;
}
-
+
off_t len = lseek (fd, 0, SEEK_END);
char* buf = new char[len];
lseek (fd, 0, SEEK_SET);
@@ -145,13 +212,13 @@ load_property_list (string path)
close (fd);
return propertyList;
}
-
+
close (fd);
xmlData = CFDataCreateWithBytesNoCopy (kCFAllocatorDefault, (UInt8*) buf, len, kCFAllocatorNull);
-
+
// Reconstitute the dictionary using the XML data.
-
+
propertyList = CFPropertyListCreateFromXMLData( kCFAllocatorDefault,
xmlData,
kCFPropertyListImmutable,
@@ -164,7 +231,7 @@ load_property_list (string path)
}
//-----------------------------------------------------------------------------
-static void
+static void
set_preset_name_in_plist (CFPropertyListRef plist, string preset_name)
{
if (!plist) {
@@ -175,7 +242,7 @@ set_preset_name_in_plist (CFPropertyListRef plist, string preset_name)
if (CFGetTypeID (plist) == CFDictionaryGetTypeID()) {
CFDictionarySetValue ((CFMutableDictionaryRef)plist, CFSTR(kAUPresetNameKey), pn);
}
-
+
CFRelease (pn);
}
@@ -199,7 +266,7 @@ get_preset_name_in_plist (CFPropertyListRef plist)
if (CFStringGetCString (str, local_buffer, len, kCFStringEncodingUTF8)) {
ret = local_buffer;
}
- }
+ }
}
return ret;
}
@@ -213,7 +280,7 @@ Boolean ComponentDescriptionsMatch_General(const ComponentDescription * inCompon
if ( (inComponentDescription1 == NULL) || (inComponentDescription2 == NULL) )
return FALSE;
- if ( (inComponentDescription1->componentSubType == inComponentDescription2->componentSubType)
+ if ( (inComponentDescription1->componentSubType == inComponentDescription2->componentSubType)
&& (inComponentDescription1->componentManufacturer == inComponentDescription2->componentManufacturer) )
{
// only sub-type and manufacturer IDs need to be equal
@@ -250,7 +317,7 @@ Boolean ComponentAndDescriptionMatch_General(Component inComponent, const Compon
//--------------------------------------------------------------------------
// determine if 2 ComponentDescriptions are basically equal
-// (by that, I mean that the important identifying values are compared,
+// (by that, I mean that the important identifying values are compared,
// but not the ComponentDescription flags)
Boolean ComponentDescriptionsMatch(const ComponentDescription * inComponentDescription1, const ComponentDescription * inComponentDescription2)
{
@@ -280,18 +347,22 @@ Boolean ComponentAndDescriptionMatch_Loosely(Component inComponent, const Compon
AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAComponent> _comp)
- : Plugin (engine, session),
- comp (_comp),
- unit (new CAAudioUnit),
- initialized (false),
- buffers (0),
- current_maxbuf (0),
- current_offset (0),
- current_buffers (0),
- frames_processed (0)
-{
+ : Plugin (engine, session)
+ , comp (_comp)
+ , unit (new CAAudioUnit)
+ , initialized (false)
+ , _current_block_size (0)
+ , _requires_fixed_size_buffers (false)
+ , buffers (0)
+ , current_maxbuf (0)
+ , current_offset (0)
+ , current_buffers (0)
+ , frames_processed (0)
+ , last_transport_rolling (false)
+ , last_transport_speed (0.0)
+{
if (!preset_search_path_initialized) {
- string p = Glib::get_home_dir();
+ Glib::ustring p = Glib::get_home_dir();
p += "/Library/Audio/Presets:";
p += preset_search_path;
preset_search_path = p;
@@ -306,12 +377,15 @@ AUPlugin::AUPlugin (const AUPlugin& other)
, comp (other.get_comp())
, unit (new CAAudioUnit)
, initialized (false)
+ , _current_block_size (0)
+ , _last_nframes (0)
+ , _requires_fixed_size_buffers (false)
, buffers (0)
, current_maxbuf (0)
, current_offset (0)
, current_buffers (0)
, frames_processed (0)
-
+
{
init ();
}
@@ -319,12 +393,43 @@ AUPlugin::AUPlugin (const AUPlugin& other)
AUPlugin::~AUPlugin ()
{
if (unit) {
+ TRACE_API ("about to call uninitialize in plugin destructor\n");
unit->Uninitialize ();
}
- free (buffers);
+ if (buffers) {
+ free (buffers);
+ }
}
+void
+AUPlugin::discover_factory_presets ()
+{
+ CFArrayRef presets;
+ UInt32 dataSize = sizeof (presets);
+ OSStatus err;
+
+ TRACE_API ("get property FactoryPresets in global scope\n");
+ if ((err = unit->GetProperty (kAudioUnitProperty_FactoryPresets, kAudioUnitScope_Global, 0, (void*) &presets, &dataSize)) != 0) {
+ cerr << "cannot get factory preset info: " << err << endl;
+ return;
+ }
+
+ if (!presets) {
+ return;
+ }
+
+ CFIndex cnt = CFArrayGetCount (presets);
+
+ for (CFIndex i = 0; i < cnt; ++i) {
+ AUPreset* preset = (AUPreset*) CFArrayGetValueAtIndex (presets, i);
+
+ string name = CFStringRefToStdString (preset->presetName);
+ factory_preset_map[name] = preset->presetNumber;
+ }
+
+ CFRelease (presets);
+}
void
AUPlugin::init ()
@@ -332,6 +437,7 @@ AUPlugin::init ()
OSErr err;
try {
+ TRACE_API ("opening AudioUnit\n");
err = CAAudioUnit::Open (*(comp.get()), *unit);
} catch (...) {
error << _("Exception thrown during AudioUnit plugin loading - plugin ignored") << endmsg;
@@ -342,45 +448,69 @@ AUPlugin::init ()
error << _("AudioUnit: Could not convert CAComponent to CAAudioUnit") << endmsg;
throw failed_constructor ();
}
-
- AURenderCallbackStruct renderCallbackInfo;
-
- renderCallbackInfo.inputProc = _render_callback;
- renderCallbackInfo.inputProcRefCon = this;
-
- if ((err = unit->SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
- 0, (void*) &renderCallbackInfo, sizeof(renderCallbackInfo))) != 0) {
- cerr << "cannot install render callback (err = " << err << ')' << endl;
- throw failed_constructor();
- }
-
+
+ TRACE_API ("count global elements\n");
unit->GetElementCount (kAudioUnitScope_Global, global_elements);
+ TRACE_API ("count input elements\n");
unit->GetElementCount (kAudioUnitScope_Input, input_elements);
+ TRACE_API ("count output elements\n");
unit->GetElementCount (kAudioUnitScope_Output, output_elements);
+ if (input_elements > 0) {
+ AURenderCallbackStruct renderCallbackInfo;
+
+ renderCallbackInfo.inputProc = _render_callback;
+ renderCallbackInfo.inputProcRefCon = this;
+
+ TRACE_API ("set render callback in input scope\n");
+ if ((err = unit->SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
+ 0, (void*) &renderCallbackInfo, sizeof(renderCallbackInfo))) != 0) {
+ cerr << "cannot install render callback (err = " << err << ')' << endl;
+ throw failed_constructor();
+ }
+ }
+
+ /* tell the plugin about tempo/meter/transport callbacks in case it wants them */
+
+ HostCallbackInfo info;
+ memset (&info, 0, sizeof (HostCallbackInfo));
+ info.hostUserData = this;
+ info.beatAndTempoProc = _get_beat_and_tempo_callback;
+ info.musicalTimeLocationProc = _get_musical_time_location_callback;
+ info.transportStateProc = _get_transport_state_callback;
+
+ //ignore result of this - don't care if the property isn't supported
+ TRACE_API ("set host callbacks in global scope\n");
+ unit->SetProperty (kAudioUnitProperty_HostCallbacks,
+ kAudioUnitScope_Global,
+ 0, //elementID
+ &info,
+ sizeof (HostCallbackInfo));
+
/* these keep track of *configured* channel set up,
not potential set ups.
*/
- input_channels = ChanCount::ZERO;
- output_channels = ChanCount::ZERO;
+ input_channels = -1;
+ output_channels = -1;
- if (_set_block_size (_session.get_block_size())) {
+ if (set_block_size (_session.get_block_size())) {
error << _("AUPlugin: cannot set processing block size") << endmsg;
throw failed_constructor();
}
discover_parameters ();
+ discover_factory_presets ();
- Plugin::setup_controls ();
+ // Plugin::setup_controls ();
}
void
AUPlugin::discover_parameters ()
{
/* discover writable parameters */
-
- AudioUnitScope scopes[] = {
+
+ AudioUnitScope scopes[] = {
kAudioUnitScope_Global,
kAudioUnitScope_Output,
kAudioUnitScope_Input
@@ -391,7 +521,7 @@ AUPlugin::discover_parameters ()
for (uint32_t i = 0; i < sizeof (scopes) / sizeof (scopes[0]); ++i) {
AUParamInfo param_info (unit->AU(), false, false, scopes[i]);
-
+
for (uint32_t i = 0; i < param_info.NumParams(); ++i) {
AUParameterDescriptor d;
@@ -466,14 +596,14 @@ AUPlugin::discover_parameters ()
d.upper = info.maxValue;
d.default_value = info.defaultValue;
- d.integer_step = (info.unit & kAudioUnitParameterUnit_Indexed);
- d.toggled = (info.unit & kAudioUnitParameterUnit_Boolean) ||
+ d.integer_step = (info.unit == kAudioUnitParameterUnit_Indexed);
+ d.toggled = (info.unit == kAudioUnitParameterUnit_Boolean) ||
(d.integer_step && ((d.upper - d.lower) == 1.0));
- d.sr_dependent = (info.unit & kAudioUnitParameterUnit_SampleFrames);
- d.automatable = !d.toggled &&
+ d.sr_dependent = (info.unit == kAudioUnitParameterUnit_SampleFrames);
+ d.automatable = !d.toggled &&
!(info.flags & kAudioUnitParameterFlag_NonRealTime) &&
(info.flags & kAudioUnitParameterFlag_IsWritable);
-
+
d.logarithmic = (info.flags & kAudioUnitParameterFlag_DisplayLogarithmic);
d.unit = info.unit;
@@ -489,6 +619,112 @@ AUPlugin::discover_parameters ()
}
+static unsigned int
+four_ints_to_four_byte_literal (unsigned char n[4])
+{
+ /* this is actually implementation dependent. sigh. this is what gcc
+ and quite a few others do.
+ */
+ return ((n[0] << 24) + (n[1] << 16) + (n[2] << 8) + n[3]);
+}
+
+std::string
+AUPlugin::maybe_fix_broken_au_id (const std::string& id)
+{
+ if (isdigit (id[0])) {
+ return id;
+ }
+
+ /* ID format is xxxx-xxxx-xxxx
+ where x maybe \xNN or a printable character.
+
+ Split at the '-' and and process each part into an integer.
+ Then put it back together.
+ */
+
+
+ unsigned char nascent[4];
+ const char* cstr = id.c_str();
+ const char* estr = cstr + id.size();
+ uint32_t n[3];
+ int in;
+ int next_int;
+ char short_buf[3];
+ stringstream s;
+
+ in = 0;
+ next_int = 0;
+ short_buf[2] = '\0';
+
+ while (*cstr && next_int < 4) {
+
+ if (*cstr == '\\') {
+
+ if (estr - cstr < 3) {
+
+ /* too close to the end for \xNN parsing: treat as literal characters */
+
+ cerr << "Parse " << cstr << " as a literal \\" << endl;
+ nascent[in] = *cstr;
+ ++cstr;
+ ++in;
+
+ } else {
+
+ if (cstr[1] == 'x' && isxdigit (cstr[2]) && isxdigit (cstr[3])) {
+
+ /* parse \xNN */
+
+ memcpy (short_buf, &cstr[2], 2);
+ nascent[in] = strtol (short_buf, NULL, 16);
+ cstr += 4;
+ ++in;
+
+ } else {
+
+ /* treat as literal characters */
+ cerr << "Parse " << cstr << " as a literal \\" << endl;
+ nascent[in] = *cstr;
+ ++cstr;
+ ++in;
+ }
+ }
+
+ } else {
+
+ nascent[in] = *cstr;
+ ++cstr;
+ ++in;
+ }
+
+ if (in && (in % 4 == 0)) {
+ /* nascent is ready */
+ n[next_int] = four_ints_to_four_byte_literal (nascent);
+ in = 0;
+ next_int++;
+
+ /* swallow space-hyphen-space */
+
+ if (next_int < 3) {
+ ++cstr;
+ ++cstr;
+ ++cstr;
+ }
+ }
+ }
+
+ if (next_int != 3) {
+ goto err;
+ }
+
+ s << n[0] << '-' << n[1] << '-' << n[2];
+
+ return s.str();
+
+ err:
+ return string();
+}
+
string
AUPlugin::unique_id () const
{
@@ -518,7 +754,7 @@ AUPlugin::default_value (uint32_t port)
}
nframes_t
-AUPlugin::latency () const
+AUPlugin::signal_latency () const
{
return unit->Latency() * _session.frame_rate();
}
@@ -528,7 +764,21 @@ AUPlugin::set_parameter (uint32_t which, float val)
{
if (which < descriptors.size()) {
const AUParameterDescriptor& d (descriptors[which]);
+ TRACE_API ("set parameter %d in scope %d element %d to %f\n", d.id, d.scope, d.element, val);
unit->SetParameter (d.id, d.scope, d.element, val);
+
+ /* tell the world what we did */
+
+ AudioUnitEvent theEvent;
+
+ theEvent.mEventType = kAudioUnitEvent_ParameterValueChange;
+ theEvent.mArgument.mParameter.mAudioUnit = unit->AU();
+ theEvent.mArgument.mParameter.mParameterID = d.id;
+ theEvent.mArgument.mParameter.mScope = d.scope;
+ theEvent.mArgument.mParameter.mElement = d.element;
+
+ TRACE_API ("notify about parameter change\n");
+ AUEventListenerNotify (NULL, NULL, &theEvent);
}
}
@@ -538,6 +788,7 @@ AUPlugin::get_parameter (uint32_t which) const
float val = 0.0;
if (which < descriptors.size()) {
const AUParameterDescriptor& d (descriptors[which]);
+ TRACE_API ("get value of parameter %d in scope %d element %d\n", d.id, d.scope, d.element);
unit->GetParameter(d.id, d.scope, d.element, val);
}
return val;
@@ -549,7 +800,7 @@ AUPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& pd) con
if (which < descriptors.size()) {
pd = descriptors[which];
return 0;
- }
+ }
return -1;
}
@@ -569,6 +820,7 @@ AUPlugin::activate ()
{
if (!initialized) {
OSErr err;
+ TRACE_API ("call Initialize in activate()\n");
if ((err = unit->Initialize()) != noErr) {
error << string_compose (_("AUPlugin: %1 cannot initialize plugin (err = %2)"), name(), err) << endmsg;
} else {
@@ -581,28 +833,38 @@ AUPlugin::activate ()
void
AUPlugin::deactivate ()
{
- unit->GlobalReset ();
+ TRACE_API ("call Uninitialize in deactivate()\n");
+ unit->Uninitialize ();
+ initialized = false;
}
void
-AUPlugin::set_block_size (nframes_t nframes)
+AUPlugin::flush ()
+{
+ TRACE_API ("call Reset in flush()\n");
+ unit->GlobalReset ();
+}
+
+bool
+AUPlugin::requires_fixed_size_buffers() const
{
- _set_block_size (nframes);
+ return _requires_fixed_size_buffers;
}
+
int
-AUPlugin::_set_block_size (nframes_t nframes)
+AUPlugin::set_block_size (nframes_t nframes)
{
bool was_initialized = initialized;
UInt32 numFrames = nframes;
OSErr err;
if (initialized) {
- unit->Uninitialize ();
- initialized = false;
+ deactivate ();
}
- if ((err = unit->SetProperty (kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global,
+ TRACE_API ("set MaximumFramesPerSlice in global scope to %u\n", numFrames);
+ if ((err = unit->SetProperty (kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global,
0, &numFrames, sizeof (numFrames))) != noErr) {
cerr << "cannot set max frames (err = " << err << ')' << endl;
return -1;
@@ -612,13 +874,27 @@ AUPlugin::_set_block_size (nframes_t nframes)
activate ();
}
+ _current_block_size = nframes;
+
return 0;
}
-int32_t
-AUPlugin::configure_io (int32_t in, int32_t out)
+bool
+AUPlugin::configure_io (ChanCount in, ChanCount out)
{
AudioStreamBasicDescription streamFormat;
+ bool was_initialized = initialized;
+ int32_t audio_in = in.n_audio();
+ int32_t audio_out = out.n_audio();
+
+ if (initialized) {
+ //if we are already running with the requested i/o config, bail out here
+ if ( (audio_in==input_channels) && (audio_out==output_channels) ) {
+ return 0;
+ } else {
+ deactivate ();
+ }
+ }
streamFormat.mSampleRate = _session.frame_rate();
streamFormat.mFormatID = kAudioFormatLinearPCM;
@@ -639,39 +915,70 @@ AUPlugin::configure_io (int32_t in, int32_t out)
streamFormat.mBytesPerPacket = 4;
streamFormat.mBytesPerFrame = 4;
- streamFormat.mChannelsPerFrame = in;
+ streamFormat.mChannelsPerFrame = audio_in;
if (set_input_format (streamFormat) != 0) {
return -1;
}
- streamFormat.mChannelsPerFrame = out;
+ streamFormat.mChannelsPerFrame = audio_out;
if (set_output_format (streamFormat) != 0) {
return -1;
}
- return Plugin::configure_io (in, out);
+ if (was_initialized) {
+ activate ();
+ }
+
+ return 0;
}
-int32_t
-AUPlugin::can_do (int32_t in, int32_t& out)
+bool
+AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
{
// XXX as of May 13th 2008, AU plugin support returns a count of either 1 or -1. We never
// attempt to multiply-instantiate plugins to meet io configurations.
+ int32_t audio_in = in.n_audio();
+ int32_t audio_out;
int32_t plugcnt = -1;
AUPluginInfoPtr pinfo = boost::dynamic_pointer_cast<AUPluginInfo>(get_info());
- out = -1;
-
vector<pair<int,int> >& io_configs = pinfo->cache.io_configs;
+ if (debug_io_config) {
+ cerr << name() << " has " << io_configs.size() << " IO Configurations\n";
+ }
+
+ //Ardour expects the plugin to tell it the output configuration
+ //but AU plugins can have multiple I/O configurations
+ //in most cases (since we don't allow special routing like sidechains in A2, we want to preserve the number of streams
+ //so first lets see if there's a configuration that keeps out==in
+
+ audio_out = audio_in;
+
+ for (vector<pair<int,int> >::iterator i = io_configs.begin(); i != io_configs.end(); ++i) {
+ int32_t possible_in = i->first;
+ int32_t possible_out = i->second;
+
+ if (possible_in == audio_in && possible_out== audio_out) {
+ cerr << "\tCHOSEN: in " << in << " out " << out << endl;
+ return 1;
+ }
+ }
+
+ /* now allow potentially "imprecise" matches */
+ audio_out = -1;
for (vector<pair<int,int> >::iterator i = io_configs.begin(); i != io_configs.end(); ++i) {
int32_t possible_in = i->first;
int32_t possible_out = i->second;
+ if (debug_io_config) {
+ cerr << "\tin " << possible_in << " out " << possible_out << endl;
+ }
+
if (possible_out == 0) {
warning << string_compose (_("AU %1 has zero outputs - configuration ignored"), name()) << endmsg;
continue;
@@ -684,51 +991,51 @@ AUPlugin::can_do (int32_t in, int32_t& out)
if (possible_out == -1) {
/* out much match in (UNLIKELY!!) */
- out = in;
+ audio_out = audio_in;
plugcnt = 1;
} else if (possible_out == -2) {
/* any configuration possible, pick matching */
- out = in;
+ audio_out = audio_in;
plugcnt = 1;
} else if (possible_out < -2) {
/* explicit variable number of outputs, pick maximum */
- out = -possible_out;
+ audio_out = -possible_out;
plugcnt = 1;
} else {
/* exact number of outputs */
- out = possible_out;
+ audio_out = possible_out;
plugcnt = 1;
}
}
-
+
if (possible_in == -1) {
/* wildcard for input */
if (possible_out == -1) {
/* out much match in */
- out = in;
+ audio_out = audio_in;
plugcnt = 1;
} else if (possible_out == -2) {
/* any configuration possible, pick matching */
- out = in;
+ audio_out = audio_in;
plugcnt = 1;
} else if (possible_out < -2) {
/* explicit variable number of outputs, pick maximum */
- out = -possible_out;
+ audio_out = -possible_out;
plugcnt = 1;
} else {
/* exact number of outputs */
- out = possible_out;
+ audio_out = possible_out;
plugcnt = 1;
}
- }
-
+ }
+
if (possible_in == -2) {
if (possible_out == -1) {
/* any configuration possible, pick matching */
- out = in;
+ audio_out = audio_in;
plugcnt = 1;
} else if (possible_out == -2) {
error << string_compose (_("AU plugin %1 has illegal IO configuration (-2,-2)"), name())
@@ -736,11 +1043,11 @@ AUPlugin::can_do (int32_t in, int32_t& out)
plugcnt = -1;
} else if (possible_out < -2) {
/* explicit variable number of outputs, pick maximum */
- out = -possible_out;
+ audio_out = -possible_out;
plugcnt = 1;
} else {
/* exact number of outputs */
- out = possible_out;
+ audio_out = possible_out;
plugcnt = 1;
}
}
@@ -749,14 +1056,14 @@ AUPlugin::can_do (int32_t in, int32_t& out)
/* explicit variable number of inputs */
- if (in > -possible_in) {
+ if (audio_in > -possible_in) {
/* request is too large */
plugcnt = -1;
}
if (possible_out == -1) {
/* out must match in */
- out = in;
+ audio_out = audio_in;
plugcnt = 1;
} else if (possible_out == -2) {
error << string_compose (_("AU plugin %1 has illegal IO configuration (-2,-2)"), name())
@@ -764,34 +1071,34 @@ AUPlugin::can_do (int32_t in, int32_t& out)
plugcnt = -1;
} else if (possible_out < -2) {
/* explicit variable number of outputs, pick maximum */
- out = -possible_out;
+ audio_out = -possible_out;
plugcnt = 1;
} else {
/* exact number of outputs */
- out = possible_out;
+ audio_out = possible_out;
plugcnt = 1;
}
}
- if (possible_in == in) {
+ if (possible_in == audio_in) {
/* exact number of inputs ... must match obviously */
-
+
if (possible_out == -1) {
/* out must match in */
- out = in;
+ audio_out = audio_in;
plugcnt = 1;
} else if (possible_out == -2) {
/* any output configuration, pick matching */
- out = in;
+ audio_out = audio_in;
plugcnt = -1;
} else if (possible_out < -2) {
/* explicit variable number of outputs, pick maximum */
- out = -possible_out;
+ audio_out = -possible_out;
plugcnt = 1;
} else {
/* exact number of outputs */
- out = possible_out;
+ audio_out = possible_out;
plugcnt = 1;
}
}
@@ -799,9 +1106,20 @@ AUPlugin::can_do (int32_t in, int32_t& out)
if (plugcnt == 1) {
break;
}
+
}
- /* no fit */
+ if (debug_io_config) {
+ if (plugcnt > 0) {
+ cerr << "\tCHOSEN: in " << in << " out " << out << " plugcnt will be " << plugcnt << endl;
+ } else {
+ cerr << "\tFAIL: no configs match requested in " << in << endl;
+ }
+ }
+
+ out.set (DataType::MIDI, 0);
+ out.set (DataType::AUDIO, audio_out);
+
return plugcnt;
}
@@ -822,12 +1140,12 @@ AUPlugin::set_output_format (AudioStreamBasicDescription& fmt)
free (buffers);
buffers = 0;
}
-
- buffers = (AudioBufferList *) malloc (offsetof(AudioBufferList, mBuffers) +
- fmt.mChannelsPerFrame * sizeof(AudioBuffer));
+
+ buffers = (AudioBufferList *) malloc (offsetof(AudioBufferList, mBuffers) +
+ fmt.mChannelsPerFrame * sizeof(::AudioBuffer));
Glib::Mutex::Lock em (_session.engine().process_lock());
- IO::MoreOutputs (fmt.mChannelsPerFrame);
+ IO::PortCountChanged (ChanCount(DataType::AUDIO, fmt.mChannelsPerFrame));
return 0;
}
@@ -838,6 +1156,9 @@ AUPlugin::set_stream_format (int scope, uint32_t cnt, AudioStreamBasicDescriptio
OSErr result;
for (uint32_t i = 0; i < cnt; ++i) {
+ TRACE_API ("set stream format for %s, scope = %d element %d\n",
+ (scope == kAudioUnitScope_Input ? "input" : "output"),
+ scope, cnt);
if ((result = unit->SetFormat (scope, i, fmt)) != 0) {
error << string_compose (_("AUPlugin: could not set stream format for %1/%2 (err = %3)"),
(scope == kAudioUnitScope_Input ? "input" : "output"), i, result) << endmsg;
@@ -846,39 +1167,18 @@ AUPlugin::set_stream_format (int scope, uint32_t cnt, AudioStreamBasicDescriptio
}
if (scope == kAudioUnitScope_Input) {
- input_channels.setAudio( fmt.mChannelsPerFrame );
+ input_channels = fmt.mChannelsPerFrame;
} else {
- output_channels.setAudio( fmt.mChannelsPerFrame );
+ output_channels = fmt.mChannelsPerFrame;
}
return 0;
}
-ChanCount
-AUPlugin::input_streams() const
-{
- if (input_channels < 0) {
- warning << string_compose (_("AUPlugin: %1 input_streams() called without any format set!"), name()) << endmsg;
- return 1;
- }
- return input_channels;
-}
-
-
-ChanCount
-AUPlugin::output_streams() const
-{
- if (output_channels < 0) {
- warning << string_compose (_("AUPlugin: %1 output_streams() called without any format set!"), name()) << endmsg;
- return 1;
- }
- return output_channels;
-}
-
-OSStatus
-AUPlugin::render_callback(AudioUnitRenderActionFlags *ioActionFlags,
- const AudioTimeStamp *inTimeStamp,
- UInt32 inBusNumber,
+OSStatus
+AUPlugin::render_callback(AudioUnitRenderActionFlags*,
+ const AudioTimeStamp*,
+ UInt32,
UInt32 inNumberFrames,
AudioBufferList* ioData)
{
@@ -888,11 +1188,18 @@ AUPlugin::render_callback(AudioUnitRenderActionFlags *ioActionFlags,
error << _("AUPlugin: render callback called illegally!") << endmsg;
return kAudioUnitErr_CannotDoInCurrentContext;
}
+ uint32_t limit = min ((uint32_t) ioData->mNumberBuffers, current_maxbuf);
- for (uint32_t i = 0; i < current_maxbuf; ++i) {
+ for (uint32_t i = 0; i < limit; ++i) {
ioData->mBuffers[i].mNumberChannels = 1;
ioData->mBuffers[i].mDataByteSize = sizeof (Sample) * inNumberFrames;
- ioData->mBuffers[i].mData = (*current_buffers)[i] + cb_offset + current_offset;
+
+ /* we don't use the channel mapping because audiounits are
+ never replicated. one plugin instance uses all channels/buffers
+ passed to PluginInsert::connect_and_run()
+ */
+
+ ioData->mBuffers[i].mData = current_buffers->get_audio (i).data (cb_offset + current_offset);
}
cb_offset += inNumberFrames;
@@ -901,19 +1208,26 @@ AUPlugin::render_callback(AudioUnitRenderActionFlags *ioActionFlags,
}
int
-AUPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset)
+AUPlugin::connect_and_run (BufferSet& bufs, ChanMapping, ChanMapping, nframes_t nframes, nframes_t offset)
{
AudioUnitRenderActionFlags flags = 0;
AudioTimeStamp ts;
+ OSErr err;
+ uint32_t maxbuf = bufs.count().n_audio();
+
+ if (requires_fixed_size_buffers() && (nframes != _last_nframes)) {
+ unit->GlobalReset();
+ _last_nframes = nframes;
+ }
current_buffers = &bufs;
current_maxbuf = maxbuf;
current_offset = offset;
cb_offset = 0;
- buffers->mNumberBuffers = maxbuf;
+ buffers->mNumberBuffers = min ((uint32_t) output_channels, maxbuf);
- for (uint32_t i = 0; i < maxbuf; ++i) {
+ for (uint32_t i = 0; i < buffers->mNumberBuffers; ++i) {
buffers->mBuffers[i].mNumberChannels = 1;
buffers->mBuffers[i].mDataByteSize = nframes * sizeof (Sample);
buffers->mBuffers[i].mData = 0;
@@ -922,30 +1236,229 @@ AUPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in,
ts.mSampleTime = frames_processed;
ts.mFlags = kAudioTimeStampSampleTimeValid;
- if (unit->Render (&flags, &ts, 0, nframes, buffers) == noErr) {
+ if ((err = unit->Render (&flags, &ts, 0, nframes, buffers)) == noErr) {
current_maxbuf = 0;
frames_processed += nframes;
-
- for (uint32_t i = 0; i < maxbuf; ++i) {
- if (bufs[i] + offset != buffers->mBuffers[i].mData) {
- memcpy (bufs[i]+offset, buffers->mBuffers[i].mData, nframes * sizeof (Sample));
+
+ uint32_t limit = min ((uint32_t) buffers->mNumberBuffers, maxbuf);
+ uint32_t i;
+
+ for (i = 0; i < limit; ++i) {
+ Sample* expected_buffer_address= bufs.get_audio (i).data (offset);
+ if (expected_buffer_address != buffers->mBuffers[i].mData) {
+ // cerr << "chn " << i << " rendered into " << bufs[i]+offset << endl;
+ memcpy (expected_buffer_address, buffers->mBuffers[i].mData, nframes * sizeof (Sample));
}
}
+
+ /* now silence any buffers that were passed in but the that the plugin
+ did not fill/touch/use.
+ */
+
+ for (;i < maxbuf; ++i) {
+ Sample* buffer_address= bufs.get_audio (i).data (offset);
+ memset (buffer_address, 0, nframes * sizeof (Sample));
+ }
+
return 0;
- }
+ }
+ cerr << name() << " render status " << err << endl;
return -1;
}
-set<uint32_t>
+OSStatus
+AUPlugin::get_beat_and_tempo_callback (Float64* outCurrentBeat,
+ Float64* outCurrentTempo)
+{
+ TempoMap& tmap (_session.tempo_map());
+
+ TRACE_API ("AU calls ardour beat&tempo callback\n");
+
+ /* more than 1 meter or more than 1 tempo means that a simplistic computation
+ (and interpretation) of a beat position will be incorrect. So refuse to
+ offer the value.
+ */
+
+ if (tmap.n_tempos() > 1 || tmap.n_meters() > 1) {
+ return kAudioUnitErr_CannotDoInCurrentContext;
+ }
+
+ BBT_Time bbt;
+ TempoMetric metric = tmap.metric_at (_session.transport_frame() + current_offset);
+ tmap.bbt_time_with_metric (_session.transport_frame() + current_offset, bbt, metric);
+
+ if (outCurrentBeat) {
+ float beat;
+ beat = metric.meter().beats_per_bar() * bbt.bars;
+ beat += bbt.beats;
+ beat += bbt.ticks / Meter::ticks_per_beat;
+ *outCurrentBeat = beat;
+ }
+
+ if (outCurrentTempo) {
+ *outCurrentTempo = floor (metric.tempo().beats_per_minute());
+ }
+
+ return noErr;
+
+}
+
+OSStatus
+AUPlugin::get_musical_time_location_callback (UInt32* outDeltaSampleOffsetToNextBeat,
+ Float32* outTimeSig_Numerator,
+ UInt32* outTimeSig_Denominator,
+ Float64* outCurrentMeasureDownBeat)
+{
+ TempoMap& tmap (_session.tempo_map());
+
+ TRACE_API ("AU calls ardour music time location callback\n");
+
+ /* more than 1 meter or more than 1 tempo means that a simplistic computation
+ (and interpretation) of a beat position will be incorrect. So refuse to
+ offer the value.
+ */
+
+ if (tmap.n_tempos() > 1 || tmap.n_meters() > 1) {
+ return kAudioUnitErr_CannotDoInCurrentContext;
+ }
+
+ BBT_Time bbt;
+ TempoMetric metric = tmap.metric_at (_session.transport_frame() + current_offset);
+ tmap.bbt_time_with_metric (_session.transport_frame() + current_offset, bbt, metric);
+
+ if (outDeltaSampleOffsetToNextBeat) {
+ if (bbt.ticks == 0) {
+ /* on the beat */
+ *outDeltaSampleOffsetToNextBeat = 0;
+ } else {
+ *outDeltaSampleOffsetToNextBeat = (UInt32) floor (((Meter::ticks_per_beat - bbt.ticks)/Meter::ticks_per_beat) * // fraction of a beat to next beat
+ metric.tempo().frames_per_beat(_session.frame_rate(), metric.meter())); // frames per beat
+ }
+ }
+
+ if (outTimeSig_Numerator) {
+ *outTimeSig_Numerator = (UInt32) lrintf (metric.meter().beats_per_bar());
+ }
+ if (outTimeSig_Denominator) {
+ *outTimeSig_Denominator = (UInt32) lrintf (metric.meter().note_divisor());
+ }
+
+ if (outCurrentMeasureDownBeat) {
+
+ /* beat for the start of the bar.
+ 1|1|0 -> 1
+ 2|1|0 -> 1 + beats_per_bar
+ 3|1|0 -> 1 + (2 * beats_per_bar)
+ etc.
+ */
+
+ *outCurrentMeasureDownBeat = 1 + metric.meter().beats_per_bar() * (bbt.bars - 1);
+ }
+
+ return noErr;
+}
+
+OSStatus
+AUPlugin::get_transport_state_callback (Boolean* outIsPlaying,
+ Boolean* outTransportStateChanged,
+ Float64* outCurrentSampleInTimeLine,
+ Boolean* outIsCycling,
+ Float64* outCycleStartBeat,
+ Float64* outCycleEndBeat)
+{
+ bool rolling;
+ float speed;
+
+ TRACE_API ("AU calls ardour transport state callback\n");
+
+ rolling = _session.transport_rolling();
+ speed = _session.transport_speed ();
+
+ if (outIsPlaying) {
+ *outIsPlaying = _session.transport_rolling();
+ }
+
+ if (outTransportStateChanged) {
+ if (rolling != last_transport_rolling) {
+ *outTransportStateChanged = true;
+ } else if (speed != last_transport_speed) {
+ *outTransportStateChanged = true;
+ } else {
+ *outTransportStateChanged = false;
+ }
+ }
+
+ if (outCurrentSampleInTimeLine) {
+ /* this assumes that the AU can only call this host callback from render context,
+ where current_offset is valid.
+ */
+ *outCurrentSampleInTimeLine = _session.transport_frame() + current_offset;
+ }
+
+ if (outIsCycling) {
+ Location* loc = _session.locations()->auto_loop_location();
+
+ *outIsCycling = (loc && _session.transport_rolling() && _session.get_play_loop());
+
+ if (*outIsCycling) {
+
+ if (outCycleStartBeat || outCycleEndBeat) {
+
+ TempoMap& tmap (_session.tempo_map());
+
+ /* more than 1 meter means that a simplistic computation (and interpretation) of
+ a beat position will be incorrect. so refuse to offer the value.
+ */
+
+ if (tmap.n_meters() > 1) {
+ return kAudioUnitErr_CannotDoInCurrentContext;
+ }
+
+ BBT_Time bbt;
+
+ if (outCycleStartBeat) {
+ TempoMetric metric = tmap.metric_at (loc->start() + current_offset);
+ _session.tempo_map().bbt_time_with_metric (loc->start(), bbt, metric);
+
+ float beat;
+ beat = metric.meter().beats_per_bar() * bbt.bars;
+ beat += bbt.beats;
+ beat += bbt.ticks / Meter::ticks_per_beat;
+
+ *outCycleStartBeat = beat;
+ }
+
+ if (outCycleEndBeat) {
+ TempoMetric metric = tmap.metric_at (loc->end() + current_offset);
+ _session.tempo_map().bbt_time_with_metric (loc->end(), bbt, metric);
+
+ float beat;
+ beat = metric.meter().beats_per_bar() * bbt.bars;
+ beat += bbt.beats;
+ beat += bbt.ticks / Meter::ticks_per_beat;
+
+ *outCycleEndBeat = beat;
+ }
+ }
+ }
+ }
+
+ last_transport_rolling = rolling;
+ last_transport_speed = speed;
+
+ return noErr;
+}
+
+set<Evoral::Parameter>
AUPlugin::automatable() const
{
- set<uint32_t> automates;
+ set<Evoral::Parameter> automates;
for (uint32_t i = 0; i < descriptors.size(); ++i) {
if (descriptors[i].automatable) {
- automates.insert (i);
+ automates.insert (automates.end(), Evoral::Parameter (PluginAutomation, 0, i));
}
}
@@ -953,13 +1466,17 @@ AUPlugin::automatable() const
}
string
-AUPlugin::describe_parameter (uint32_t param)
+AUPlugin::describe_parameter (Evoral::Parameter param)
{
- return descriptors[param].label;
+ if (param.type() == PluginAutomation && param.id() < parameter_count()) {
+ return descriptors[param.id()].label;
+ } else {
+ return "??";
+ }
}
void
-AUPlugin::print_parameter (uint32_t param, char* buf, uint32_t len) const
+AUPlugin::print_parameter (uint32_t /*param*/, char* /*buf*/, uint32_t /*len*/) const
{
// NameValue stuff here
}
@@ -998,12 +1515,13 @@ AUPlugin::get_state()
CFDataRef xmlData;
CFPropertyListRef propertyList;
+ TRACE_API ("get preset state\n");
if (unit->GetAUPreset (propertyList) != noErr) {
return *root;
}
// Convert the property list into XML data.
-
+
xmlData = CFPropertyListCreateXMLData( kCFAllocatorDefault, propertyList);
if (!xmlData) {
@@ -1027,17 +1545,18 @@ AUPlugin::get_state()
CFRelease (propertyList);
#else
if (!seen_get_state_message) {
- info << string_compose (_("Saving AudioUnit settings is not supported in this build of %1. Consider paying for a newer version"), PROGRAM_NAME)
+ info << string_compose (_("Saving AudioUnit settings is not supported in this build of %1. Consider paying for a newer version"),
+ PROGRAM_NAME)
<< endmsg;
seen_get_state_message = true;
}
#endif
-
+
return *root;
}
int
-AUPlugin::set_state(const XMLNode& node)
+AUPlugin::set_state(const XMLNode& node, int /* version*/)
{
#ifdef AU_STATE_SUPPORT
int ret = -1;
@@ -1048,7 +1567,7 @@ AUPlugin::set_state(const XMLNode& node)
error << _("Bad node sent to AUPlugin::set_state") << endmsg;
return -1;
}
-
+
if (node.children().empty()) {
return -1;
}
@@ -1069,18 +1588,27 @@ AUPlugin::set_state(const XMLNode& node)
&errorString);
CFRelease (xmlData);
-
+
if (propertyList) {
+ TRACE_API ("set preset\n");
if (unit->SetAUPreset (propertyList) == noErr) {
ret = 0;
- }
+
+ /* tell the world */
+
+ AudioUnitParameter changedUnit;
+ changedUnit.mAudioUnit = unit->AU();
+ changedUnit.mParameterID = kAUParameterListener_AnyParameter;
+ AUParameterListenerNotify (NULL, NULL, &changedUnit);
+ }
CFRelease (propertyList);
}
-
+
return ret;
#else
if (!seen_set_state_message) {
- info << string_compose (_("Restoring AudioUnit settings is not supported in this build of %1. Consider paying for a newer version", PROGRAM_NAME)
+ info << string_compose (_("Restoring AudioUnit settings is not supported in this build of %1. Consider paying for a newer version"),
+ PROGRAM_NAME)
<< endmsg;
}
return 0;
@@ -1093,24 +1621,55 @@ AUPlugin::load_preset (const string& preset_label)
#ifdef AU_STATE_SUPPORT
bool ret = false;
CFPropertyListRef propertyList;
- string path;
- PresetMap::iterator x = preset_map.find (preset_label);
+ Glib::ustring path;
+ UserPresetMap::iterator ux;
+ FactoryPresetMap::iterator fx;
+
+ /* look first in "user" presets */
+
+ if ((ux = user_preset_map.find (preset_label)) != user_preset_map.end()) {
+
+ if ((propertyList = load_property_list (ux->second)) != 0) {
+ TRACE_API ("set preset from user presets\n");
+ if (unit->SetAUPreset (propertyList) == noErr) {
+ ret = true;
+
+ /* tell the world */
+
+ AudioUnitParameter changedUnit;
+ changedUnit.mAudioUnit = unit->AU();
+ changedUnit.mParameterID = kAUParameterListener_AnyParameter;
+ AUParameterListenerNotify (NULL, NULL, &changedUnit);
+ }
+ CFRelease(propertyList);
+ }
- if (x == preset_map.end()) {
- return false;
- }
+ } else if ((fx = factory_preset_map.find (preset_label)) != factory_preset_map.end()) {
+
+ AUPreset preset;
+
+ preset.presetNumber = fx->second;
+ preset.presetName = CFStringCreateWithCString (kCFAllocatorDefault, fx->first.c_str(), kCFStringEncodingUTF8);
+
+ TRACE_API ("set preset from factory presets\n");
- if ((propertyList = load_property_list (x->second)) != 0) {
- if (unit->SetAUPreset (propertyList) == noErr) {
+ if (unit->SetPresentPreset (preset) == 0) {
ret = true;
+
+ /* tell the world */
+
+ AudioUnitParameter changedUnit;
+ changedUnit.mAudioUnit = unit->AU();
+ changedUnit.mParameterID = kAUParameterListener_AnyParameter;
+ AUParameterListenerNotify (NULL, NULL, &changedUnit);
}
- CFRelease(propertyList);
}
-
+
return ret;
#else
if (!seen_loading_message) {
- info << string_compose (_("Loading AudioUnit presets is not supported in this build of %1. Consider paying for a newer version", PROGRAM_NAME)
+ info << string_compose (_("Loading AudioUnit presets is not supported in this build of %1. Consider paying for a newer version"),
+ PROGRAM_NAME)
<< endmsg;
seen_loading_message = true;
}
@@ -1123,13 +1682,13 @@ AUPlugin::save_preset (string preset_name)
{
#ifdef AU_STATE_SUPPORT
CFPropertyListRef propertyList;
- vector<string> v;
- string user_preset_path;
+ vector<Glib::ustring> v;
+ Glib::ustring user_preset_path;
bool ret = true;
std::string m = maker();
std::string n = name();
-
+
strip_whitespace_edges (m);
strip_whitespace_edges (n);
@@ -1139,7 +1698,7 @@ AUPlugin::save_preset (string preset_name)
v.push_back ("Presets");
v.push_back (m);
v.push_back (n);
-
+
user_preset_path = Glib::build_filename (v);
if (g_mkdir_with_parents (user_preset_path.c_str(), 0775) < 0) {
@@ -1147,6 +1706,7 @@ AUPlugin::save_preset (string preset_name)
return false;
}
+ TRACE_API ("get current preset\n");
if (unit->GetAUPreset (propertyList) != noErr) {
return false;
}
@@ -1154,11 +1714,11 @@ AUPlugin::save_preset (string preset_name)
// add the actual preset name */
v.push_back (preset_name + preset_suffix);
-
+
// rebuild
user_preset_path = Glib::build_filename (v);
-
+
set_preset_name_in_plist (propertyList, preset_name);
if (save_property_list (propertyList, user_preset_path)) {
@@ -1171,7 +1731,8 @@ AUPlugin::save_preset (string preset_name)
return ret;
#else
if (!seen_saving_message) {
- info << string_compose (_("Saving AudioUnit presets is not supported in this build of %1. Consider paying for a newer version"), PROGRAM_NAME)
+ info << string_compose (_("Saving AudioUnit presets is not supported in this build of %1. Consider paying for a newer version"),
+ PROGRAM_NAME)
<< endmsg;
seen_saving_message = true;
}
@@ -1181,7 +1742,7 @@ AUPlugin::save_preset (string preset_name)
//-----------------------------------------------------------------------------
// this is just a little helper function used by GetAUComponentDescriptionFromPresetFile()
-static SInt32
+static SInt32
GetDictionarySInt32Value(CFDictionaryRef inAUStateDictionary, CFStringRef inDictionaryKey, Boolean * outSuccess)
{
CFNumberRef cfNumber;
@@ -1209,17 +1770,17 @@ GetDictionarySInt32Value(CFDictionaryRef inAUStateDictionary, CFStringRef inDict
return 0;
}
-static OSStatus
+static OSStatus
GetAUComponentDescriptionFromStateData(CFPropertyListRef inAUStateData, ComponentDescription * outComponentDescription)
{
CFDictionaryRef auStateDictionary;
- ComponentDescription tempDesc = {0};
+ ComponentDescription tempDesc = {0,0,0,0,0};
SInt32 versionValue;
Boolean gotValue;
if ( (inAUStateData == NULL) || (outComponentDescription == NULL) )
return paramErr;
-
+
// the property list for AU state data must be of the dictionary type
if (CFGetTypeID(inAUStateData) != CFDictionaryGetTypeID()) {
return kAudioUnitErr_InvalidPropertyValue;
@@ -1257,7 +1818,7 @@ static bool au_preset_filter (const string& str, void* arg)
/* Not a dotfile, has a prefix before a period, suffix is aupreset */
bool ret;
-
+
ret = (str[0] != '.' && str.length() > 9 && str.find (preset_suffix) == (str.length() - preset_suffix.length()));
if (ret && arg) {
@@ -1282,32 +1843,32 @@ static bool au_preset_filter (const string& str, void* arg)
match = m;
match += '/';
match += n;
-
+
ret = str.find (match) != string::npos;
}
}
-
+
return ret;
}
-bool
+bool
check_and_get_preset_name (Component component, const string& pathstr, string& preset_name)
{
OSStatus status;
CFPropertyListRef plist;
ComponentDescription presetDesc;
bool ret = false;
-
+
plist = load_property_list (pathstr);
if (!plist) {
return ret;
}
-
+
// get the ComponentDescription from the AU preset file
-
+
status = GetAUComponentDescriptionFromStateData(plist, &presetDesc);
-
+
if (status == noErr) {
if (ComponentAndDescriptionMatch_Loosely(component, &presetDesc)) {
@@ -1330,7 +1891,7 @@ check_and_get_preset_name (Component component, const string& pathstr, string& p
}
}
}
- }
+ }
}
CFRelease (plist);
@@ -1342,10 +1903,11 @@ std::string
AUPlugin::current_preset() const
{
string preset_name;
-
+
#ifdef AU_STATE_SUPPORT
CFPropertyListRef propertyList;
+ TRACE_API ("get current preset for current_preset()\n");
if (unit->GetAUPreset (propertyList) == noErr) {
preset_name = get_preset_name_in_plist (propertyList);
CFRelease(propertyList);
@@ -1354,15 +1916,19 @@ AUPlugin::current_preset() const
return preset_name;
}
-vector<string>
+vector<Plugin::PresetRecord>
AUPlugin::get_presets ()
{
+ vector<Plugin::PresetRecord> presets;
+
+#ifdef AU_STATE_SUPPORT
vector<string*>* preset_files;
- vector<string> presets;
PathScanner scanner;
- preset_files = scanner (preset_search_path, au_preset_filter, this, true, true, -1, true);
+ user_preset_map.clear ();
+ preset_files = scanner (preset_search_path, au_preset_filter, this, true, true, -1, true);
+
if (!preset_files) {
return presets;
}
@@ -1383,15 +1949,28 @@ AUPlugin::get_presets ()
*/
if (check_and_get_preset_name (get_comp()->Comp(), path, preset_name)) {
- presets.push_back (preset_name);
- preset_map[preset_name] = path;
- }
+ user_preset_map[preset_name] = path;
+ }
delete *x;
}
delete preset_files;
+ /* now fill the vector<string> with the names we have */
+
+ for (UserPresetMap::iterator i = user_preset_map.begin(); i != user_preset_map.end(); ++i) {
+ presets.push_back (Plugin::PresetRecord (i->second, i->first));
+ }
+
+ /* add factory presets */
+
+ for (FactoryPresetMap::iterator i = factory_preset_map.begin(); i != factory_preset_map.end(); ++i) {
+ presets.push_back (Plugin::PresetRecord ("", i->first));
+ }
+
+#endif
+
return presets;
}
@@ -1406,11 +1985,12 @@ AUPlugin::has_editor () const
AUPluginInfo::AUPluginInfo (boost::shared_ptr<CAComponentDescription> d)
: descriptor (d)
{
-
+ type = ARDOUR::AudioUnit;
}
AUPluginInfo::~AUPluginInfo ()
{
+ type = ARDOUR::AudioUnit;
}
PluginPtr
@@ -1419,15 +1999,18 @@ AUPluginInfo::load (Session& session)
try {
PluginPtr plugin;
+ TRACE_API ("load AU as a component\n");
boost::shared_ptr<CAComponent> comp (new CAComponent(*descriptor));
-
+
if (!comp->IsValid()) {
error << ("AudioUnit: not a valid Component") << endmsg;
} else {
plugin.reset (new AUPlugin (session.engine(), session, comp));
}
-
- plugin->set_info (PluginInfoPtr (new AUPluginInfo (*this)));
+
+ AUPluginInfo *aup = new AUPluginInfo (*this);
+ plugin->set_info (PluginInfoPtr (aup));
+ boost::dynamic_pointer_cast<AUPlugin> (plugin)->set_fixed_size_buffers (aup->creator == "Universal Audio");
return plugin;
}
@@ -1436,10 +2019,10 @@ AUPluginInfo::load (Session& session)
}
}
-string
+Glib::ustring
AUPluginInfo::au_cache_path ()
{
- return Glib::build_filename (ARDOUR::get_user_ardour_path(), "au_cache");
+ return Glib::build_filename (ARDOUR::user_config_directory().to_string(), "au_cache");
}
PluginInfoList*
@@ -1451,11 +2034,11 @@ AUPluginInfo::discover ()
ARDOUR::BootMessage (_("Discovering AudioUnit plugins (could take some time ...)"));
}
- PluginInfoList* plugs = new PluginInfoList ();
-
- discover_fx (plugs);
- discover_music (plugs);
- discover_generators (plugs);
+ PluginInfoList* plugs = new PluginInfoList;
+
+ discover_fx (*plugs);
+ discover_music (*plugs);
+ discover_generators (*plugs);
return plugs;
}
@@ -1510,10 +2093,16 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
CAComponentDescription temp;
GetComponentInfo (comp, &temp, NULL, NULL, NULL);
- AUPluginInfoPtr info (new AUPluginInfo
+ AUPluginInfoPtr info (new AUPluginInfo
(boost::shared_ptr<CAComponentDescription> (new CAComponentDescription(temp))));
- /* no panners, format converters or i/o AU's for our purposes
+ /* although apple designed the subtype field to be a "category" indicator,
+ its really turned into a plugin ID field for a given manufacturer. Hence
+ there are no categories for AudioUnits. However, to keep the plugins
+ showing up under "categories", we'll use the "type" as a high level
+ selector.
+
+ NOTE: no panners, format converters or i/o AU's for our purposes
*/
switch (info->descriptor->Type()) {
@@ -1521,121 +2110,32 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
case kAudioUnitType_OfflineEffect:
case kAudioUnitType_FormatConverter:
continue;
+
case kAudioUnitType_Output:
+ info->category = _("AudioUnit Outputs");
+ break;
case kAudioUnitType_MusicDevice:
+ info->category = _("AudioUnit Instruments");
+ break;
case kAudioUnitType_MusicEffect:
+ info->category = _("AudioUnit MusicEffects");
+ break;
case kAudioUnitType_Effect:
+ info->category = _("AudioUnit Effects");
+ break;
case kAudioUnitType_Mixer:
+ info->category = _("AudioUnit Mixers");
+ break;
case kAudioUnitType_Generator:
+ info->category = _("AudioUnit Generators");
break;
default:
+ info->category = _("AudioUnit (Unknown)");
break;
}
- switch (info->descriptor->SubType()) {
- case kAudioUnitSubType_DefaultOutput:
- case kAudioUnitSubType_SystemOutput:
- case kAudioUnitSubType_GenericOutput:
- case kAudioUnitSubType_AUConverter:
- /* we don't want output units here */
- continue;
- break;
-
- case kAudioUnitSubType_DLSSynth:
- info->category = "DLS Synth";
- break;
-
- case kAudioUnitSubType_Varispeed:
- info->category = "Varispeed";
- break;
-
- case kAudioUnitSubType_Delay:
- info->category = "Delay";
- break;
-
- case kAudioUnitSubType_LowPassFilter:
- info->category = "Low-pass Filter";
- break;
-
- case kAudioUnitSubType_HighPassFilter:
- info->category = "High-pass Filter";
- break;
-
- case kAudioUnitSubType_BandPassFilter:
- info->category = "Band-pass Filter";
- break;
-
- case kAudioUnitSubType_HighShelfFilter:
- info->category = "High-shelf Filter";
- break;
-
- case kAudioUnitSubType_LowShelfFilter:
- info->category = "Low-shelf Filter";
- break;
-
- case kAudioUnitSubType_ParametricEQ:
- info->category = "Parametric EQ";
- break;
-
- case kAudioUnitSubType_GraphicEQ:
- info->category = "Graphic EQ";
- break;
-
- case kAudioUnitSubType_PeakLimiter:
- info->category = "Peak Limiter";
- break;
-
- case kAudioUnitSubType_DynamicsProcessor:
- info->category = "Dynamics Processor";
- break;
-
- case kAudioUnitSubType_MultiBandCompressor:
- info->category = "Multiband Compressor";
- break;
-
- case kAudioUnitSubType_MatrixReverb:
- info->category = "Matrix Reverb";
- break;
-
- case kAudioUnitSubType_SampleDelay:
- info->category = "Sample Delay";
- break;
-
- case kAudioUnitSubType_Pitch:
- info->category = "Pitch";
- break;
-
- case kAudioUnitSubType_NetSend:
- info->category = "Net Sender";
- break;
-
- case kAudioUnitSubType_3DMixer:
- info->category = "3DMixer";
- break;
-
- case kAudioUnitSubType_MatrixMixer:
- info->category = "MatrixMixer";
- break;
-
- case kAudioUnitSubType_ScheduledSoundPlayer:
- info->category = "Scheduled Sound Player";
- break;
-
-
- case kAudioUnitSubType_AudioFilePlayer:
- info->category = "Audio File Player";
- break;
-
- case kAudioUnitSubType_NetReceive:
- info->category = "Net Receiver";
- break;
-
- default:
- info->category = "";
- }
-
AUPluginInfo::get_names (temp, info->name, info->creator);
-
+
info->type = ARDOUR::AudioUnit;
info->unique_id = stringify_descriptor (*info->descriptor);
@@ -1647,7 +2147,7 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
if (cacomp.GetResourceVersion (info->version) != noErr) {
info->version = 0;
}
-
+
if (cached_io_configuration (info->unique_id, info->version, cacomp, info->cache, info->name)) {
/* here we have to map apple's wildcard system to a simple pair
@@ -1656,28 +2156,26 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
remove any use of these values.
*/
- info->n_inputs = info->cache.io_configs.front().first;
- info->n_outputs = info->cache.io_configs.front().second;
+ info->n_inputs.set (DataType::AUDIO, info->cache.io_configs.front().first);
+ info->n_outputs.set (DataType::AUDIO, info->cache.io_configs.front().second);
- if (info->cache.io_configs.size() > 1) {
- cerr << "ODD: variable IO config for " << info->unique_id << endl;
- }
+ cerr << "detected AU: " << info->name.c_str() << " (" << info->cache.io_configs.size() << " i/o configurations) - " << info->unique_id << endl;
plugs.push_back (info);
} else {
error << string_compose (_("Cannot get I/O configuration info for AU %1"), info->name) << endmsg;
}
-
+
comp = FindNextComponent (comp, &desc);
}
}
bool
-AUPluginInfo::cached_io_configuration (const std::string& unique_id,
+AUPluginInfo::cached_io_configuration (const std::string& unique_id,
UInt32 version,
- CAComponent& comp,
- AUPluginCachedInfo& cinfo,
+ CAComponent& comp,
+ AUPluginCachedInfo& cinfo,
const std::string& name)
{
std::string id;
@@ -1688,7 +2186,7 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id,
follow Apple "guidelines".
*/
- snprintf (buf, sizeof (buf), "%u", version);
+ snprintf (buf, sizeof (buf), "%u", (uint32_t) version);
id = unique_id;
id += '/';
id += buf;
@@ -1704,9 +2202,9 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id,
AUChannelInfo* channel_info;
UInt32 cnt;
int ret;
-
+
ARDOUR::BootMessage (string_compose (_("Checking AudioUnit: %1"), name));
-
+
try {
if (CAAudioUnit::Open (comp, unit) != noErr) {
@@ -1720,7 +2218,8 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id,
return false;
}
-
+
+ TRACE_API ("get AU channel info\n");
if ((ret = unit.GetChannelInfo (&channel_info, cnt)) < 0) {
return false;
}
@@ -1731,9 +2230,9 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id,
cinfo.io_configs.push_back (pair<int,int> (-1, -1));
} else {
-
+
/* store each configuration */
-
+
for (uint32_t n = 0; n < cnt; ++n) {
cinfo.io_configs.push_back (pair<int,int> (channel_info[n].inChannels,
channel_info[n].outChannels));
@@ -1754,13 +2253,16 @@ AUPluginInfo::add_cached_info (const std::string& id, AUPluginCachedInfo& cinfo)
cached_info[id] = cinfo;
}
+#define AU_CACHE_VERSION "2.0"
+
void
AUPluginInfo::save_cached_info ()
{
XMLNode* node;
node = new XMLNode (X_("AudioUnitPluginCache"));
-
+ node->add_property( "version", AU_CACHE_VERSION );
+
for (map<string,AUPluginCachedInfo>::iterator i = cached_info.begin(); i != cached_info.end(); ++i) {
XMLNode* parent = new XMLNode (X_("plugin"));
parent->add_property ("id", i->first);
@@ -1780,7 +2282,7 @@ AUPluginInfo::save_cached_info ()
}
- string path = au_cache_path ();
+ Glib::ustring path = au_cache_path ();
XMLTree tree;
tree.set_root (node);
@@ -1794,28 +2296,39 @@ AUPluginInfo::save_cached_info ()
int
AUPluginInfo::load_cached_info ()
{
- string path = au_cache_path ();
+ Glib::ustring path = au_cache_path ();
XMLTree tree;
-
+
if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
return 0;
}
- tree.read (path);
+ if ( !tree.read (path) ) {
+ error << "au_cache is not a valid XML file. AU plugins will be re-scanned" << endmsg;
+ return -1;
+ }
+
const XMLNode* root (tree.root());
if (root->name() != X_("AudioUnitPluginCache")) {
return -1;
}
-
+
+ //initial version has incorrectly stored i/o info, and/or garbage chars.
+ const XMLProperty* version = root->property(X_("version"));
+ if (! ((version != NULL) && (version->value() == X_(AU_CACHE_VERSION)))) {
+ error << "au_cache is not correct version. AU plugins will be re-scanned" << endmsg;
+ return -1;
+ }
+
cached_info.clear ();
const XMLNodeList children = root->children();
for (XMLNodeConstIterator iter = children.begin(); iter != children.end(); ++iter) {
-
+
const XMLNode* child = *iter;
-
+
if (child->name() == X_("plugin")) {
const XMLNode* gchild;
@@ -1825,8 +2338,29 @@ AUPluginInfo::load_cached_info ()
if (!prop) {
continue;
}
+
+ string id = prop->value();
+ string fixed;
+ string version;
+
+ string::size_type slash = id.find_last_of ('/');
+
+ if (slash == string::npos) {
+ continue;
+ }
+
+ version = id.substr (slash);
+ id = id.substr (0, slash);
+ fixed = AUPlugin::maybe_fix_broken_au_id (id);
+
+ if (fixed.empty()) {
+ error << string_compose (_("Your AudioUnit configuration cache contains an AU plugin whose ID cannot be understood - ignored (%1)"), id) << endmsg;
+ continue;
+ }
+
+ id = fixed;
+ id += version;
- std::string id = prop->value();
AUPluginCachedInfo cinfo;
for (XMLNodeConstIterator giter = gchildren.begin(); giter != gchildren.end(); giter++) {
@@ -1835,14 +2369,16 @@ AUPluginInfo::load_cached_info ()
if (gchild->name() == X_("io")) {
+ int in;
+ int out;
const XMLProperty* iprop;
const XMLProperty* oprop;
if (((iprop = gchild->property (X_("in"))) != 0) &&
((oprop = gchild->property (X_("out"))) != 0)) {
- const int in = atoi (iprop->value());
- const int out = atoi (iprop->value());
-
+ in = atoi (iprop->value());
+ out = atoi (oprop->value());
+
cinfo.io_configs.push_back (pair<int,int> (in, out));
}
}
@@ -1858,7 +2394,7 @@ AUPluginInfo::load_cached_info ()
}
void
-AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, string& maker)
+AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, std::string& maker)
{
CFStringRef itemName = NULL;
@@ -1878,16 +2414,16 @@ AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, s
DisposeHandle(nameHandle);
}
}
-
+
// if Marc-style fails, do the original way
if (itemName == NULL) {
CFStringRef compTypeString = UTCreateStringForOSType(comp_desc.componentType);
CFStringRef compSubTypeString = UTCreateStringForOSType(comp_desc.componentSubType);
CFStringRef compManufacturerString = UTCreateStringForOSType(comp_desc.componentManufacturer);
-
- itemName = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ - %@ - %@"),
+
+ itemName = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ - %@ - %@"),
compTypeString, compManufacturerString, compSubTypeString);
-
+
if (compTypeString != NULL)
CFRelease(compTypeString);
if (compSubTypeString != NULL)
@@ -1895,37 +2431,38 @@ AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, s
if (compManufacturerString != NULL)
CFRelease(compManufacturerString);
}
-
+
string str = CFStringRefToStdString(itemName);
string::size_type colon = str.find (':');
if (colon) {
name = str.substr (colon+1);
maker = str.substr (0, colon);
- // strip_whitespace_edges (maker);
- // strip_whitespace_edges (name);
+ strip_whitespace_edges (maker);
+ strip_whitespace_edges (name);
} else {
name = str;
maker = "unknown";
+ strip_whitespace_edges (name);
}
}
-// from CAComponentDescription.cpp (in libs/appleutility in ardour source)
-extern char *StringForOSType (OSType t, char *writeLocation);
-
std::string
AUPluginInfo::stringify_descriptor (const CAComponentDescription& desc)
{
- char str[24];
stringstream s;
- s << StringForOSType (desc.Type(), str);
- s << " - ";
-
- s << StringForOSType (desc.SubType(), str);
- s << " - ";
+ /* note: OSType is a compiler-implemenation-defined value,
+ historically a 32 bit integer created with a multi-character
+ constant such as 'abcd'. It is, fundamentally, an abomination.
+ */
- s << StringForOSType (desc.Manu(), str);
+ s << desc.Type();
+ s << '-';
+ s << desc.SubType();
+ s << '-';
+ s << desc.Manu();
return s.str();
}
+
diff --git a/libs/ardour/caimportable.cc b/libs/ardour/caimportable.cc
index 71927c95e5..e78691a1dd 100644
--- a/libs/ardour/caimportable.cc
+++ b/libs/ardour/caimportable.cc
@@ -85,7 +85,7 @@ CAImportableSource::channels () const
return af.GetFileDataFormat().NumberChannels();
}
-nframes_t
+framecnt_t
CAImportableSource::length () const
{
return af.GetNumberFrames();
diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc
index 5212a3006d..d1038faf62 100644
--- a/libs/ardour/coreaudiosource.cc
+++ b/libs/ardour/coreaudiosource.cc
@@ -19,7 +19,6 @@
*/
#include <algorithm>
-#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include "pbd/error.h"
@@ -93,16 +92,16 @@ CoreAudioSource::~CoreAudioSource ()
}
int
-CoreAudioSource::safe_read (Sample* dst, nframes_t start, nframes_t cnt, AudioBufferList& abl) const
+CoreAudioSource::safe_read (Sample* dst, nframes_t start, framecnt_t cnt, AudioBufferList& abl) const
{
- nframes_t nread = 0;
+ framecnt_t nread = 0;
while (nread < cnt) {
try {
af.Seek (start+nread);
} catch (CAXException& cax) {
- error << string_compose("CoreAudioSource: %1 to %2 (%3)", cax.mOperation, start+nread, _name.substr (1)) << endmsg;
+ error << string_compose("CoreAudioSource: %1 to %2 (%3)", cax.mOperation, start+nread, _name.val().substr (1)) << endmsg;
return -1;
}
@@ -138,10 +137,10 @@ CoreAudioSource::safe_read (Sample* dst, nframes_t start, nframes_t cnt, AudioBu
}
-nframes_t
-CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, nframes_t cnt) const
+framecnt_t
+CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const
{
- nframes_t file_cnt;
+ framecnt_t file_cnt;
AudioBufferList abl;
abl.mNumberBuffers = 1;
@@ -167,7 +166,7 @@ CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, nframes_t cnt) co
}
if (file_cnt != cnt) {
- nframes_t delta = cnt - file_cnt;
+ frameoffset_t delta = cnt - file_cnt;
memset (dst+file_cnt, 0, sizeof (Sample) * delta);
}
@@ -194,7 +193,7 @@ CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, nframes_t cnt) co
/* stride through the interleaved data */
- for (uint32_t n = 0; n < file_cnt; ++n) {
+ for (framecnt_t n = 0; n < file_cnt; ++n) {
dst[n] = *ptr;
ptr += n_channels;
}
@@ -218,13 +217,13 @@ CoreAudioSource::sample_rate() const
}
int
-CoreAudioSource::update_header (framepos_t when, struct tm&, time_t)
+CoreAudioSource::update_header (framepos_t, struct tm&, time_t)
{
return 0;
}
int
-CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg)
+CoreAudioSource::get_soundfile_info (string path, SoundFileInfo& _info, string&)
{
FSRef ref;
ExtAudioFileRef af = 0;
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 0e12883d82..65125370aa 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -16,7 +16,6 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
#ifdef WAF_BUILD
#include "libardour-config.h"
#endif
diff --git a/libs/ardour/lv2_event_buffer.cc b/libs/ardour/lv2_event_buffer.cc
index 9bc61d93d1..c383e273c3 100644
--- a/libs/ardour/lv2_event_buffer.cc
+++ b/libs/ardour/lv2_event_buffer.cc
@@ -17,7 +17,6 @@
675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#define __STDC_LIMIT_MACROS 1
#include <stdint.h>
#include <iostream>
#include "lv2ext/lv2_event.h"
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 5b33eaf1f5..8ce12caf69 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -17,7 +17,6 @@
*/
-#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
#include <cmath>
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index 9bbe21aabf..366f683e56 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -62,6 +62,8 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
+PBD::Signal0<bool> Plugin::PresetFileExists;
+
Plugin::Plugin (AudioEngine& e, Session& s)
: _engine (e)
, _session (s)
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc
index 91c4d715d5..8227d5869f 100644
--- a/libs/ardour/plugin_manager.cc
+++ b/libs/ardour/plugin_manager.cc
@@ -21,7 +21,6 @@
#include "libardour-config.h"
#endif
-#define __STDC_FORMAT_MACROS 1
#include <stdint.h>
#include <sys/types.h>
diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc
index 32a2d056d6..e31cebe602 100644
--- a/libs/ardour/rb_effect.cc
+++ b/libs/ardour/rb_effect.cc
@@ -60,7 +60,7 @@ RBEffect::~RBEffect ()
}
int
-RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
+RBEffect::run (boost::shared_ptr<Region> r, Progress*)
{
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (r);
diff --git a/libs/ardour/reverse.cc b/libs/ardour/reverse.cc
index 675ccb4c52..9fcfb8c1b1 100644
--- a/libs/ardour/reverse.cc
+++ b/libs/ardour/reverse.cc
@@ -42,7 +42,7 @@ Reverse::~Reverse ()
}
int
-Reverse::run (boost::shared_ptr<Region> r, Progress* progress)
+Reverse::run (boost::shared_ptr<Region> r, Progress*)
{
SourceList nsrcs;
SourceList::iterator si;
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index 48083d594a..63b78dd347 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -167,7 +167,7 @@ Send::set_state (const XMLNode& node, int version)
}
int
-Send::set_state_2X (const XMLNode& node, int version)
+Send::set_state_2X (const XMLNode& node, int /* version */)
{
/* use the IO's name for the name of the send */
XMLNodeList const & children = node.children ();
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index e9feed4e1f..9c17367704 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -22,7 +22,6 @@
#include "libardour-config.h"
#endif
-#define __STDC_FORMAT_MACROS 1
#include <stdint.h>
#include <algorithm>
diff --git a/libs/ardour/uri_map.cc b/libs/ardour/uri_map.cc
index 35308b02f4..2c2861e385 100644
--- a/libs/ardour/uri_map.cc
+++ b/libs/ardour/uri_map.cc
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define __STDC_LIMIT_MACROS 1
#include <cassert>
#include <iostream>
#include <stdint.h>
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc
index 6604a93d4a..9698486e90 100644
--- a/libs/ardour/utils.cc
+++ b/libs/ardour/utils.cc
@@ -21,7 +21,6 @@
#include "libardour-config.h"
#endif
-#define __STDC_FORMAT_MACROS 1
#include <stdint.h>
#include <cstdio> /* for sprintf */
@@ -322,7 +321,7 @@ path_expand (string path)
#endif
}
-#if defined(HAVE_COREAUDIO) || defined(HAVE_AUDIOUNITS)
+#if __APPLE__
string
CFStringRefToStdString(CFStringRef stringRef)
{
@@ -339,7 +338,7 @@ CFStringRefToStdString(CFStringRef stringRef)
delete [] buf;
return result;
}
-#endif // HAVE_COREAUDIO
+#endif // __APPLE__
void
compute_equal_power_fades (nframes_t nframes, float* in, float* out)
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index b8d49febb9..eeaeb696d9 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -233,7 +233,6 @@ def configure(conf):
autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE', atleast_version='0.1.0')
autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
autowaf.check_pkg(conf, 'slv2', uselib_store='SLV2', atleast_version='0.6.4', mandatory=False)
- autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18')
autowaf.check_pkg(conf, 'soundtouch-1.0', uselib_store='SOUNDTOUCH', mandatory=False)
autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
@@ -281,7 +280,7 @@ def build(bld):
obj.includes = ['.', '../surfaces/control_protocol', '..']
obj.name = 'libardour'
obj.target = 'ardour'
- obj.uselib = 'GLIBMM GTHREAD AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF OSX COREAUDIO CURL DL'
+ obj.uselib = 'GLIBMM GTHREAD AUBIO SIGCPP XML UUID JACK SNDFILE SAMPLERATE LRDF AUDIOUNIT OSX BOOST CURL DL'
obj.uselib_local = 'libpbd libmidipp libevoral libvamphost libvampplugin libtaglib librubberband libaudiographer'
obj.vnum = LIBARDOUR_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
@@ -314,13 +313,9 @@ def build(bld):
obj.includes += [ '../fst' ]
obj.cxxflags += [ '-DVST_SUPPORT' ]
- if bld.env['HAVE_COREAUDIO'] and bld.env['COREAUDIO']:
+ if bld.env['COREAUDIO']:
obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
-
- if bld.env['HAVE_AUDIOUNITS'] or bld.env['HAVE_COREAUDIO']:
obj.uselib_local += ' libappleutility'
-
- if bld.env['HAVE_AUDIOUNITS'] and bld.env['AUDIOUNITS']:
obj.source += [ 'audio_unit.cc' ]
if bld.env['FPU_OPTIMIZATION']:
diff --git a/libs/evoral/src/SMF.cpp b/libs/evoral/src/SMF.cpp
index 021eadb25f..e58090f2a3 100644
--- a/libs/evoral/src/SMF.cpp
+++ b/libs/evoral/src/SMF.cpp
@@ -17,7 +17,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define __STDC_LIMIT_MACROS 1
#include <cassert>
#include <cmath>
#include <iostream>
diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp
index 62293aa3c1..5c6f492a36 100644
--- a/libs/evoral/src/Sequence.cpp
+++ b/libs/evoral/src/Sequence.cpp
@@ -16,7 +16,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define __STDC_LIMIT_MACROS 1
#include <algorithm>
#include <cmath>
#include <iostream>
diff --git a/libs/gtkmm2ext/gtkapplication_quartz.mm b/libs/gtkmm2ext/gtkapplication_quartz.mm
index c5fb8b12e2..f244bd9eb0 100644
--- a/libs/gtkmm2ext/gtkapplication_quartz.mm
+++ b/libs/gtkmm2ext/gtkapplication_quartz.mm
@@ -38,6 +38,8 @@
#include <gtkmm2ext/gtkapplication.h>
#include <gtkmm2ext/gtkapplication-private.h>
+#define UNUSED_PARAMETER(a) (void) (a)
+
// #define DEBUG(format, ...) g_printerr ("%s: " format, G_STRFUNC, ## __VA_ARGS__)
#define DEBUG(format, ...)
@@ -567,6 +569,7 @@ idle_call_activate (gpointer data)
}
- (void) activate:(id) sender
{
+ UNUSED_PARAMETER(sender);
g_idle_add (idle_call_activate, gtk_menu_item);
}
@end
@@ -625,7 +628,7 @@ get_menu_label_text (GtkWidget *menu_item,
}
static gboolean
-accel_find_func (GtkAccelKey *key,
+accel_find_func (GtkAccelKey * /*key*/,
GClosure *closure,
gpointer data)
{
@@ -802,8 +805,6 @@ cocoa_menu_item_update_accelerator (NSMenuItem *cocoa_item,
appear.
*/
- const gchar* ltxt = get_menu_label_text (widget, &label);
-
if (GTK_IS_ACCEL_LABEL (label) &&
GTK_ACCEL_LABEL (label)->accel_closure)
{
@@ -887,9 +888,9 @@ cocoa_menu_item_update_accelerator (NSMenuItem *cocoa_item,
}
static void
-cocoa_menu_item_accel_changed (GtkAccelGroup *accel_group,
- guint keyval,
- GdkModifierType modifier,
+cocoa_menu_item_accel_changed (GtkAccelGroup* /*accel_group*/,
+ guint /*keyval*/,
+ GdkModifierType /*modifier*/,
GClosure *accel_closure,
GtkWidget *widget)
{
@@ -948,8 +949,8 @@ cocoa_menu_item_update_accel_closure (GNSMenuItem *cocoa_item,
static void
cocoa_menu_item_notify_label (GObject *object,
- GParamSpec *pspec,
- gpointer data)
+ GParamSpec *pspec,
+ gpointer)
{
GNSMenuItem *cocoa_item;
@@ -1089,8 +1090,8 @@ add_menu_item (NSMenu* cocoa_menu, GtkWidget* menu_item, int index)
static void
push_menu_shell_to_nsmenu (GtkMenuShell *menu_shell,
NSMenu* cocoa_menu,
- gboolean toplevel,
- gboolean debug)
+ gboolean /*toplevel*/,
+ gboolean /*debug*/)
{
GList *children;
GList *l;
@@ -1117,9 +1118,9 @@ push_menu_shell_to_nsmenu (GtkMenuShell *menu_shell,
static gulong emission_hook_id = 0;
static gboolean
-parent_set_emission_hook (GSignalInvocationHint *ihint,
- guint n_param_values,
- const GValue *param_values,
+parent_set_emission_hook (GSignalInvocationHint* /*ihint*/,
+ guint /*n_param_values*/,
+ const GValue* param_values,
gpointer data)
{
GtkWidget *instance = (GtkWidget*) g_value_get_object (param_values);
@@ -1156,12 +1157,10 @@ parent_set_emission_hook (GSignalInvocationHint *ihint,
}
static void
-parent_set_emission_hook_remove (GtkWidget *widget,
- gpointer data)
+parent_set_emission_hook_remove (GtkWidget*, gpointer)
{
- g_signal_remove_emission_hook (g_signal_lookup ("parent-set",
- GTK_TYPE_WIDGET),
- emission_hook_id);
+ g_signal_remove_emission_hook (g_signal_lookup ("parent-set", GTK_TYPE_WIDGET),
+ emission_hook_id);
}
/* Building "standard" Cocoa/OS X menus */
@@ -1186,6 +1185,7 @@ add_to_menubar (NSMenu *menu)
return 0;
}
+#if 0
static int
add_to_app_menu (NSMenu *menu)
{
@@ -1196,17 +1196,7 @@ add_to_app_menu (NSMenu *menu)
[dummyItem release];
return 0;
}
-
-static int
-add_to_window_menu (NSMenu *menu)
-{
- NSMenuItem *dummyItem = [[NSMenuItem alloc] initWithTitle:@""
- action:nil keyEquivalent:@""];
- [dummyItem setSubmenu:menu];
- [_window_menu addItem:dummyItem];
- [dummyItem release];
- return 0;
-}
+#endif
static int
create_apple_menu ()
@@ -1253,6 +1243,18 @@ create_apple_menu ()
return 0;
}
+#if 0
+static int
+add_to_window_menu (NSMenu *menu)
+{
+ NSMenuItem *dummyItem = [[NSMenuItem alloc] initWithTitle:@""
+ action:nil keyEquivalent:@""];
+ [dummyItem setSubmenu:menu];
+ [_window_menu addItem:dummyItem];
+ [dummyItem release];
+ return 0;
+}
+
static int
create_window_menu ()
{
@@ -1269,6 +1271,7 @@ create_window_menu ()
return 0;
}
+#endif
/*
* public functions
@@ -1402,13 +1405,15 @@ namespace Gtk {
return self;
}
-- (void)appDidBecomeActive:(NSNotification *)notification
+- (void)appDidBecomeActive:(NSNotification *) notification
{
+ UNUSED_PARAMETER(notification);
Gtkmm2ext::Application::instance()->ActivationChanged (true);
}
-- (void)appDidBecomeInactive:(NSNotification *)notification
+- (void)appDidBecomeInactive:(NSNotification *) notification
{
+ UNUSED_PARAMETER(notification);
Gtkmm2ext::Application::instance()->ActivationChanged (false);
}
@@ -1418,14 +1423,16 @@ namespace Gtk {
@end
@implementation GtkApplicationDelegate
--(BOOL) application:(NSApplication*) theApplication openFile:(NSString*) file
+-(BOOL) application:(NSApplication*) app :(NSString*) file
{
+ UNUSED_PARAMETER(app);
Glib::ustring utf8_path ([file UTF8String]);
Gtkmm2ext::Application::instance()->ShouldLoad (utf8_path);
return 1;
}
-- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
+- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *) app
{
+ UNUSED_PARAMETER(app);
Gtkmm2ext::Application::instance()->ShouldQuit ();
return NSTerminateCancel;
}
diff --git a/libs/pbd/cocoa_open_uri.mm b/libs/pbd/cocoa_open_uri.mm
new file mode 100644
index 0000000000..2c6822ac94
--- /dev/null
+++ b/libs/pbd/cocoa_open_uri.mm
@@ -0,0 +1,19 @@
+#include <CoreFoundation/CFLocale.h>
+#import <CoreFoundation/CFString.h>
+#import <Foundation/NSString.h>
+#import <Foundation/NSAutoreleasePool.h>
+#import <AppKit/NSWorkspace.h>
+
+bool
+cocoa_open_url (const char* uri)
+{
+ NSString* struri = [[NSString alloc] initWithUTF8String:uri];
+ NSURL* nsurl = [[NSURL alloc] initWithString:struri];
+
+ bool ret = [[NSWorkspace sharedWorkspace] openURL:nsurl];
+
+ [struri release];
+ [nsurl release];
+
+ return ret;
+}
diff --git a/libs/pbd/openuri.cc b/libs/pbd/openuri.cc
index 7c51dc55e9..403aff07c7 100644
--- a/libs/pbd/openuri.cc
+++ b/libs/pbd/openuri.cc
@@ -26,3 +26,4 @@ PBD::open_uri (const char* uri)
#endif
#endif
}
+
diff --git a/libs/pbd/wscript b/libs/pbd/wscript
index 45fc2c8027..e707be68df 100644
--- a/libs/pbd/wscript
+++ b/libs/pbd/wscript
@@ -2,6 +2,7 @@
import autowaf
import os
import sys
+import TaskGen
# Version of this package (even if built as a child)
MAJOR = '4'
@@ -106,7 +107,11 @@ def build(bld):
obj.includes = ['.']
obj.name = 'libpbd'
obj.target = 'pbd'
- obj.uselib = 'GLIBMM SIGCPP XML UUID'
+ obj.uselib = 'GLIBMM SIGCPP XML UUID SNDFILE'
+ if sys.platform == 'darwin':
+ TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
+ obj.source += 'cocoa_open_uri.mm'
+ obj.uselib += ' OSX'
obj.vnum = LIBPBD_LIB_VERSION
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
obj.cxxflags = ['-DPACKAGE="libpbd"']
@@ -127,6 +132,7 @@ def build(bld):
testobj.uselib = 'CPPUNIT XML SNDFILE'
testobj.uselib_local = 'libpbd'
+
def shutdown():
autowaf.shutdown()
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
index 89d353cf79..32f17e1156 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
@@ -17,7 +17,6 @@
*/
-#define __STDC_FORMAT_MACROS 1
#include <stdint.h>
#include <sstream>
diff --git a/wscript b/wscript
index 4491a0df12..ada116a138 100644
--- a/wscript
+++ b/wscript
@@ -397,25 +397,27 @@ def configure(conf):
if sys.platform == 'darwin':
conf.define ('AUDIOUNITS', 1)
- conf.define ('AUSTATE', 1)
+ conf.define ('AU_STATE_SUPPORT', 1)
conf.define ('COREAUDIO', 1)
conf.define ('GTKOSX', 1)
+ conf.define ('TOP_MENUBAR',1)
+ conf.define ('GTKOSX',1)
+ conf.env.append_value('CXXFLAGS_APPLEUTILITY', '-I../libs')
#
# Define OSX as a uselib to use when compiling
# on Darwin to add all applicable flags at once
#
conf.env.append_value('CXXFLAGS_OSX', '-DMAC_OS_X_VERSION_MIN_REQUIRED=1040')
conf.env.append_value('CCFLAGS_OSX', '-DMAC_OS_X_VERSION_MIN_REQUIRED=1040')
- #conf.env.append_value('CXXFLAGS_OSX', "-mmacosx-version-min=10.4")
- #conf.env.append_value('CXXFLAGS_OSX', "-mmacosx-version-min=10.4")
+ conf.env.append_value('CXXFLAGS_OSX', '-mmacosx-version-min=10.4')
+ conf.env.append_value('CCFLAGS_OSX', '-mmacosx-version-min=10.4')
+
#conf.env.append_value('CXXFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
#conf.env.append_value('CCFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
- #conf.env.append_value('LINKFLAGS_OSX', "-mmacosx-version-min=10.4")
#conf.env.append_value('LINKFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
#conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
- #conf.env.append_value('LINKFLAGS_OSX', "-F/System/Library/Frameworks")
conf.env.append_value('CXXFLAGS_OSX', "-msse")
conf.env.append_value('CCFLAGS_OSX', "-msse")
@@ -426,60 +428,23 @@ def configure(conf):
# off processor type. Need to add in a check
# for that.
#
+ conf.env.append_value('CXXFLAGS_OSX', '-F/System/LibraryFrameworks')
+ conf.env.append_value('CXXFLAGS_OSX', '-F/Library/Frameworks')
- #conf.env.append_value('CPPPATH_OSX', "/System/Library/Frameworks/")
- #conf.env.append_value('CPPPATH_OSX', "/usr/include/")
- #conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0")
- #conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0/i686-apple-darwin8/")
- #
- # TODO: Fix the above include path, it needs to be
- # defined based off what is read in the configuration
- # stage about the machine(PPC, X86, X86_64, etc.)
- #
- conf.env.append_value('CPPPATH_OSX', "/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/")
- #
- # TODO: Likewise this needs to be defined not only
- # based off the machine characteristics, but also
- # based off the version of GCC being used.
- #
-
- conf.env.append_value('FRAMEWORK_OSX', ['CoreFoundation'])
+ conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'AppKit'])
+ conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreAudio'])
+ conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreFoundation'])
+ conf.env.append_value('LINKFLAGS_OSX', ['-framework', 'CoreServices'])
- #conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'suppress'])
- #conf.env.append_value('LINKFLAGS_OSX', "-flat_namespace")
- #
- # The previous 2 flags avoid circular dependencies
- # between libardour and libardour_cp on OS X.
- # ld reported -undefined suppress as an unknown option
- # in one of the tests ran, removing it for the moment
- #
- conf.env.append_value('CXXFLAGS_OSX', "-F/System/Library/Frameworks")
- conf.env.append_value('CCFLAGS_OSX', "-F/System/Library/Frameworks")
+ conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'suppress' ])
+ conf.env.append_value('LINKFLAGS_OSX', '-flat_namespace')
- #
- # Define Include Paths for GTKOSX
- #
- conf.env.append_value('CXXFLAGS_GTKOSX', '-DTOP_MENUBAR')
- conf.env.append_value('CXXFLAGS_GTKOSX', '-DGTKOSX')
- conf.env.append_value('LINKFLAGS_GTKOSX', "-framework AppKit")
- conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker -headerpad")
- conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker 2048")
+ conf.env.append_value('LINKFLAGS_GTKOSX', [ '-Xlinker', '-headerpad'])
+ conf.env.append_value('LINKFLAGS_GTKOSX', ['-Xlinker', '2048'])
conf.env.append_value('CPPPATH_GTKOSX', "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/")
- conf.check_cc (header_name = '/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h',
- define_name = 'HAVE_COREAUDIO', linkflags = ['-framework CoreAudio'],
- uselib_store="COREAUDIO")
- conf.check_cxx (header_name = '/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h',
- linkflags = [ '-framework AudioToolbox' ], uselib_store="COREAUDIO")
- conf.check_cc (header_name = '/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h',
- linkflags = ['-framework CoreServices'], uselib_store="COREAUDIO")
-
- conf.env.append_value('CXXFLAGS_AUDIOUNIT', "-DHAVE_AUDIOUNITS")
- conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['AudioToolbox'])
- conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['CoreServices'])
- conf.check_cc (header_name = '/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h',
- define_name = 'HAVE_AUDIOUNITS', linkflags = [ '-framework AudioUnit' ],
- uselib_store="AUDIOUNIT")
+ conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DHAVE_AUDIOUNITS")
+ conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Audiotoolbox', '-framework', 'AudioUnit'])
if Options.options.boost_include != '':
conf.env.append_value('CPPPATH', Options.options.boost_include)
@@ -502,6 +467,7 @@ def configure(conf):
autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2')
autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
+ autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18')
if sys.platform == 'darwin':
sub_config_and_use(conf, 'libs/appleutility')