mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
towards an Instrument Setup/Replace workflow
This commit is contained in:
parent
77f3518571
commit
6815dc7ead
6 changed files with 298 additions and 0 deletions
|
|
@ -46,6 +46,7 @@
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "midi_time_axis.h"
|
#include "midi_time_axis.h"
|
||||||
#include "mixer_strip.h"
|
#include "mixer_strip.h"
|
||||||
|
#include "plugin_setup_dialog.h"
|
||||||
#include "route_sorter.h"
|
#include "route_sorter.h"
|
||||||
#include "tooltips.h"
|
#include "tooltips.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
@ -292,6 +293,8 @@ EditorRoutes::EditorRoutes (Editor* e)
|
||||||
_display.set_enable_search (false);
|
_display.set_enable_search (false);
|
||||||
|
|
||||||
Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_order_keys, this), gui_context());
|
Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_order_keys, this), gui_context());
|
||||||
|
Route::PluginSetup.connect_same_thread (*this, boost::bind (&EditorRoutes::plugin_setup, this, _1, _2, _3));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -1747,3 +1750,10 @@ EditorRoutes::show_tracks_with_regions_at_playhead ()
|
||||||
|
|
||||||
sync_order_keys_from_treeview ();
|
sync_order_keys_from_treeview ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
EditorRoutes::plugin_setup (boost::shared_ptr<Route> r, boost::shared_ptr<PluginInsert> pi, ARDOUR::Route::PluginSetupOptions flags)
|
||||||
|
{
|
||||||
|
PluginSetupDialog psd (r, pi, flags);
|
||||||
|
return psd.run ();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,8 @@ private:
|
||||||
void show_tracks_with_regions_at_playhead ();
|
void show_tracks_with_regions_at_playhead ();
|
||||||
void selection_changed ();
|
void selection_changed ();
|
||||||
|
|
||||||
|
int plugin_setup (boost::shared_ptr<ARDOUR::Route>, boost::shared_ptr<ARDOUR::PluginInsert>, ARDOUR::Route::PluginSetupOptions);
|
||||||
|
|
||||||
void display_drag_data_received (
|
void display_drag_data_received (
|
||||||
Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
|
Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
|
||||||
);
|
);
|
||||||
|
|
|
||||||
212
gtk2_ardour/plugin_setup_dialog.cc
Normal file
212
gtk2_ardour/plugin_setup_dialog.cc
Normal file
|
|
@ -0,0 +1,212 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Robin Gareus <robin@gareus.org>
|
||||||
|
* Copyright (C) 2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtkmm/frame.h>
|
||||||
|
#include <gtkmm/label.h>
|
||||||
|
|
||||||
|
#include "plugin_setup_dialog.h"
|
||||||
|
#include "i18n.h"
|
||||||
|
|
||||||
|
using namespace ARDOUR;
|
||||||
|
using namespace Gtk;
|
||||||
|
|
||||||
|
PluginSetupDialog::PluginSetupDialog (boost::shared_ptr<ARDOUR::Route> r, boost::shared_ptr<ARDOUR::PluginInsert> pi, ARDOUR::Route::PluginSetupOptions flags)
|
||||||
|
: ArdourDialog (_("Plugin Setup"), true, false)
|
||||||
|
, _route (r)
|
||||||
|
, _pi (pi)
|
||||||
|
, _keep_mapping (_("Copy I/O Map"), ArdourButton::led_default_elements)
|
||||||
|
{
|
||||||
|
assert (flags != Route::None);
|
||||||
|
|
||||||
|
Gtk::Table *tbl = manage (new Gtk::Table ());
|
||||||
|
tbl->set_spacings (6);
|
||||||
|
get_vbox()->pack_start (*tbl);
|
||||||
|
int row = 0;
|
||||||
|
|
||||||
|
if (flags & Route::CanReplace) {
|
||||||
|
boost::shared_ptr<Processor> old = _route->the_instrument ();
|
||||||
|
boost::shared_ptr<PluginInsert> opi = boost::dynamic_pointer_cast<PluginInsert> (old);
|
||||||
|
assert (opi);
|
||||||
|
|
||||||
|
opi->configured_io (_cur_inputs, _cur_outputs);
|
||||||
|
|
||||||
|
Gtk::Label* l = manage (new Label (
|
||||||
|
_("An Instrument plugin is already present.")
|
||||||
|
));
|
||||||
|
tbl->attach (*l, 0, 2, row, row + 1, EXPAND|FILL, SHRINK); ++row;
|
||||||
|
|
||||||
|
l = manage (new Label (_("Replace"), ALIGN_END));
|
||||||
|
tbl->attach (*l, 0, 1, row, row + 1, EXPAND|FILL, SHRINK);
|
||||||
|
|
||||||
|
l = manage (new Label (string_compose ("'%1'", old->name ()), ALIGN_START));
|
||||||
|
tbl->attach (*l, 1, 2, row, row + 1, EXPAND|FILL, SHRINK); ++row;
|
||||||
|
|
||||||
|
l = manage (new Label (_("with"), ALIGN_END));
|
||||||
|
tbl->attach (*l, 0, 1, row, row + 1, EXPAND|FILL, SHRINK);
|
||||||
|
|
||||||
|
l = manage (new Label (string_compose ("'%1'", pi->name ()), ALIGN_START));
|
||||||
|
tbl->attach (*l, 1, 2, row, row + 1, EXPAND|FILL, SHRINK); ++row;
|
||||||
|
|
||||||
|
Box* box = manage (new HBox ());
|
||||||
|
box->set_border_width (2);
|
||||||
|
box->pack_start (_keep_mapping, true, true);
|
||||||
|
Frame* f = manage (new Frame ());
|
||||||
|
f->set_label (_("I/O Pin Mapping"));
|
||||||
|
f->add (*box);
|
||||||
|
tbl->attach (*f, 0, 1, row, row + 1, EXPAND|FILL, SHRINK, 0, 8);
|
||||||
|
|
||||||
|
_keep_mapping.signal_clicked.connect (sigc::mem_fun (*this, &PluginSetupDialog::apply_mapping));
|
||||||
|
add_button ("Replace", 2);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Gtk::Label *l = manage (new Label (string_compose (
|
||||||
|
_("Configure Plugin '%1'"), pi->name ()
|
||||||
|
)));
|
||||||
|
tbl->attach (*l, 0, 2, row, row + 1, EXPAND|FILL, SHRINK); ++row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & Route::MultiOut) {
|
||||||
|
setup_output_presets ();
|
||||||
|
Box* box = manage (new HBox ());
|
||||||
|
box->set_border_width (2);
|
||||||
|
box->pack_start (_out_presets, true, true);
|
||||||
|
Frame* f = manage (new Frame ());
|
||||||
|
f->set_label (_("Output Configuration"));
|
||||||
|
f->add (*box);
|
||||||
|
tbl->attach (*f, 1, 2, row, row + 1, EXPAND|FILL, SHRINK, 0, 8);
|
||||||
|
} else {
|
||||||
|
_pi->set_preset_out (_pi->natural_output_streams ());
|
||||||
|
update_sensitivity (_pi->natural_output_streams ().n_audio ());
|
||||||
|
}
|
||||||
|
|
||||||
|
_keep_mapping.set_active (false);
|
||||||
|
apply_mapping ();
|
||||||
|
|
||||||
|
add_button (Stock::ADD, 0);
|
||||||
|
add_button (Stock::CANCEL, 1);
|
||||||
|
set_default_response (0);
|
||||||
|
show_all ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginSetupDialog::setup_output_presets ()
|
||||||
|
{
|
||||||
|
// compare to PluginPinDialog::refill_output_presets ()
|
||||||
|
using namespace Menu_Helpers;
|
||||||
|
PluginOutputConfiguration ppc (_pi->plugin (0)->possible_output ());
|
||||||
|
|
||||||
|
_out_presets.AddMenuElem (MenuElem (_("Automatic"), sigc::bind (sigc::mem_fun (*this, &PluginSetupDialog::select_output_preset), 0)));
|
||||||
|
|
||||||
|
if (ppc.find (0) != ppc.end ()) {
|
||||||
|
// anyting goes
|
||||||
|
ppc.clear ();
|
||||||
|
ppc.insert (1);
|
||||||
|
ppc.insert (2);
|
||||||
|
ppc.insert (8);
|
||||||
|
ppc.insert (16);
|
||||||
|
ppc.insert (24);
|
||||||
|
ppc.insert (32);
|
||||||
|
if (ppc.find (_cur_outputs.n_audio ()) == ppc.end ()) {
|
||||||
|
ppc.insert (_cur_outputs.n_audio ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool have_matching_io = false;
|
||||||
|
|
||||||
|
for (PluginOutputConfiguration::const_iterator i = ppc.begin () ; i != ppc.end (); ++i) {
|
||||||
|
assert (*i > 0);
|
||||||
|
_out_presets.AddMenuElem (MenuElem (preset_label (*i), sigc::bind (sigc::mem_fun (*this, &PluginSetupDialog::select_output_preset), *i)));
|
||||||
|
if (*i == _cur_outputs.n_audio ()) {
|
||||||
|
have_matching_io = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (have_matching_io) {
|
||||||
|
select_output_preset (_cur_outputs.n_audio ());
|
||||||
|
} else {
|
||||||
|
select_output_preset (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginSetupDialog::select_output_preset (uint32_t n_audio)
|
||||||
|
{
|
||||||
|
_pi->set_preset_out (ChanCount (DataType::AUDIO, n_audio));
|
||||||
|
_out_presets.set_text (preset_label (n_audio));
|
||||||
|
update_sensitivity (n_audio);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginSetupDialog::update_sensitivity (uint32_t n_audio)
|
||||||
|
{
|
||||||
|
if (_cur_outputs.n_audio () > 0 && _cur_outputs.n_audio () == n_audio) {
|
||||||
|
// TODO check _cur_inputs if not reconfigurable?
|
||||||
|
_keep_mapping.set_sensitive (true);
|
||||||
|
} else {
|
||||||
|
_keep_mapping.set_sensitive (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PluginSetupDialog::io_match () const
|
||||||
|
{
|
||||||
|
if (_cur_outputs.n_audio () > 0 && _cur_outputs.n_audio () == _pi->preset_out ().n_audio ()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PluginSetupDialog::apply_mapping ()
|
||||||
|
{
|
||||||
|
// toggle button
|
||||||
|
_keep_mapping.set_active (!_keep_mapping.get_active ());
|
||||||
|
|
||||||
|
boost::shared_ptr<Processor> old = _route->the_instrument ();
|
||||||
|
boost::shared_ptr<PluginInsert> opi = boost::dynamic_pointer_cast<PluginInsert> (old);
|
||||||
|
|
||||||
|
if (_keep_mapping.get_active () && opi && io_match ()) {
|
||||||
|
_pi->pre_seed (_cur_inputs, _cur_outputs, opi->input_map (0), opi->output_map (0), opi->thru_map ());
|
||||||
|
} else {
|
||||||
|
_pi->pre_seed (ChanCount (), ChanCount (), ChanMapping (), ChanMapping (), ChanMapping());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
PluginSetupDialog::preset_label (uint32_t n_audio) const
|
||||||
|
{
|
||||||
|
std::string rv;
|
||||||
|
switch (n_audio) {
|
||||||
|
case 0:
|
||||||
|
rv = _("Automatic");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
rv = _("Mono");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
rv = _("Stereo");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rv = string_compose (P_("%1 Channel", "%1 Channels", n_audio), n_audio);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
52
gtk2_ardour/plugin_setup_dialog.h
Normal file
52
gtk2_ardour/plugin_setup_dialog.h
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Robin Gareus <robin@gareus.org>
|
||||||
|
*
|
||||||
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __gtkardour_plugin_setup_dialog_h__
|
||||||
|
#define __gtkardour_plugin_setup_dialog_h__
|
||||||
|
|
||||||
|
#include "ardour/plugin_insert.h"
|
||||||
|
#include "ardour/route.h"
|
||||||
|
|
||||||
|
#include "ardour_dropdown.h"
|
||||||
|
#include "ardour_dialog.h"
|
||||||
|
|
||||||
|
class PluginSetupDialog : public ArdourDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PluginSetupDialog (boost::shared_ptr<ARDOUR::Route>, boost::shared_ptr<ARDOUR::PluginInsert>, ARDOUR::Route::PluginSetupOptions);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setup_output_presets ();
|
||||||
|
void update_sensitivity (uint32_t);
|
||||||
|
bool io_match () const;
|
||||||
|
|
||||||
|
void select_output_preset (uint32_t n_audio);
|
||||||
|
void apply_mapping ();
|
||||||
|
|
||||||
|
std::string preset_label (uint32_t) const;
|
||||||
|
|
||||||
|
boost::shared_ptr<ARDOUR::Route> _route;
|
||||||
|
boost::shared_ptr<ARDOUR::PluginInsert> _pi;
|
||||||
|
|
||||||
|
ArdourDropdown _out_presets;
|
||||||
|
ArdourButton _keep_mapping;
|
||||||
|
ARDOUR::ChanCount _cur_inputs;
|
||||||
|
ARDOUR::ChanCount _cur_outputs;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -3001,6 +3001,27 @@ if (!ARDOUR::Profile->get_mixbus()) {
|
||||||
);
|
);
|
||||||
add_option (_("Plugins"), _plugin_prefer_inline);
|
add_option (_("Plugins"), _plugin_prefer_inline);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
add_option (_("Plugins"), new OptionEditorHeading (_("Instrument")));
|
||||||
|
|
||||||
|
bo = new BoolOption (
|
||||||
|
"ask-replace-instrument",
|
||||||
|
_("Ask to replace existing instrument plugin"),
|
||||||
|
sigc::mem_fun (*_rc_config, &RCConfiguration::get_ask_replace_instrument),
|
||||||
|
sigc::mem_fun (*_rc_config, &RCConfiguration::set_ask_replace_instrument)
|
||||||
|
);
|
||||||
|
add_option (_("Plugins"), bo);
|
||||||
|
|
||||||
|
bo = new BoolOption (
|
||||||
|
"ask-setup_instrument",
|
||||||
|
_("Interactively configure instrument plugins on insert"),
|
||||||
|
sigc::mem_fun (*_rc_config, &RCConfiguration::get_ask_setup_instrument),
|
||||||
|
sigc::mem_fun (*_rc_config, &RCConfiguration::set_ask_setup_instrument)
|
||||||
|
);
|
||||||
|
add_option (_("Plugins"), bo);
|
||||||
|
Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(),
|
||||||
|
_("<b>When enabled</b> show a dialog to select instrument channel configuration before adding a multichannel plugin."));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* INTERFACE */
|
/* INTERFACE */
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ gtk2_ardour_sources = [
|
||||||
'playlist_selector.cc',
|
'playlist_selector.cc',
|
||||||
'plugin_eq_gui.cc',
|
'plugin_eq_gui.cc',
|
||||||
'plugin_pin_dialog.cc',
|
'plugin_pin_dialog.cc',
|
||||||
|
'plugin_setup_dialog.cc',
|
||||||
'plugin_selector.cc',
|
'plugin_selector.cc',
|
||||||
'plugin_ui.cc',
|
'plugin_ui.cc',
|
||||||
'port_group.cc',
|
'port_group.cc',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue