diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-07-03 21:21:30 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-07-03 21:21:30 +0000 |
commit | 27c5844448558686b12153ce04e4904d17afa514 (patch) | |
tree | 26478210075ff83c250076ae28de987cef81e28f | |
parent | 4a33f70206d991102a8aba1bb0e2b926666d5741 (diff) |
do not attempt to use scroll view for AU plugin GUIs (fixes crash-on-delete of Cocoa-based AU plugins) ; drop references in PlugUIBase to plugin/insert when it notifies us via GoingAway (fixes crash on session close) ; fix handling of AU cache info for certain plugins ; fix SConstruct missing lrdf, raptor, samplerate library definitions (\!\!\!)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5310 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | SConstruct | 21 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/au_pluginui.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/au_pluginui.mm | 49 | ||||
-rw-r--r-- | gtk2_ardour/plugin_ui.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/plugin_ui.h | 2 | ||||
-rw-r--r-- | libs/ardour/audio_unit.cc | 18 |
7 files changed, 46 insertions, 60 deletions
diff --git a/SConstruct b/SConstruct index 1867a3a258..b005447e04 100644 --- a/SConstruct +++ b/SConstruct @@ -483,18 +483,6 @@ libraries = { } libraries['core'] = LibraryInfo (CCFLAGS = '-Ilibs') -#libraries['sndfile'] = LibraryInfo() -#libraries['sndfile'].ParseConfig('pkg-config --cflags --libs sndfile') - -libraries['lrdf'] = LibraryInfo() -libraries['lrdf'].ParseConfig('pkg-config --cflags --libs lrdf') - -libraries['raptor'] = LibraryInfo() -libraries['raptor'].ParseConfig('pkg-config --cflags --libs raptor') - -libraries['samplerate'] = LibraryInfo() -libraries['samplerate'].ParseConfig('pkg-config --cflags --libs samplerate') - conf = env.Configure (custom_tests = { 'CheckPKGExists' : CheckPKGExists } ) if conf.CheckPKGExists ('fftw3f'): @@ -570,6 +558,15 @@ libraries['xml'].ParseConfig('pkg-config --cflags --libs libxml-2.0') libraries['xslt'] = LibraryInfo() libraries['xslt'].ParseConfig('pkg-config --cflags --libs libxslt') +libraries['lrdf'] = LibraryInfo() +libraries['lrdf'].ParseConfig('pkg-config --cflags --libs lrdf') + +libraries['raptor'] = LibraryInfo() +libraries['raptor'].ParseConfig('pkg-config --cflags --libs raptor') + +libraries['samplerate'] = LibraryInfo() +libraries['samplerate'].ParseConfig('pkg-config --cflags --libs samplerate') + libraries['glib2'] = LibraryInfo() libraries['glib2'].ParseConfig ('pkg-config --cflags --libs glib-2.0') libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gobject-2.0') diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 841d74f0b2..726873dffc 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2408,7 +2408,9 @@ ARDOUR_UI::close_session () return; } - unload_session (true); + if (unload_session (true)) { + return; + } get_session_parameters (true, false); } diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 2f7e5a1f90..481378e413 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -69,7 +69,6 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox /* Cocoa */ NSWindow* cocoa_window; - NSScrollView* scroll_view; NSView* au_view; /* Carbon */ diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index 205364b343..1d7029365a 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -130,8 +130,12 @@ AUPluginUI::~AUPluginUI () DisposeWindow (carbon_window); } - if (packView && packView != au_view) { - [packView release]; + if (packView) { + /* remove whatever we packed into low_box so that GTK doesn't + mess with it. + */ + + [packView removeFromSuperview]; } } @@ -285,46 +289,12 @@ AUPluginUI::create_cocoa_view () [(AUGenericView *)au_view setShowsExpertParameters:YES]; } - NSRect packFrame; + packView = au_view; // Get the size of the new AU View's frame + + NSRect packFrame; packFrame = [au_view frame]; - - packFrame.origin.x = 0; - packFrame.origin.y = 0; - - if (packFrame.size.width > 500 || packFrame.size.height > 500) { - - /* its too big - use a scrollview */ - - NSRect frameRect = [[cocoa_window contentView] frame]; - scroll_view = [[[NSScrollView alloc] initWithFrame:frameRect] autorelease]; - [scroll_view setDrawsBackground:NO]; - [scroll_view setHasHorizontalScroller:YES]; - [scroll_view setHasVerticalScroller:YES]; - - packFrame.size = [NSScrollView frameSizeForContentSize:packFrame.size - hasHorizontalScroller:[scroll_view hasHorizontalScroller] - hasVerticalScroller:[scroll_view hasVerticalScroller] - borderType:[scroll_view borderType]]; - - // Create a new frame with same origin as current - // frame but size equal to the size of the new view - NSRect newFrame; - newFrame.origin = [scroll_view frame].origin; - newFrame.size = packFrame.size; - - // Set the new frame and document views on the scroll view - [scroll_view setFrame:newFrame]; - [scroll_view setDocumentView:au_view]; - - packView = scroll_view; - - } else { - - packView = au_view; - } - prefwidth = packFrame.size.width; prefheight = packFrame.size.height; @@ -552,7 +522,6 @@ AUPluginUI::parent_cocoa_window () packFrame = [au_view frame]; NSView* view = gdk_quartz_window_get_nsview (low_box.get_window()->gobj()); - [view setFrame:packFrame]; [view addSubview:packView]; diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 8c32028d71..0705d22a8b 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -322,7 +322,6 @@ PluginUIWindow::plugin_going_away () } death_connection.disconnect (); - delete_when_idle (this); } @@ -361,6 +360,8 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi) ARDOUR_UI::instance()->set_tip (&focus_button, _("Click to allow the plugin to receive keyboard events that Ardour would normally use as a shortcut"), ""); ARDOUR_UI::instance()->set_tip (&bypass_button, _("Click to enable/disable this plugin"), ""); + + insert->GoingAway.connect (mem_fun (*this, &PlugUIBase::plugin_going_away)); } PlugUIBase::~PlugUIBase () @@ -368,6 +369,14 @@ PlugUIBase::~PlugUIBase () } void +PlugUIBase::plugin_going_away () +{ + /* drop references to the plugin/insert */ + insert.reset (); + plugin.reset (); +} + +void PlugUIBase::redirect_active_changed (Redirect* r, void* src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &PlugUIBase::redirect_active_changed), r, src)); diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 4c14224a58..3e027b620e 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -99,6 +99,8 @@ class PlugUIBase : public virtual sigc::trackable bool focus_toggled(GdkEventButton*); void bypass_toggled(); void redirect_active_changed (ARDOUR::Redirect* r, void* src); + + void plugin_going_away (); }; class GenericPluginUI : public PlugUIBase, public Gtk::VBox diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 5d9a87a017..6692e90d24 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -799,9 +799,12 @@ AUPlugin::can_do (int32_t in, int32_t& out) } } + if (plugcnt == 1) { + break; + } + } - /* no fit */ return plugcnt; } @@ -1651,7 +1654,9 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip 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 - of values. + of values. in ::can_do() we use the whole system, but here + we need a single pair of values. XXX probably means we should + remove any use of these values. */ info->n_inputs = info->cache.io_configs.front().first; @@ -1825,7 +1830,8 @@ AUPluginInfo::load_cached_info () } std::string id = prop->value(); - + AUPluginCachedInfo cinfo; + for (XMLNodeConstIterator giter = gchildren.begin(); giter != gchildren.end(); giter++) { gchild = *giter; @@ -1842,12 +1848,14 @@ AUPluginInfo::load_cached_info () in = atoi (iprop->value()); out = atoi (iprop->value()); - AUPluginCachedInfo cinfo; cinfo.io_configs.push_back (pair<int,int> (in, out)); - add_cached_info (id, cinfo); } } } + + if (cinfo.io_configs.size()) { + add_cached_info (id, cinfo); + } } } |