diff options
author | David Robillard <d@drobilla.net> | 2007-06-27 20:23:48 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-06-27 20:23:48 +0000 |
commit | 05bcdd1d4c583c68ed977164913ff47e94df7adb (patch) | |
tree | aea97d1d013b62116feb5ac77db4b5479ffb9b9e | |
parent | 09264537c4baeabfc8eccddc1132ae8612a29555 (diff) |
Renamed Insert to Processor and Redirect to IOProcessor.
git-svn-id: svn://localhost/ardour2/trunk@2071 d708f5d6-7413-0410-9779-e7cbd77b26cf
68 files changed, 2526 insertions, 2548 deletions
diff --git a/ardour.rc.in b/ardour.rc.in index 662fdeed40..ecda2ed0d0 100644 --- a/ardour.rc.in +++ b/ardour.rc.in @@ -51,7 +51,7 @@ <Option name="time-stretch-fill" value="e2b5b596"/> <Option name="time-stretch-outline" value="63636396"/> <Option name="automation line" value="44bc59ff"/> - <Option name="redirect automation line" value="7aa3f9ff"/> + <Option name="processor automation line" value="7aa3f9ff"/> <Option name="control point fill" value="000000ff"/> <Option name="control point outline" value="000000ff"/> <Option name="entered control point outline" value="ff0000ee"/> diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index cb5cc41ae2..f2b599f076 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -168,9 +168,9 @@ plugin_selector.cc plugin_ui.cc prompter.cc public_editor.cc -redirect_automation_line.cc -redirect_automation_time_axis.cc -redirect_box.cc +plugin_automation_line.cc +processor_automation_time_axis.cc +processor_box.cc region_gain_line.cc region_selection.cc region_view.cc @@ -178,7 +178,7 @@ audio_region_view.cc midi_region_view.cc tape_region_view.cc route_params_ui.cc -route_redirect_selection.cc +route_processor_selection.cc route_ui.cc selection.cc sfdb_ui.cc diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 5617cdbc4f..89abebf9cb 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -74,7 +74,7 @@ void ARDOUR_UI::setup_keybindings () { install_actions (); - RedirectBox::register_actions (); + ProcessorBox::register_actions (); cerr << "loading bindings from " << keybindings_path << endl; diff --git a/gtk2_ardour/au_pluginui.cc b/gtk2_ardour/au_pluginui.cc index 3f0c6f44bc..84d39393fe 100644 --- a/gtk2_ardour/au_pluginui.cc +++ b/gtk2_ardour/au_pluginui.cc @@ -19,7 +19,7 @@ */ #include <ardour/audio_unit.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <gtkmm2ext/doi.h> @@ -123,7 +123,7 @@ AUPluginUI::~AUPluginUI () } void -AUPluginUI::plugin_going_away (ARDOUR::Redirect* ignored) +AUPluginUI::plugin_going_away (ARDOUR::IOProcessor* ignored) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &AUPluginUI::plugin_going_away), ignored)); diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 2dcefcc42f..d757ea3bf0 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -28,7 +28,7 @@ namespace ARDOUR { class AUPlugin; class PluginInsert; - class Redirect; + class IOProcessor; } class AUPluginUI @@ -41,7 +41,7 @@ class AUPluginUI WindowRef wr; boost::shared_ptr<ARDOUR::AUPlugin> au; - void plugin_going_away (ARDOUR::Redirect*); + void plugin_going_away (ARDOUR::IOProcessor*); Component get_carbon_view_component(OSType subtype); }; diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index b259d8723d..416a86c1a5 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -39,7 +39,7 @@ #include <ardour/audioplaylist.h> #include <ardour/audio_diskstream.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/location.h> #include <ardour/panner.h> #include <ardour/playlist.h> @@ -102,8 +102,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh /* map current state of the route */ - inserts_changed (); - reset_insert_automation_curves (); + processors_changed (); + reset_processor_automation_curves (); ensure_xml_node (); diff --git a/gtk2_ardour/audio_time_axis.h b/gtk2_ardour/audio_time_axis.h index a2f331cf6a..291a900e8b 100644 --- a/gtk2_ardour/audio_time_axis.h +++ b/gtk2_ardour/audio_time_axis.h @@ -44,8 +44,8 @@ namespace ARDOUR { class Session; class AudioDiskstream; class RouteGroup; - class Redirect; - class Insert; + class IOProcessor; + class Processor; class Location; class AudioPlaylist; } diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index e1ed2d2fa1..0af15d1e7d 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -37,7 +37,7 @@ #include "automation_pan_line.h" #include "automation_midi_cc_line.h" #include "automation_time_axis.h" -#include "redirect_automation_line.h" +#include "plugin_automation_line.h" #include "canvas_impl.h" #include "simplerect.h" @@ -591,7 +591,7 @@ Editor::canvas_control_point_event (GdkEvent *event, ArdourCanvas::Item* item, C type = GainAutomationControlPointItem; } else if (dynamic_cast<AutomationPanLine*> (&cp->line) != 0) { type = PanAutomationControlPointItem; - } else if (dynamic_cast<RedirectAutomationLine*> (&cp->line) != 0) { + } else if (dynamic_cast<ProcessorAutomationLine*> (&cp->line) != 0) { type = RedirectAutomationControlPointItem; } else if (dynamic_cast<AutomationMidiCCLine*> (&cp->line) != 0) { type = MidiCCAutomationControlPointItem; @@ -613,8 +613,8 @@ Editor::canvas_line_event (GdkEvent *event, ArdourCanvas::Item* item, Automation type = GainAutomationLineItem; } else if (dynamic_cast<AutomationPanLine*> (al) != 0) { type = PanAutomationLineItem; - } else if (dynamic_cast<RedirectAutomationLine*> (al) != 0) { - type = RedirectAutomationLineItem; + } else if (dynamic_cast<ProcessorAutomationLine*> (al) != 0) { + type = ProcessorAutomationLineItem; } else if (dynamic_cast<AutomationMidiCCLine*> (al) != 0) { type = MidiCCAutomationLineItem; } else { diff --git a/gtk2_ardour/editor_items.h b/gtk2_ardour/editor_items.h index ddba43350a..160dff3230 100644 --- a/gtk2_ardour/editor_items.h +++ b/gtk2_ardour/editor_items.h @@ -37,7 +37,7 @@ enum ItemType { PanAutomationControlPointItem, PanAutomationLineItem, RedirectAutomationControlPointItem, - RedirectAutomationLineItem, + ProcessorAutomationLineItem, MidiCCAutomationControlPointItem, MidiCCAutomationLineItem, MeterMarkerItem, diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 773c26f67d..f6f4d3bf0b 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -547,7 +547,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp case GainAutomationLineItem: case PanAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: start_line_grab_from_line (item, event); return true; @@ -632,7 +632,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp case GainAutomationLineItem: case PanAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: start_line_grab_from_line (item, event); break; @@ -924,7 +924,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case GainLineItem: case GainAutomationLineItem: case PanAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case StartSelectionTrimItem: case EndSelectionTrimItem: @@ -1105,7 +1105,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ break; case GainAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case PanAutomationLineItem: if (mouse_mode == MouseGain || mouse_mode == MouseObject) { @@ -1228,7 +1228,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ switch (item_type) { case GainLineItem: case GainAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case PanAutomationLineItem: case GainControlPointItem: @@ -1302,7 +1302,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case GainLineItem: case GainAutomationLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case PanAutomationLineItem: al = reinterpret_cast<AutomationLine*> (item->get_data ("line")); @@ -1457,7 +1457,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item case EndSelectionTrimItem: case SelectionItem: case GainLineItem: - case RedirectAutomationLineItem: + case ProcessorAutomationLineItem: case MidiCCAutomationLineItem: case GainAutomationLineItem: case PanAutomationLineItem: diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h index 625ba12d83..5ece771a63 100644 --- a/gtk2_ardour/io_selector.h +++ b/gtk2_ardour/io_selector.h @@ -47,7 +47,7 @@ namespace ARDOUR { class Session; class PortInsert; class Port; - class Redirect; + class IOProcessor; } class IOSelector : public Gtk::VBox { diff --git a/gtk2_ardour/ladspa_pluginui.cc b/gtk2_ardour/ladspa_pluginui.cc index 25c497a377..3d516d3056 100644 --- a/gtk2_ardour/ladspa_pluginui.cc +++ b/gtk2_ardour/ladspa_pluginui.cc @@ -103,9 +103,9 @@ LadspaPluginUI::LadspaPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrolla pack_start (hpacker, false, false); } - insert->ActiveChanged.connect (bind(mem_fun(*this, &LadspaPluginUI::insert_active_changed), - boost::weak_ptr<Insert>(insert))); - bypass_button.set_active (!insert->active()); + pi->ActiveChanged.connect (bind(mem_fun(*this, &LadspaPluginUI::processor_active_changed), + boost::weak_ptr<Processor>(pi))); + bypass_button.set_active (!pi->active()); build (); } @@ -673,13 +673,13 @@ LadspaPluginUI::control_combo_changed (ControlUI* cui) } void -LadspaPluginUI::insert_active_changed (boost::weak_ptr<Insert> weak_insert) +LadspaPluginUI::processor_active_changed (boost::weak_ptr<Processor> weak_processor) { - ENSURE_GUI_THREAD(bind (mem_fun(*this, &LadspaPluginUI::insert_active_changed), weak_insert)); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &LadspaPluginUI::processor_active_changed), weak_processor)); - boost::shared_ptr<Insert> insert = weak_insert.lock(); + boost::shared_ptr<Processor> processor = weak_processor.lock(); - bypass_button.set_active (!insert || !insert->active()); + bypass_button.set_active (!processor || !processor->active()); } bool diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 960ca36af9..7745d6ec3e 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -37,7 +37,7 @@ #include <ardour/midi_playlist.h> #include <ardour/midi_diskstream.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/ladspa_plugin.h> #include <ardour/location.h> #include <ardour/playlist.h> @@ -60,8 +60,8 @@ #include "point_selection.h" #include "prompter.h" #include "public_editor.h" -#include "redirect_automation_line.h" -#include "redirect_automation_time_axis.h" +#include "plugin_automation_line.h" +#include "processor_automation_time_axis.h" #include "midi_controller_time_axis.h" #include "region_view.h" #include "rgb_macros.h" @@ -100,13 +100,13 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shar /* map current state of the route */ - inserts_changed (); + processors_changed (); ensure_xml_node (); set_state (*xml_node); - _route->inserts_changed.connect (mem_fun(*this, &MidiTimeAxisView::inserts_changed)); + _route->processors_changed.connect (mem_fun(*this, &MidiTimeAxisView::processors_changed)); if (is_track()) { diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index 3b06411418..6f4777e152 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -44,8 +44,7 @@ namespace ARDOUR { class Session; class MidiDiskstream; class RouteGroup; - class Insert; - class Insert; + class Processor; class Location; class MidiPlaylist; } @@ -71,7 +70,7 @@ class MidiTimeAxisView : public RouteTimeAxisView void route_active_changed (); - void add_insert_to_subplugin_menu (ARDOUR::Insert *); + void add_insert_to_subplugin_menu (ARDOUR::Processor *); Gtk::Menu subplugin_menu; }; diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index cb27ef4e88..cb57f9809c 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -40,7 +40,7 @@ #include <ardour/audio_diskstream.h> #include <ardour/panner.h> #include <ardour/send.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/ladspa_plugin.h> #include <ardour/bundle.h> #include <ardour/session_bundle.h> @@ -85,8 +85,8 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt : AxisView(sess), RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")), _mixer(mx), - pre_redirect_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), - post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), + pre_processor_box (PreFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), + post_processor_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), gpm (_route, sess), panners (_route, sess), button_table (3, 2), @@ -251,11 +251,11 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK); global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK); - global_vpacker.pack_start (pre_redirect_box, true, true); + global_vpacker.pack_start (pre_processor_box, true, true); global_vpacker.pack_start (middle_button_table,Gtk::PACK_SHRINK); global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK); global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK); - global_vpacker.pack_start (post_redirect_box, true, true); + global_vpacker.pack_start (post_processor_box, true, true); if (!is_midi_track()) global_vpacker.pack_start (panners, Gtk::PACK_SHRINK); global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK); @@ -332,8 +332,8 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt /* now force an update of all the various elements */ - pre_redirect_box.update(); - post_redirect_box.update(); + pre_processor_box.update(); + post_processor_box.update(); mute_changed (0); solo_changed (0); name_changed (); @@ -400,8 +400,8 @@ MixerStrip::set_width (Width w, void* owner) gpm.set_width (w); panners.set_width (w); - pre_redirect_box.set_width (w); - post_redirect_box.set_width (w); + pre_processor_box.set_width (w); + post_processor_box.set_width (w); _width_owner = owner; @@ -1138,24 +1138,24 @@ MixerStrip::map_frozen () if (at) { switch (at->freeze_state()) { case AudioTrack::Frozen: - pre_redirect_box.set_sensitive (false); - post_redirect_box.set_sensitive (false); + pre_processor_box.set_sensitive (false); + post_processor_box.set_sensitive (false); speed_spinner.set_sensitive (false); break; default: - pre_redirect_box.set_sensitive (true); - post_redirect_box.set_sensitive (true); + pre_processor_box.set_sensitive (true); + post_processor_box.set_sensitive (true); speed_spinner.set_sensitive (true); break; } } - _route->foreach_insert (this, &MixerStrip::hide_insert_editor); + _route->foreach_processor (this, &MixerStrip::hide_processor_editor); } void -MixerStrip::hide_insert_editor (boost::shared_ptr<Insert> insert) +MixerStrip::hide_processor_editor (boost::shared_ptr<Processor> processor) { - void* gui = insert->get_gui (); + void* gui = processor->get_gui (); if (gui) { static_cast<Gtk::Widget*>(gui)->hide (); diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 98675d503b..b7bd20cfbd 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -43,8 +43,8 @@ #include <ardour/types.h> #include <ardour/ardour.h> #include <ardour/io.h> -#include <ardour/insert.h> -#include <ardour/redirect.h> +#include <ardour/processor.h> +#include <ardour/io_processor.h> #include <pbd/fastlog.h> @@ -53,7 +53,7 @@ #include "gain_meter.h" #include "panner_ui.h" #include "enums.h" -#include "redirect_box.h" +#include "processor_box.h" #include "ardour_dialog.h" class MotionController; @@ -66,7 +66,7 @@ namespace Gtkmm2ext { namespace ARDOUR { class Route; class Send; - class Insert; + class Processor; class Session; class PortInsert; class Bundle; @@ -121,8 +121,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox Gtk::Frame global_frame; Gtk::VBox global_vpacker; - RedirectBox pre_redirect_box; - RedirectBox post_redirect_box; + ProcessorBox pre_processor_box; + ProcessorBox post_processor_box; GainMeter gpm; PannerUI panners; @@ -239,7 +239,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void name_changed (); void update_speed_display (); void map_frozen (); - void hide_insert_editor (boost::shared_ptr<ARDOUR::Insert> insert); + void hide_processor_editor (boost::shared_ptr<ARDOUR::Processor> processor); bool ignore_speed_adjustment; diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index d4fb6d0fb7..62fa0f7ebf 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -37,7 +37,7 @@ #include <ardour/ardour.h> #include <ardour/io.h> -#include "route_redirect_selection.h" +#include "route_processor_selection.h" #include "enums.h" namespace ARDOUR { diff --git a/gtk2_ardour/pan_automation_time_axis.h b/gtk2_ardour/pan_automation_time_axis.h index c2803c0172..d4a22ebc29 100644 --- a/gtk2_ardour/pan_automation_time_axis.h +++ b/gtk2_ardour/pan_automation_time_axis.h @@ -26,7 +26,7 @@ #include <gtkmm/comboboxtext.h> namespace ARDOUR { - class Redirect; + class IOProcessor; } class PanAutomationTimeAxisView : public AutomationTimeAxisView diff --git a/gtk2_ardour/redirect_automation_line.cc b/gtk2_ardour/plugin_automation_line.cc index 5680a8b98f..3e340123a0 100644 --- a/gtk2_ardour/redirect_automation_line.cc +++ b/gtk2_ardour/plugin_automation_line.cc @@ -18,11 +18,10 @@ */ #include "public_editor.h" -#include "redirect_automation_line.h" +#include "plugin_automation_line.h" #include "audio_time_axis.h" #include "utils.h" -#include <ardour/session.h> #include <ardour/ladspa_plugin.h> #include <ardour/plugin_insert.h> #include <ardour/curve.h> @@ -33,31 +32,27 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -RedirectAutomationLine::RedirectAutomationLine (const string & name, Insert& i, ParamID param, Session& s, - - TimeAxisView& tv, ArdourCanvas::Group& parent, - - AutomationList& l) +ProcessorAutomationLine::ProcessorAutomationLine (const string & name, Processor& proc, ParamID param, + TimeAxisView& tv, ArdourCanvas::Group& parent, AutomationList& l) - : AutomationLine (name, tv, parent, l), - session (s), - _insert (i), - _param (param) + : AutomationLine (name, tv, parent, l), + _processor(proc), + _param(param) { set_verbose_cursor_uses_gain_mapping (false); PluginInsert *pi; Plugin::ParameterDescriptor desc; - if ((pi = dynamic_cast<PluginInsert*>(&_insert)) == 0) { + if ((pi = dynamic_cast<PluginInsert*>(&_processor)) == 0) { fatal << _("insert automation created for non-plugin") << endmsg; /*NOTREACHED*/ } pi->plugin()->get_parameter_descriptor (_param, desc); - upper = desc.upper; - lower = desc.lower; + _upper = desc.upper; + _lower = desc.lower; if (desc.toggled) { no_draw = true; @@ -65,30 +60,30 @@ RedirectAutomationLine::RedirectAutomationLine (const string & name, Insert& i, } no_draw = false; - range = upper - lower; + _range = _upper - _lower; /* XXX set min/max for underlying curve ??? */ } string -RedirectAutomationLine::get_verbose_cursor_string (float fraction) +ProcessorAutomationLine::get_verbose_cursor_string (float fraction) { char buf[32]; - snprintf (buf, sizeof (buf), "%.2f", lower + (fraction * range)); + snprintf (buf, sizeof (buf), "%.2f", _lower + (fraction * _range)); return buf; } void -RedirectAutomationLine::view_to_model_y (double& y) +ProcessorAutomationLine::view_to_model_y (double& y) { - y = lower + (y * range); + y = _lower + (y * _range); } void -RedirectAutomationLine::model_to_view_y (double& y) +ProcessorAutomationLine::model_to_view_y (double& y) { - y = (y - lower) / range; + y = (y - _lower) / _range; y = max (0.0, y); y = min (y, 1.0); } diff --git a/gtk2_ardour/redirect_automation_line.h b/gtk2_ardour/plugin_automation_line.h index d0e3aa8897..3a0a95786b 100644 --- a/gtk2_ardour/redirect_automation_line.h +++ b/gtk2_ardour/plugin_automation_line.h @@ -17,38 +17,37 @@ */ -#ifndef __ardour_gtk_redirect_automation_line_h__ -#define __ardour_gtk_redirect_automation_line_h__ +#ifndef __ardour_gtk_processor_automation_line_h__ +#define __ardour_gtk_processor_automation_line_h__ #include <ardour/ardour.h> #include "automation_line.h" namespace ARDOUR { - class Session; - class Insert; + class Processor; } class TimeAxisView; -class RedirectAutomationLine : public AutomationLine +class ProcessorAutomationLine : public AutomationLine { public: - RedirectAutomationLine (const string & name, ARDOUR::Insert&, ARDOUR::ParamID param, ARDOUR::Session&, TimeAxisView&, - ArdourCanvas::Group& parent, ARDOUR::AutomationList&); + ProcessorAutomationLine (const string & name, ARDOUR::Processor&, ARDOUR::ParamID param, + TimeAxisView&, ArdourCanvas::Group& parent, ARDOUR::AutomationList&); - ARDOUR::ParamID param() const { return _param; } - ARDOUR::Insert& insert() const { return _insert; } + ARDOUR::ParamID param() const { return _param; } + ARDOUR::Processor& processor() const { return _processor; } string get_verbose_cursor_string (float); private: - ARDOUR::Session& session; - ARDOUR::Insert& _insert; - ARDOUR::ParamID _param; - float upper; - float lower; - float range; + ARDOUR::Processor& _processor; + ARDOUR::ParamID _param; + + float _upper; + float _lower; + float _range; void view_to_model_y (double&); void model_to_view_y (double&); diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index e583f11dce..83fdf05444 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -47,7 +47,7 @@ namespace ARDOUR { class PluginInsert; class Plugin; class VSTPlugin; - class Redirect; + class IOProcessor; class AUPlugin; } @@ -184,7 +184,7 @@ class LadspaPluginUI : public PlugUIBase, public Gtk::VBox void control_port_toggled (ControlUI* cui); void control_combo_changed (ControlUI* cui); - void insert_active_changed (boost::weak_ptr<ARDOUR::Insert>); + void processor_active_changed (boost::weak_ptr<ARDOUR::Processor>); void astate_clicked (ControlUI*, uint32_t parameter); void automation_state_changed (ControlUI*); diff --git a/gtk2_ardour/redirect_automation_time_axis.cc b/gtk2_ardour/processor_automation_time_axis.cc index bb7937cdf7..37c996d17e 100644 --- a/gtk2_ardour/redirect_automation_time_axis.cc +++ b/gtk2_ardour/processor_automation_time_axis.cc @@ -17,12 +17,12 @@ */ -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/session.h> #include <cstdlib> #include <pbd/memento_command.h> -#include "redirect_automation_time_axis.h" +#include "processor_automation_time_axis.h" #include "automation_line.h" #include "canvas_impl.h" @@ -32,18 +32,18 @@ using namespace ARDOUR; using namespace PBD; using namespace Gtk; -RedirectAutomationTimeAxisView::RedirectAutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, +ProcessorAutomationTimeAxisView::ProcessorAutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, PublicEditor& e, TimeAxisView& parent, Canvas& canvas, std::string n, - ParamID p, Insert& i, string state_name) + ParamID param, Processor& proc, string state_name) : AxisView (s), - AutomationTimeAxisView (s, r, e, parent, canvas, n, state_name, i.name()), - insert (i), - param (p) + AutomationTimeAxisView (s, r, e, parent, canvas, n, state_name, proc.name()), + _processor(proc), + _param (param) { char buf[32]; - xml_node = 0; + _xml_node = 0; _marked_for_display = false; ensure_xml_node (); @@ -51,7 +51,7 @@ RedirectAutomationTimeAxisView::RedirectAutomationTimeAxisView (Session& s, boos XMLNodeList kids; XMLNodeConstIterator iter; - kids = xml_node->children (); + kids = _xml_node->children (); snprintf (buf, sizeof(buf), "Port_%" PRIu32, param.id()); @@ -68,12 +68,12 @@ RedirectAutomationTimeAxisView::RedirectAutomationTimeAxisView (Session& s, boos } } -RedirectAutomationTimeAxisView::~RedirectAutomationTimeAxisView () +ProcessorAutomationTimeAxisView::~ProcessorAutomationTimeAxisView () { } void -RedirectAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEvent* event, nframes_t when, double y) +ProcessorAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEvent* event, nframes_t when, double y) { double x = 0; @@ -91,9 +91,9 @@ RedirectAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, /* map to model space */ if (!lines.empty()) { - AutomationList* alist (insert.automation_list(param, true)); + AutomationList* alist (_processor.automation_list(_param, true)); string description = _("add automation event to "); - description += insert.describe_parameter (param); + description += _processor.describe_parameter (_param); lines.front()->view_to_model_y (y); @@ -108,18 +108,18 @@ RedirectAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, } void -RedirectAutomationTimeAxisView::ensure_xml_node () +ProcessorAutomationTimeAxisView::ensure_xml_node () { - if (xml_node == 0) { - if ((xml_node = insert.extra_xml ("GUI")) == 0) { - xml_node = new XMLNode ("GUI"); - insert.add_extra_xml (*xml_node); + if (_xml_node == 0) { + if ((_xml_node = _processor.extra_xml ("GUI")) == 0) { + _xml_node = new XMLNode ("GUI"); + _processor.add_extra_xml (*_xml_node); } } } guint32 -RedirectAutomationTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent) +ProcessorAutomationTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent) { ensure_xml_node (); update_extra_xml_shown (true); @@ -128,7 +128,7 @@ RedirectAutomationTimeAxisView::show_at (double y, int& nth, Gtk::VBox *parent) } void -RedirectAutomationTimeAxisView::hide () +ProcessorAutomationTimeAxisView::hide () { ensure_xml_node (); update_extra_xml_shown (false); @@ -138,15 +138,15 @@ RedirectAutomationTimeAxisView::hide () void -RedirectAutomationTimeAxisView::update_extra_xml_shown (bool editor_shown) +ProcessorAutomationTimeAxisView::update_extra_xml_shown (bool editor_shown) { char buf[32]; - XMLNodeList nlist = xml_node->children (); + XMLNodeList nlist = _xml_node->children (); XMLNodeConstIterator i; XMLNode * port_node = 0; - snprintf (buf, sizeof(buf), "Port_%" PRIu32, param.id()); + snprintf (buf, sizeof(buf), "Port_%" PRIu32, _param.id()); for (i = nlist.begin(); i != nlist.end(); ++i) { if ((*i)->name() == buf) { @@ -157,7 +157,7 @@ RedirectAutomationTimeAxisView::update_extra_xml_shown (bool editor_shown) if (!port_node) { port_node = new XMLNode(buf); - xml_node->add_child_nocopy(*port_node); + _xml_node->add_child_nocopy(*port_node); } port_node->add_property ("shown_editor", editor_shown ? "yes": "no"); @@ -165,9 +165,10 @@ RedirectAutomationTimeAxisView::update_extra_xml_shown (bool editor_shown) } void -RedirectAutomationTimeAxisView::set_automation_state (AutoState state) +ProcessorAutomationTimeAxisView::set_automation_state (AutoState state) { if (!ignore_state_request) { - insert.automation_list (param, true)->set_automation_state (state); + _processor.automation_list (_param, true)->set_automation_state (state); } } + diff --git a/gtk2_ardour/redirect_automation_time_axis.h b/gtk2_ardour/processor_automation_time_axis.h index d87e4faca5..ec8caaf98f 100644 --- a/gtk2_ardour/redirect_automation_time_axis.h +++ b/gtk2_ardour/processor_automation_time_axis.h @@ -17,8 +17,8 @@ */ -#ifndef __ardour_gtk_redirect_automation_time_axis_h__ -#define __ardour_gtk_redirect_automation_time_axis_h__ +#ifndef __ardour_gtk_processor_automation_time_axis_h__ +#define __ardour_gtk_processor_automation_time_axis_h__ #include <pbd/xml++.h> @@ -27,23 +27,23 @@ #include <ardour/param_id.h> namespace ARDOUR { - class Redirect; + class Processor; } -class RedirectAutomationTimeAxisView : public AutomationTimeAxisView +class ProcessorAutomationTimeAxisView : public AutomationTimeAxisView { public: - RedirectAutomationTimeAxisView (ARDOUR::Session&, + ProcessorAutomationTimeAxisView (ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, PublicEditor&, TimeAxisView& parent, ArdourCanvas::Canvas& canvas, std::string name, ARDOUR::ParamID param, - ARDOUR::Insert& i, + ARDOUR::Processor& i, std::string state_name); - ~RedirectAutomationTimeAxisView(); + ~ProcessorAutomationTimeAxisView(); void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double); @@ -52,14 +52,14 @@ class RedirectAutomationTimeAxisView : public AutomationTimeAxisView private: - ARDOUR::Insert& insert; - ARDOUR::ParamID param; + ARDOUR::Processor& _processor; + ARDOUR::ParamID _param; + XMLNode* _xml_node; - XMLNode *xml_node; void ensure_xml_node(); void update_extra_xml_shown (bool editor_shown); void set_automation_state (ARDOUR::AutoState); }; -#endif /* __ardour_gtk_redirect_automation_time_axis_h__ */ +#endif /* __ardour_gtk_processor_automation_time_axis_h__ */ diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc new file mode 100644 index 0000000000..d9b0dbd845 --- /dev/null +++ b/gtk2_ardour/processor_box.cc @@ -0,0 +1,1440 @@ +/* + Copyright (C) 2000-2004 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. + +*/ + +#include <cmath> +#include <iostream> + +#include <sigc++/bind.h> + +#include <pbd/convert.h> + +#include <glibmm/miscutils.h> + +#include <gtkmm/messagedialog.h> + +#include <gtkmm2ext/gtk_ui.h> +#include <gtkmm2ext/utils.h> +#include <gtkmm2ext/choice.h> +#include <gtkmm2ext/utils.h> +#include <gtkmm2ext/stop_signal.h> +#include <gtkmm2ext/doi.h> +#include <gtkmm2ext/window_title.h> + +#include <ardour/ardour.h> +#include <ardour/session.h> +#include <ardour/audioengine.h> +#include <ardour/route.h> +#include <ardour/audio_track.h> +#include <ardour/audio_diskstream.h> +#include <ardour/send.h> +#include <ardour/plugin_insert.h> +#include <ardour/port_insert.h> +#include <ardour/ladspa_plugin.h> + +#include "ardour_ui.h" +#include "ardour_dialog.h" +#include "public_editor.h" +#include "processor_box.h" +#include "keyboard.h" +#include "plugin_selector.h" +#include "route_processor_selection.h" +#include "mixer_ui.h" +#include "actions.h" +#include "plugin_ui.h" +#include "send_ui.h" +#include "io_selector.h" +#include "utils.h" +#include "gui_thread.h" + +#include "i18n.h" + +#ifdef HAVE_AUDIOUNIT +#include "au_pluginui.h" +#endif + +using namespace sigc; +using namespace ARDOUR; +using namespace PBD; +using namespace Gtk; +using namespace Glib; +using namespace Gtkmm2ext; + +ProcessorBox* ProcessorBox::_current_processor_box = 0; +RefPtr<Action> ProcessorBox::paste_action; +bool ProcessorBox::get_colors = true; +Gdk::Color* ProcessorBox::active_processor_color; +Gdk::Color* ProcessorBox::inactive_processor_color; + +ProcessorBox::ProcessorBox (Placement pcmnt, Session& sess, boost::shared_ptr<Route> rt, PluginSelector &plugsel, + RouteRedirectSelection & rsel, bool owner_is_mixer) + : _route(rt), + _session(sess), + _owner_is_mixer (owner_is_mixer), + _placement(pcmnt), + _plugin_selector(plugsel), + _rr_selection(rsel) +{ + if (get_colors) { + active_processor_color = new Gdk::Color; + inactive_processor_color = new Gdk::Color; + set_color (*active_processor_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_ACTIVE, false )); + set_color (*inactive_processor_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false )); + get_colors = false; + } + + _width = Wide; + processor_menu = 0; + send_action_menu = 0; + processor_drag_in_progress = false; + no_processor_redisplay = false; + ignore_delete = false; + ab_direction = true; + + model = ListStore::create(columns); + + RefPtr<TreeSelection> selection = processor_display.get_selection(); + selection->set_mode (Gtk::SELECTION_MULTIPLE); + selection->signal_changed().connect (mem_fun (*this, &ProcessorBox::selection_changed)); + + processor_display.set_model (model); + processor_display.append_column (X_("notshown"), columns.text); + processor_display.set_name ("RedirectSelector"); + processor_display.set_headers_visible (false); + processor_display.set_reorderable (true); + processor_display.set_size_request (-1, 40); + processor_display.get_column(0)->set_sizing(TREE_VIEW_COLUMN_FIXED); + processor_display.get_column(0)->set_fixed_width(48); + processor_display.add_object_drag (columns.processor.index(), "redirects"); + processor_display.signal_object_drop.connect (mem_fun (*this, &ProcessorBox::object_drop)); + + TreeViewColumn* name_col = processor_display.get_column(0); + CellRendererText* renderer = dynamic_cast<CellRendererText*>(processor_display.get_column_cell_renderer (0)); + name_col->add_attribute(renderer->property_foreground_gdk(), columns.color); + + processor_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + + model->signal_row_deleted().connect (mem_fun (*this, &ProcessorBox::row_deleted)); + + processor_scroller.add (processor_display); + processor_eventbox.add (processor_scroller); + + processor_scroller.set_size_request (-1, 40); + + pack_start (processor_eventbox, true, true); + + _route->processors_changed.connect (mem_fun(*this, &ProcessorBox::redisplay_processors)); + _route->GoingAway.connect (mem_fun (*this, &ProcessorBox::route_going_away)); + + processor_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (ProcessorBox::enter_box), this)); + + processor_display.signal_button_press_event().connect (mem_fun(*this, &ProcessorBox::processor_button_press_event), false); + processor_display.signal_button_release_event().connect (mem_fun(*this, &ProcessorBox::processor_button_release_event)); + + /* start off as a passthru strip. we'll correct this, if necessary, + in update_diskstream_display(). + */ + + /* now force an update of all the various elements */ + + redisplay_processors (); +} + +ProcessorBox::~ProcessorBox () +{ +} + +void +ProcessorBox::route_going_away () +{ + /* don't keep updating display as processors are deleted */ + no_processor_redisplay = true; +} + +void +ProcessorBox::object_drop (string type, uint32_t cnt, const boost::shared_ptr<Processor>* ptr) +{ + if (type != "redirects" || cnt == 0 || !ptr) { + return; + } + + /* do something with the dropped processors */ + + list<boost::shared_ptr<Processor> > processors; + + for (uint32_t n = 0; n < cnt; ++n) { + processors.push_back (ptr[n]); + } + + paste_processor_list (processors); +} + +void +ProcessorBox::update() +{ + redisplay_processors (); +} + + +void +ProcessorBox::set_width (Width w) +{ + if (_width == w) { + return; + } + _width = w; + + redisplay_processors (); +} + +void +ProcessorBox::remove_processor_gui (boost::shared_ptr<Processor> processor) +{ + boost::shared_ptr<Send> send; + boost::shared_ptr<PortInsert> port_processor; + + if ((port_processor = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) { + PortInsertUI *io_selector = reinterpret_cast<PortInsertUI *> (port_processor->get_gui()); + port_processor->set_gui (0); + delete io_selector; + } else if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) { + SendUIWindow *sui = reinterpret_cast<SendUIWindow*> (send->get_gui()); + send->set_gui (0); + delete sui; + } +} + +void +ProcessorBox::build_send_action_menu () + +{ + using namespace Menu_Helpers; + + send_action_menu = new Menu; + send_action_menu->set_name ("ArdourContextMenu"); + MenuList& items = send_action_menu->items(); + + items.push_back (MenuElem (_("New send"), mem_fun(*this, &ProcessorBox::new_send))); + items.push_back (MenuElem (_("Show send controls"), mem_fun(*this, &ProcessorBox::show_send_controls))); +} + +void +ProcessorBox::show_send_controls () + +{ +} + +void +ProcessorBox::new_send () + +{ +} + +void +ProcessorBox::show_processor_menu (gint arg) +{ + if (processor_menu == 0) { + processor_menu = build_processor_menu (); + } + + paste_action->set_sensitive (!_rr_selection.processors.empty()); + + processor_menu->popup (1, arg); +} + +void +ProcessorBox::processor_drag_begin (GdkDragContext *context) +{ + processor_drag_in_progress = true; +} + +void +ProcessorBox::processor_drag_end (GdkDragContext *context) +{ + processor_drag_in_progress = false; +} + +bool +ProcessorBox::processor_button_press_event (GdkEventButton *ev) +{ + TreeIter iter; + TreeModel::Path path; + TreeViewColumn* column; + int cellx; + int celly; + boost::shared_ptr<Processor> processor; + int ret = false; + bool selected = false; + + if (processor_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { + if ((iter = model->get_iter (path))) { + processor = (*iter)[columns.processor]; + selected = processor_display.get_selection()->is_selected (iter); + } + + } + + if (processor && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS))) { + + if (_session.engine().connected()) { + /* XXX giving an error message here is hard, because we may be in the midst of a button press */ + edit_processor (processor); + } + ret = true; + + } else if (processor && ev->button == 1 && selected) { + + // this is purely informational but necessary + InsertSelected (processor); // emit + } + + return ret; +} + +bool +ProcessorBox::processor_button_release_event (GdkEventButton *ev) +{ + TreeIter iter; + TreeModel::Path path; + TreeViewColumn* column; + int cellx; + int celly; + boost::shared_ptr<Processor> processor; + int ret = false; + + + if (processor_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { + if ((iter = model->get_iter (path))) { + processor = (*iter)[columns.processor]; + } + } + + if (processor && Keyboard::is_delete_event (ev)) { + + Glib::signal_idle().connect (bind (mem_fun(*this, &ProcessorBox::idle_delete_processor), boost::weak_ptr<Processor>(processor))); + ret = true; + + } else if (Keyboard::is_context_menu_event (ev)) { + + show_processor_menu(ev->time); + ret = true; + + } else if (processor && (ev->button == 2) && (ev->state == Gdk::BUTTON2_MASK)) { + + processor->set_active (!processor->active()); + ret = true; + + } + + return ret; +} + +Menu * +ProcessorBox::build_processor_menu () +{ + processor_menu = dynamic_cast<Gtk::Menu*>(ActionManager::get_widget("/redirectmenu") ); + processor_menu->set_name ("ArdourContextMenu"); + + show_all_children(); + + return processor_menu; +} + +void +ProcessorBox::selection_changed () +{ + bool sensitive = (processor_display.get_selection()->count_selected_rows()) ? true : false; + ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive); +} + +void +ProcessorBox::select_all_processors () +{ + processor_display.get_selection()->select_all(); +} + +void +ProcessorBox::deselect_all_processors () +{ + processor_display.get_selection()->unselect_all(); +} + +void +ProcessorBox::choose_plugin () +{ + sigc::connection newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&ProcessorBox::processor_plugin_chosen)); + _plugin_selector.show_all(); + _plugin_selector.run (); + newplug_connection.disconnect(); +} + +void +ProcessorBox::processor_plugin_chosen (boost::shared_ptr<Plugin> plugin) +{ + if (plugin) { + + boost::shared_ptr<Processor> processor (new PluginInsert (_session, plugin, _placement)); + + processor->ActiveChanged.connect (bind (mem_fun (*this, &ProcessorBox::show_processor_active), boost::weak_ptr<Processor>(processor))); + + Route::ProcessorStreams err; + + if (_route->add_processor (processor, &err)) { + weird_plugin_dialog (*plugin, err, _route); + // XXX SHAREDPTR delete plugin here .. do we even need to care? + } + } +} + +void +ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams, boost::shared_ptr<IO> io) +{ + ArdourDialog dialog (_("ardour: weird plugin dialog")); + Label label; + + /* i hate this kind of code */ + + if (streams.count > p.get_info()->n_inputs) { + label.set_text (string_compose (_( +"You attempted to add a plugin (%1).\n" +"The plugin has %2 inputs\n" +"but at the processorion point, there are\n" +"%3 active signal streams.\n" +"\n" +"This makes no sense - you are throwing away\n" +"part of the signal."), + p.name(), + p.get_info()->n_inputs.n_total(), + streams.count.n_total())); + } else if (streams.count < p.get_info()->n_inputs) { + label.set_text (string_compose (_( +"You attempted to add a plugin (%1).\n" +"The plugin has %2 inputs\n" +"but at the processorion point there are\n" +"only %3 active signal streams.\n" +"\n" +"This makes no sense - unless the plugin supports\n" +"side-chain inputs. A future version of Ardour will\n" +"support this type of configuration."), + p.name(), + p.get_info()->n_inputs.n_total(), + streams.count.n_total())); + } else { + label.set_text (string_compose (_( +"You attempted to add a plugin (%1).\n" +"\n" +"The I/O configuration doesn't make sense:\n" +"\n" +"The plugin has %2 inputs and %3 outputs.\n" +"The track/bus has %4 inputs and %5 outputs.\n" +"The processorion point, has %6 active signals.\n" +"\n" +"Ardour does not understand what to do in such situations.\n"), + p.name(), + p.get_info()->n_inputs.n_total(), + p.get_info()->n_outputs.n_total(), + io->n_inputs().n_total(), + io->n_outputs().n_total(), + streams.count.n_total())); + } + + dialog.get_vbox()->pack_start (label); + dialog.add_button (Stock::OK, RESPONSE_ACCEPT); + + dialog.set_name (X_("PluginIODialog")); + dialog.set_position (Gtk::WIN_POS_MOUSE); + dialog.set_modal (true); + dialog.show_all (); + + dialog.run (); +} + +void +ProcessorBox::choose_processor () +{ + boost::shared_ptr<Processor> processor (new PortInsert (_session, _placement)); + processor->ActiveChanged.connect (bind (mem_fun(*this, &ProcessorBox::show_processor_active), boost::weak_ptr<Processor>(processor))); + _route->add_processor (processor); +} + +void +ProcessorBox::choose_send () +{ + boost::shared_ptr<Send> send (new Send (_session, _placement)); + //send->set_default_type(_route->default_type()); + + /* XXX need redirect lock on route */ + + // This will be set properly in route->add_processor + send->configure_io (_route->max_processor_outs(), _route->max_processor_outs()); + + IOSelectorWindow *ios = new IOSelectorWindow (_session, send->io(), false, true); + + ios->show_all (); + + ios->selector().Finished.connect (bind (mem_fun(*this, &ProcessorBox::send_io_finished), send, ios)); +} + +void +ProcessorBox::send_io_finished (IOSelector::Result r, boost::shared_ptr<Send> send, IOSelectorWindow* ios) +{ + if (!send) { + return; + } + + switch (r) { + case IOSelector::Cancelled: + // send will go away when all shared_ptrs to it vanish + break; + + case IOSelector::Accepted: + _route->add_processor (send); + break; + } + + delete_when_idle (ios); +} + +void +ProcessorBox::redisplay_processors () +{ + ENSURE_GUI_THREAD(mem_fun(*this, &ProcessorBox::redisplay_processors)); + + if (no_processor_redisplay) { + return; + } + + ignore_delete = true; + model->clear (); + ignore_delete = false; + + processor_active_connections.clear (); + processor_name_connections.clear (); + + void (ProcessorBox::*pmf)(boost::shared_ptr<Processor>) = &ProcessorBox::add_processor_to_display; + _route->foreach_processor (this, pmf); + + switch (_placement) { + case PreFader: + build_processor_tooltip(processor_eventbox, _("Pre-fader processors, sends & plugins:")); + break; + case PostFader: + build_processor_tooltip(processor_eventbox, _("Post-fader processors, sends & plugins:")); + break; + } +} + +void +ProcessorBox::add_processor_to_display (boost::shared_ptr<Processor> processor) +{ + if (processor->placement() != _placement) { + return; + } + + Gtk::TreeModel::Row row = *(model->append()); + row[columns.text] = processor_name (processor); + row[columns.processor] = processor; + + show_processor_active (processor); + + processor_active_connections.push_back (processor->ActiveChanged.connect (bind (mem_fun(*this, &ProcessorBox::show_processor_active), boost::weak_ptr<Processor>(processor)))); + processor_name_connections.push_back (processor->NameChanged.connect (bind (mem_fun(*this, &ProcessorBox::show_processor_name), boost::weak_ptr<Processor>(processor)))); +} + +string +ProcessorBox::processor_name (boost::weak_ptr<Processor> weak_processor) +{ + boost::shared_ptr<Processor> processor (weak_processor.lock()); + + if (!processor) { + return string(); + } + + boost::shared_ptr<Send> send; + string name_display; + + if (!processor->active()) { + name_display = " ("; + } + + if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) { + + name_display += '>'; + + /* grab the send name out of its overall name */ + + string::size_type lbracket, rbracket; + lbracket = send->name().find ('['); + rbracket = send->name().find (']'); + + switch (_width) { + case Wide: + name_display += send->name().substr (lbracket+1, lbracket-rbracket-1); + break; + case Narrow: + name_display += PBD::short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4); + break; + } + + } else { + + switch (_width) { + case Wide: + name_display += processor->name(); + break; + case Narrow: + name_display += PBD::short_version (processor->name(), 5); + break; + } + + } + + if (!processor->active()) { + name_display += ')'; + } + + return name_display; +} + +void +ProcessorBox::build_processor_tooltip (EventBox& box, string start) +{ + string tip(start); + + Gtk::TreeModel::Children children = model->children(); + for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { + Gtk::TreeModel::Row row = *iter; + tip += '\n'; + + /* don't use the column text, since it may be narrowed */ + + boost::shared_ptr<Processor> i = row[columns.processor]; + tip += i->name(); + } + ARDOUR_UI::instance()->tooltips().set_tip (box, tip); +} + +void +ProcessorBox::show_processor_name (boost::weak_ptr<Processor> processor) +{ + ENSURE_GUI_THREAD(bind (mem_fun(*this, &ProcessorBox::show_processor_name), processor)); + show_processor_active (processor); +} + +void +ProcessorBox::show_processor_active (boost::weak_ptr<Processor> weak_processor) +{ + ENSURE_GUI_THREAD(bind (mem_fun(*this, &ProcessorBox::show_processor_active), weak_processor)); + + boost::shared_ptr<Processor> processor (weak_processor.lock()); + + if (!processor) { + return; + } + + Gtk::TreeModel::Children children = model->children(); + Gtk::TreeModel::Children::iterator iter = children.begin(); + + while (iter != children.end()) { + + boost::shared_ptr<Processor> r = (*iter)[columns.processor]; + + if (r == processor) { + (*iter)[columns.text] = processor_name (r); + + if (processor->active()) { + (*iter)[columns.color] = *active_processor_color; + } else { + (*iter)[columns.color] = *inactive_processor_color; + } + break; + } + + iter++; + } +} + +void +ProcessorBox::row_deleted (const Gtk::TreeModel::Path& path) +{ + if (!ignore_delete) { + compute_processor_sort_keys (); + } +} + +void +ProcessorBox::compute_processor_sort_keys () +{ + uint32_t sort_key = 0; + Gtk::TreeModel::Children children = model->children(); + + for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { + boost::shared_ptr<Processor> i = (*iter)[columns.processor]; + i->set_sort_key (sort_key); + sort_key++; + } + + if (_route->sort_processors ()) { + + redisplay_processors (); + + /* now tell them about the problem */ + + ArdourDialog dialog (_("ardour: weird plugin dialog")); + Label label; + + label.set_text (_("\ +You cannot reorder this set of processors\n\ +in that way because the inputs and\n\ +outputs do not work correctly.")); + + dialog.get_vbox()->pack_start (label); + dialog.add_button (Stock::OK, RESPONSE_ACCEPT); + + dialog.set_name (X_("PluginIODialog")); + dialog.set_position (Gtk::WIN_POS_MOUSE); + dialog.set_modal (true); + dialog.show_all (); + + dialog.run (); + } +} + +void +ProcessorBox::rename_processors () +{ + vector<boost::shared_ptr<Processor> > to_be_renamed; + + get_selected_processors (to_be_renamed); + + if (to_be_renamed.empty()) { + return; + } + + for (vector<boost::shared_ptr<Processor> >::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) { + rename_processor (*i); + } +} + +void +ProcessorBox::cut_processors () +{ + vector<boost::shared_ptr<Processor> > to_be_removed; + + get_selected_processors (to_be_removed); + + if (to_be_removed.empty()) { + return; + } + + /* this essentially transfers ownership of the processor + of the processor from the route to the mixer + selection. + */ + + _rr_selection.set (to_be_removed); + + no_processor_redisplay = true; + for (vector<boost::shared_ptr<Processor> >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) { + // Do not cut processors or sends + if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0) { + void* gui = (*i)->get_gui (); + + if (gui) { + static_cast<Gtk::Widget*>(gui)->hide (); + } + + if (_route->remove_processor (*i)) { + /* removal failed */ + _rr_selection.remove (*i); + } + } else { + _rr_selection.remove (*i); + } + + } + no_processor_redisplay = false; + redisplay_processors (); +} + +void +ProcessorBox::copy_processors () +{ + vector<boost::shared_ptr<Processor> > to_be_copied; + vector<boost::shared_ptr<Processor> > copies; + + get_selected_processors (to_be_copied); + + if (to_be_copied.empty()) { + return; + } + + for (vector<boost::shared_ptr<Processor> >::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) { + // Do not copy processors or sends + if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0) { + copies.push_back (Processor::clone (*i)); + } + } + + _rr_selection.set (copies); + +} + +void +ProcessorBox::delete_processors () +{ + vector<boost::shared_ptr<Processor> > to_be_deleted; + + get_selected_processors (to_be_deleted); + + if (to_be_deleted.empty()) { + return; + } + + for (vector<boost::shared_ptr<Processor> >::iterator i = to_be_deleted.begin(); i != to_be_deleted.end(); ++i) { + + void* gui = (*i)->get_gui (); + + if (gui) { + static_cast<Gtk::Widget*>(gui)->hide (); + } + + _route->remove_processor(*i); + } + + no_processor_redisplay = false; + redisplay_processors (); +} + +gint +ProcessorBox::idle_delete_processor (boost::weak_ptr<Processor> weak_processor) +{ + boost::shared_ptr<Processor> processor (weak_processor.lock()); + + if (!processor) { + return false; + } + + /* NOT copied to _mixer.selection() */ + + no_processor_redisplay = true; + _route->remove_processor (processor); + no_processor_redisplay = false; + redisplay_processors (); + + return false; +} + +void +ProcessorBox::rename_processor (boost::shared_ptr<Processor> processor) +{ + ArdourPrompter name_prompter (true); + string result; + name_prompter.set_prompt (_("rename processor")); + name_prompter.set_initial_text (processor->name()); + name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT); + name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); + name_prompter.show_all (); + + switch (name_prompter.run ()) { + + case Gtk::RESPONSE_ACCEPT: + name_prompter.get_result (result); + if (result.length()) { + processor->set_name (result); + } + break; + } + + return; +} + +void +ProcessorBox::cut_processor (boost::shared_ptr<Processor> processor) +{ + /* this essentially transfers ownership of the processor + of the processor from the route to the mixer + selection. + */ + + _rr_selection.add (processor); + + void* gui = processor->get_gui (); + + if (gui) { + static_cast<Gtk::Widget*>(gui)->hide (); + } + + no_processor_redisplay = true; + if (_route->remove_processor (processor)) { + _rr_selection.remove (processor); + } + no_processor_redisplay = false; + redisplay_processors (); +} + +void +ProcessorBox::copy_processor (boost::shared_ptr<Processor> processor) +{ + boost::shared_ptr<Processor> copy = Processor::clone (processor); + _rr_selection.add (copy); +} + +void +ProcessorBox::paste_processors () +{ + if (_rr_selection.processors.empty()) { + return; + } + + paste_processor_list (_rr_selection.processors); +} + +void +ProcessorBox::paste_processor_list (list<boost::shared_ptr<Processor> >& processors) +{ + list<boost::shared_ptr<Processor> > copies; + + for (list<boost::shared_ptr<Processor> >::iterator i = processors.begin(); i != processors.end(); ++i) { + + boost::shared_ptr<Processor> copy = Processor::clone (*i); + + copy->set_placement (_placement); + copies.push_back (copy); + } + + if (_route->add_processors (copies)) { + + string msg = _( + "Copying the set of processors on the clipboard failed,\n\ +probably because the I/O configuration of the plugins\n\ +could not match the configuration of this track."); + MessageDialog am (msg); + am.run (); + } +} + +void +ProcessorBox::activate_processor (boost::shared_ptr<Processor> r) +{ + r->set_active (true); +} + +void +ProcessorBox::deactivate_processor (boost::shared_ptr<Processor> r) +{ + r->set_active (false); +} + +void +ProcessorBox::get_selected_processors (vector<boost::shared_ptr<Processor> >& processors) +{ + vector<Gtk::TreeModel::Path> pathlist = processor_display.get_selection()->get_selected_rows(); + + for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { + processors.push_back ((*(model->get_iter(*iter)))[columns.processor]); + } +} + +void +ProcessorBox::for_selected_processors (void (ProcessorBox::*pmf)(boost::shared_ptr<Processor>)) +{ + vector<Gtk::TreeModel::Path> pathlist = processor_display.get_selection()->get_selected_rows(); + + for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { + boost::shared_ptr<Processor> processor = (*(model->get_iter(*iter)))[columns.processor]; + (this->*pmf)(processor); + } +} + +void +ProcessorBox::clone_processors () +{ + RouteSelection& routes (_rr_selection.routes); + + if (!routes.empty()) { + if (_route->copy_processors (*routes.front(), _placement)) { + string msg = _( +"Copying the set of processors on the clipboard failed,\n\ +probably because the I/O configuration of the plugins\n\ +could not match the configuration of this track."); + MessageDialog am (msg); + am.run (); + } + } +} + +void +ProcessorBox::all_processors_active (bool state) +{ + _route->all_processors_active (_placement, state); +} + +void +ProcessorBox::all_plugins_active (bool state) +{ + if (state) { + // XXX not implemented + } else { + _route->disable_plugins (_placement); + } +} + +void +ProcessorBox::ab_plugins () +{ + _route->ab_plugins (ab_direction); + ab_direction = !ab_direction; +} + +void +ProcessorBox::clear_processors () +{ + string prompt; + vector<string> choices; + + if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) { + if (_placement == PreFader) { + prompt = _("Do you really want to remove all pre-fader processors from this track?\n" + "(this cannot be undone)"); + } else { + prompt = _("Do you really want to remove all post-fader processors from this track?\n" + "(this cannot be undone)"); + } + } else { + if (_placement == PreFader) { + prompt = _("Do you really want to remove all pre-fader processors from this bus?\n" + "(this cannot be undone)"); + } else { + prompt = _("Do you really want to remove all post-fader processors from this bus?\n" + "(this cannot be undone)"); + } + } + + choices.push_back (_("Cancel")); + choices.push_back (_("Yes, remove them all")); + + Gtkmm2ext::Choice prompter (prompt, choices); + + if (prompter.run () == 1) { + _route->clear_processors (_placement); + } +} + +void +ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor) +{ + boost::shared_ptr<Send> send; + boost::shared_ptr<PluginInsert> plugin_processor; + boost::shared_ptr<PortInsert> port_processor; + + if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) { + + if (boost::dynamic_pointer_cast<AudioTrack> (_route)->freeze_state() == AudioTrack::Frozen) { + return; + } + } + + if ((send = boost::dynamic_pointer_cast<Send> (send)) != 0) { + + if (!_session.engine().connected()) { + return; + } + + SendUIWindow *send_ui; + + if (send->get_gui() == 0) { + + send_ui = new SendUIWindow (send, _session); + + WindowTitle title(Glib::get_application_name()); + title += send->name(); + send_ui->set_title (title.get_string()); + + send->set_gui (send_ui); + + } else { + send_ui = reinterpret_cast<SendUIWindow *> (send->get_gui()); + } + + if (send_ui->is_visible()) { + send_ui->get_window()->raise (); + } else { + send_ui->show_all (); + send_ui->present (); + } + + } else if ((plugin_processor = boost::dynamic_pointer_cast<PluginInsert> (processor)) != 0) { + + ARDOUR::PluginType type = plugin_processor->type(); + + if (type == ARDOUR::LADSPA || type == ARDOUR::VST) { + PluginUIWindow *plugin_ui; + + if (plugin_processor->get_gui() == 0) { + + plugin_ui = new PluginUIWindow (plugin_processor); + + if (_owner_is_mixer) { + ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui); + } else { + ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui); + } + + WindowTitle title(Glib::get_application_name()); + title += generate_processor_title (plugin_processor); + plugin_ui->set_title (title.get_string()); + + plugin_processor->set_gui (plugin_ui); + + // change window title when route name is changed + _route->NameChanged.connect (bind (mem_fun(*this, &ProcessorBox::route_name_changed), plugin_ui, boost::weak_ptr<PluginInsert> (plugin_processor))); + + + } else { + plugin_ui = reinterpret_cast<PluginUIWindow *> (plugin_processor->get_gui()); + } + + if (plugin_ui->is_visible()) { + plugin_ui->get_window()->raise (); + } else { + plugin_ui->show_all (); + plugin_ui->present (); + } +#ifdef HAVE_AUDIOUNIT + } else if (type == ARDOUR::AudioUnit) { + AUPluginUI* plugin_ui; + if (plugin_processor->get_gui() == 0) { + plugin_ui = new AUPluginUI (plugin_processor); + } else { + plugin_ui = reinterpret_cast<AUPluginUI*> (plugin_processor->get_gui()); + } + + if (plugin_ui->is_visible()) { + plugin_ui->get_window()->raise (); + } else { + plugin_ui->show_all (); + plugin_ui->present (); + } +#endif + } else { + warning << "Unsupported plugin sent to ProcessorBox::edit_processor()" << endmsg; + return; + } + + } else if ((port_processor = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) { + + if (!_session.engine().connected()) { + MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible")); + msg.run (); + return; + } + + PortInsertWindow *io_selector; + + if (port_processor->get_gui() == 0) { + io_selector = new PortInsertWindow (_session, port_processor); + port_processor->set_gui (io_selector); + + } else { + io_selector = reinterpret_cast<PortInsertWindow *> (port_processor->get_gui()); + } + + if (io_selector->is_visible()) { + io_selector->get_window()->raise (); + } else { + io_selector->show_all (); + io_selector->present (); + } + } +} + +bool +ProcessorBox::enter_box (GdkEventCrossing *ev, ProcessorBox* rb) +{ + switch (ev->detail) { + case GDK_NOTIFY_INFERIOR: + break; + + case GDK_NOTIFY_VIRTUAL: + /* fallthru */ + + default: + _current_processor_box = rb; + } + + return false; +} + +void +ProcessorBox::register_actions () +{ + Glib::RefPtr<Gtk::ActionGroup> popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu")); + Glib::RefPtr<Action> act; + + /* new stuff */ + ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin ..."), sigc::ptr_fun (ProcessorBox::rb_choose_plugin)); + + act = ActionManager::register_action (popup_act_grp, X_("newprocessor"), _("New Insert"), sigc::ptr_fun (ProcessorBox::rb_choose_processor)); + ActionManager::jack_sensitive_actions.push_back (act); + act = ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."), sigc::ptr_fun (ProcessorBox::rb_choose_send)); + ActionManager::jack_sensitive_actions.push_back (act); + + ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear"), sigc::ptr_fun (ProcessorBox::rb_clear)); + + /* standard editing stuff */ + act = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"), sigc::ptr_fun (ProcessorBox::rb_cut)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (ProcessorBox::rb_copy)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + + act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"), sigc::ptr_fun (ProcessorBox::rb_delete)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); // ?? + + paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (ProcessorBox::rb_paste)); + act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (ProcessorBox::rb_rename)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), sigc::ptr_fun (ProcessorBox::rb_select_all)); + ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), sigc::ptr_fun (ProcessorBox::rb_deselect_all)); + + /* activation */ + act = ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), sigc::ptr_fun (ProcessorBox::rb_activate)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + act = ActionManager::register_action (popup_act_grp, X_("deactivate"), _("Deactivate"), sigc::ptr_fun (ProcessorBox::rb_deactivate)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"), sigc::ptr_fun (ProcessorBox::rb_activate_all)); + ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"), sigc::ptr_fun (ProcessorBox::rb_deactivate_all)); + + ActionManager::register_action (popup_act_grp, X_("a_b_plugins"), _("A/B plugins"), sigc::ptr_fun (ProcessorBox::rb_ab_plugins)); + ActionManager::register_action (popup_act_grp, X_("deactivate_plugins"), _("Deactivate plugins"), sigc::ptr_fun (ProcessorBox::rb_deactivate_plugins)); + + /* show editors */ + act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), sigc::ptr_fun (ProcessorBox::rb_edit)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + + ActionManager::add_action_group (popup_act_grp); + + +} + +void +ProcessorBox::rb_choose_plugin () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->choose_plugin (); +} + +void +ProcessorBox::rb_choose_processor () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->choose_processor (); +} + +void +ProcessorBox::rb_choose_send () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->choose_send (); +} + +void +ProcessorBox::rb_clear () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->clear_processors (); +} + +void +ProcessorBox::rb_cut () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->cut_processors (); +} + +void +ProcessorBox::rb_delete () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->delete_processors (); +} + +void +ProcessorBox::rb_copy () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->copy_processors (); +} + +void +ProcessorBox::rb_paste () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->paste_processors (); +} + +void +ProcessorBox::rb_rename () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->rename_processors (); +} + +void +ProcessorBox::rb_select_all () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->select_all_processors (); +} + +void +ProcessorBox::rb_deselect_all () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->deselect_all_processors (); +} + +void +ProcessorBox::rb_activate () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->for_selected_processors (&ProcessorBox::activate_processor); +} + +void +ProcessorBox::rb_deactivate () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->for_selected_processors (&ProcessorBox::deactivate_processor); +} + +void +ProcessorBox::rb_activate_all () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->all_processors_active (true); +} + +void +ProcessorBox::rb_deactivate_all () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->all_processors_active (false); +} + +void +ProcessorBox::rb_deactivate_plugins () +{ + if (_current_processor_box == 0) { + return; + } + _current_processor_box->all_plugins_active (false); +} + + +void +ProcessorBox::rb_ab_plugins () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->ab_plugins (); +} + + +void +ProcessorBox::rb_edit () +{ + if (_current_processor_box == 0) { + return; + } + + _current_processor_box->for_selected_processors (&ProcessorBox::edit_processor); +} + +void +ProcessorBox::route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr<PluginInsert> wpi) +{ + ENSURE_GUI_THREAD(bind (mem_fun (*this, &ProcessorBox::route_name_changed), plugin_ui, wpi)); + boost::shared_ptr<PluginInsert> pi (wpi.lock()); + + + if (pi) { + WindowTitle title(Glib::get_application_name()); + title += generate_processor_title (pi); + plugin_ui->set_title (title.get_string()); + } +} + +string +ProcessorBox::generate_processor_title (boost::shared_ptr<PluginInsert> pi) +{ + string maker = pi->plugin()->maker(); + string::size_type email_pos; + + if ((email_pos = maker.find_first_of ('<')) != string::npos) { + maker = maker.substr (0, email_pos - 1); + } + + if (maker.length() > 32) { + maker = maker.substr (0, 32); + maker += " ..."; + } + + return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker); +} + diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h new file mode 100644 index 0000000000..11a3b91fd0 --- /dev/null +++ b/gtk2_ardour/processor_box.h @@ -0,0 +1,229 @@ +/* + Copyright (C) 2004 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. + +*/ + +#ifndef __ardour_gtk_processor_box__ +#define __ardour_gtk_processor_box__ + +#include <vector> + +#include <cmath> +#include <gtkmm/box.h> +#include <gtkmm/eventbox.h> +#include <gtkmm/menu.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm2ext/dndtreeview.h> +#include <gtkmm2ext/auto_spin.h> +#include <gtkmm2ext/click_box.h> +#include <gtkmm2ext/dndtreeview.h> + +#include <pbd/stateful.h> + +#include <ardour/types.h> +#include <ardour/ardour.h> +#include <ardour/io.h> +#include <ardour/processor.h> +#include <ardour/io_processor.h> + +#include <pbd/fastlog.h> + +#include "route_ui.h" +#include "io_selector.h" +#include "enums.h" + +class MotionController; +class PluginSelector; +class PluginUIWindow; +class RouteRedirectSelection; + +namespace ARDOUR { + class Bundle; + class Processor; + class Plugin; + class PluginInsert; + class PortInsert; + class Route; + class Send; + class Session; +} + + +class ProcessorBox : public Gtk::HBox +{ + public: + ProcessorBox (ARDOUR::Placement, ARDOUR::Session&, + boost::shared_ptr<ARDOUR::Route>, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false); + ~ProcessorBox (); + + void set_width (Width); + + void update(); + + void select_all_processors (); + void deselect_all_processors (); + void select_all_plugins (); + void select_all_sends (); + + sigc::signal<void,boost::shared_ptr<ARDOUR::Processor> > InsertSelected; + sigc::signal<void,boost::shared_ptr<ARDOUR::Processor> > InsertUnselected; + + static void register_actions(); + + protected: + void set_stuff_from_route (); + + private: + boost::shared_ptr<ARDOUR::Route> _route; + ARDOUR::Session & _session; + bool _owner_is_mixer; + bool ab_direction; + + ARDOUR::Placement _placement; + + PluginSelector & _plugin_selector; + RouteRedirectSelection & _rr_selection; + + void route_going_away (); + + struct ModelColumns : public Gtk::TreeModel::ColumnRecord { + ModelColumns () { + add (text); + add (processor); + add (color); + } + Gtk::TreeModelColumn<std::string> text; + Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Processor> > processor; + Gtk::TreeModelColumn<Gdk::Color> color; + }; + + ModelColumns columns; + Glib::RefPtr<Gtk::ListStore> model; + + void selection_changed (); + + static bool get_colors; + static Gdk::Color* active_processor_color; + static Gdk::Color* inactive_processor_color; + + Gtk::EventBox processor_eventbox; + Gtk::HBox processor_hpacker; + Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Processor> > processor_display; + Gtk::ScrolledWindow processor_scroller; + + void object_drop (std::string type, uint32_t cnt, const boost::shared_ptr<ARDOUR::Processor>*); + + Width _width; + + Gtk::Menu *send_action_menu; + void build_send_action_menu (); + + void new_send (); + void show_send_controls (); + + Gtk::Menu *processor_menu; + gint processor_menu_map_handler (GdkEventAny *ev); + Gtk::Menu * build_processor_menu (); + void build_processor_tooltip (Gtk::EventBox&, string); + void show_processor_menu (gint arg); + + void choose_send (); + void send_io_finished (IOSelector::Result, boost::shared_ptr<ARDOUR::Send>, IOSelectorWindow*); + void choose_processor (); + void choose_plugin (); + void processor_plugin_chosen (boost::shared_ptr<ARDOUR::Plugin>); + + bool no_processor_redisplay; + bool ignore_delete; + + bool processor_button_press_event (GdkEventButton *); + bool processor_button_release_event (GdkEventButton *); + void redisplay_processors (); + void add_processor_to_display (boost::shared_ptr<ARDOUR::Processor>); + void row_deleted (const Gtk::TreeModel::Path& path); + void show_processor_active (boost::weak_ptr<ARDOUR::Processor>); + void show_processor_name (boost::weak_ptr<ARDOUR::Processor>); + string processor_name (boost::weak_ptr<ARDOUR::Processor>); + + void remove_processor_gui (boost::shared_ptr<ARDOUR::Processor>); + + void processors_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); + void compute_processor_sort_keys (); + vector<sigc::connection> processor_active_connections; + vector<sigc::connection> processor_name_connections; + + bool processor_drag_in_progress; + void processor_drag_begin (GdkDragContext*); + void processor_drag_end (GdkDragContext*); + void all_processors_active(bool state); + void all_plugins_active(bool state); + void ab_plugins (); + + void cut_processors (); + void copy_processors (); + void paste_processors (); + void delete_processors (); + void clear_processors (); + void clone_processors (); + void rename_processors (); + + void for_selected_processors (void (ProcessorBox::*pmf)(boost::shared_ptr<ARDOUR::Processor>)); + void get_selected_processors (vector<boost::shared_ptr<ARDOUR::Processor> >&); + + static Glib::RefPtr<Gtk::Action> paste_action; + void paste_processor_list (std::list<boost::shared_ptr<ARDOUR::Processor> >& processors); + + void activate_processor (boost::shared_ptr<ARDOUR::Processor>); + void deactivate_processor (boost::shared_ptr<ARDOUR::Processor>); + void cut_processor (boost::shared_ptr<ARDOUR::Processor>); + void copy_processor (boost::shared_ptr<ARDOUR::Processor>); + void edit_processor (boost::shared_ptr<ARDOUR::Processor>); + void hide_processor_editor (boost::shared_ptr<ARDOUR::Processor>); + void rename_processor (boost::shared_ptr<ARDOUR::Processor>); + + gint idle_delete_processor (boost::weak_ptr<ARDOUR::Processor>); + + void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::ProcessorStreams streams, boost::shared_ptr<ARDOUR::IO> io); + + static ProcessorBox* _current_processor_box; + static bool enter_box (GdkEventCrossing*, ProcessorBox*); + static bool leave_box (GdkEventCrossing*, ProcessorBox*); + + static void rb_choose_plugin (); + static void rb_choose_processor (); + static void rb_choose_send (); + static void rb_clear (); + static void rb_cut (); + static void rb_copy (); + static void rb_paste (); + static void rb_delete (); + static void rb_rename (); + static void rb_select_all (); + static void rb_deselect_all (); + static void rb_activate (); + static void rb_deactivate (); + static void rb_activate_all (); + static void rb_deactivate_all (); + static void rb_edit (); + static void rb_ab_plugins (); + static void rb_deactivate_plugins (); + + void route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr<ARDOUR::PluginInsert> pi); + std::string generate_processor_title (boost::shared_ptr<ARDOUR::PluginInsert> pi); +}; + +#endif /* __ardour_gtk_processor_box__ */ diff --git a/gtk2_ardour/redirect_selection.h b/gtk2_ardour/processor_selection.h index 0b3e0b2983..e9abcea2dc 100644 --- a/gtk2_ardour/redirect_selection.h +++ b/gtk2_ardour/processor_selection.h @@ -17,16 +17,16 @@ */ -#ifndef __ardour_gtk_redirect_selection_h__ -#define __ardour_gtk_redirect_selection_h__ +#ifndef __ardour_gtk_processor_selection_h__ +#define __ardour_gtk_processor_selection_h__ #include <list> #include <boost/shared_ptr.hpp> namespace ARDOUR { - class Insert; + class Processor; } -struct InsertSelection : list<boost::shared_ptr<ARDOUR::Insert> > {}; +struct ProcessorSelection : list<boost::shared_ptr<ARDOUR::Processor> > {}; -#endif /* __ardour_gtk_redirect_selection_h__ */ +#endif /* __ardour_gtk_processor_selection_h__ */ diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc deleted file mode 100644 index 0402b0e1f6..0000000000 --- a/gtk2_ardour/redirect_box.cc +++ /dev/null @@ -1,1440 +0,0 @@ -/* - Copyright (C) 2000-2004 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. - -*/ - -#include <cmath> -#include <iostream> - -#include <sigc++/bind.h> - -#include <pbd/convert.h> - -#include <glibmm/miscutils.h> - -#include <gtkmm/messagedialog.h> - -#include <gtkmm2ext/gtk_ui.h> -#include <gtkmm2ext/utils.h> -#include <gtkmm2ext/choice.h> -#include <gtkmm2ext/utils.h> -#include <gtkmm2ext/stop_signal.h> -#include <gtkmm2ext/doi.h> -#include <gtkmm2ext/window_title.h> - -#include <ardour/ardour.h> -#include <ardour/session.h> -#include <ardour/audioengine.h> -#include <ardour/route.h> -#include <ardour/audio_track.h> -#include <ardour/audio_diskstream.h> -#include <ardour/send.h> -#include <ardour/plugin_insert.h> -#include <ardour/port_insert.h> -#include <ardour/ladspa_plugin.h> - -#include "ardour_ui.h" -#include "ardour_dialog.h" -#include "public_editor.h" -#include "redirect_box.h" -#include "keyboard.h" -#include "plugin_selector.h" -#include "route_redirect_selection.h" -#include "mixer_ui.h" -#include "actions.h" -#include "plugin_ui.h" -#include "send_ui.h" -#include "io_selector.h" -#include "utils.h" -#include "gui_thread.h" - -#include "i18n.h" - -#ifdef HAVE_AUDIOUNIT -#include "au_pluginui.h" -#endif - -using namespace sigc; -using namespace ARDOUR; -using namespace PBD; -using namespace Gtk; -using namespace Glib; -using namespace Gtkmm2ext; - -RedirectBox* RedirectBox::_current_insert_box = 0; -RefPtr<Action> RedirectBox::paste_action; -bool RedirectBox::get_colors = true; -Gdk::Color* RedirectBox::active_insert_color; -Gdk::Color* RedirectBox::inactive_insert_color; - -RedirectBox::RedirectBox (Placement pcmnt, Session& sess, boost::shared_ptr<Route> rt, PluginSelector &plugsel, - RouteRedirectSelection & rsel, bool owner_is_mixer) - : _route(rt), - _session(sess), - _owner_is_mixer (owner_is_mixer), - _placement(pcmnt), - _plugin_selector(plugsel), - _rr_selection(rsel) -{ - if (get_colors) { - active_insert_color = new Gdk::Color; - inactive_insert_color = new Gdk::Color; - set_color (*active_insert_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_ACTIVE, false )); - set_color (*inactive_insert_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false )); - get_colors = false; - } - - _width = Wide; - insert_menu = 0; - send_action_menu = 0; - insert_drag_in_progress = false; - no_insert_redisplay = false; - ignore_delete = false; - ab_direction = true; - - model = ListStore::create(columns); - - RefPtr<TreeSelection> selection = insert_display.get_selection(); - selection->set_mode (Gtk::SELECTION_MULTIPLE); - selection->signal_changed().connect (mem_fun (*this, &RedirectBox::selection_changed)); - - insert_display.set_model (model); - insert_display.append_column (X_("notshown"), columns.text); - insert_display.set_name ("RedirectSelector"); - insert_display.set_headers_visible (false); - insert_display.set_reorderable (true); - insert_display.set_size_request (-1, 40); - insert_display.get_column(0)->set_sizing(TREE_VIEW_COLUMN_FIXED); - insert_display.get_column(0)->set_fixed_width(48); - insert_display.add_object_drag (columns.insert.index(), "redirects"); - insert_display.signal_object_drop.connect (mem_fun (*this, &RedirectBox::object_drop)); - - TreeViewColumn* name_col = insert_display.get_column(0); - CellRendererText* renderer = dynamic_cast<CellRendererText*>(insert_display.get_column_cell_renderer (0)); - name_col->add_attribute(renderer->property_foreground_gdk(), columns.color); - - insert_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); - - model->signal_row_deleted().connect (mem_fun (*this, &RedirectBox::row_deleted)); - - insert_scroller.add (insert_display); - insert_eventbox.add (insert_scroller); - - insert_scroller.set_size_request (-1, 40); - - pack_start (insert_eventbox, true, true); - - _route->inserts_changed.connect (mem_fun(*this, &RedirectBox::redisplay_inserts)); - _route->GoingAway.connect (mem_fun (*this, &RedirectBox::route_going_away)); - - insert_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::enter_box), this)); - - insert_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::insert_button_press_event), false); - insert_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::insert_button_release_event)); - - /* start off as a passthru strip. we'll correct this, if necessary, - in update_diskstream_display(). - */ - - /* now force an update of all the various elements */ - - redisplay_inserts (); -} - -RedirectBox::~RedirectBox () -{ -} - -void -RedirectBox::route_going_away () -{ - /* don't keep updating display as inserts are deleted */ - no_insert_redisplay = true; -} - -void -RedirectBox::object_drop (string type, uint32_t cnt, const boost::shared_ptr<Insert>* ptr) -{ - if (type != "redirects" || cnt == 0 || !ptr) { - return; - } - - /* do something with the dropped inserts */ - - list<boost::shared_ptr<Insert> > inserts; - - for (uint32_t n = 0; n < cnt; ++n) { - inserts.push_back (ptr[n]); - } - - paste_insert_list (inserts); -} - -void -RedirectBox::update() -{ - redisplay_inserts (); -} - - -void -RedirectBox::set_width (Width w) -{ - if (_width == w) { - return; - } - _width = w; - - redisplay_inserts (); -} - -void -RedirectBox::remove_insert_gui (boost::shared_ptr<Insert> insert) -{ - boost::shared_ptr<Send> send; - boost::shared_ptr<PortInsert> port_insert; - - if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (insert)) != 0) { - PortInsertUI *io_selector = reinterpret_cast<PortInsertUI *> (port_insert->get_gui()); - port_insert->set_gui (0); - delete io_selector; - } else if ((send = boost::dynamic_pointer_cast<Send> (insert)) != 0) { - SendUIWindow *sui = reinterpret_cast<SendUIWindow*> (send->get_gui()); - send->set_gui (0); - delete sui; - } -} - -void -RedirectBox::build_send_action_menu () - -{ - using namespace Menu_Helpers; - - send_action_menu = new Menu; - send_action_menu->set_name ("ArdourContextMenu"); - MenuList& items = send_action_menu->items(); - - items.push_back (MenuElem (_("New send"), mem_fun(*this, &RedirectBox::new_send))); - items.push_back (MenuElem (_("Show send controls"), mem_fun(*this, &RedirectBox::show_send_controls))); -} - -void -RedirectBox::show_send_controls () - -{ -} - -void -RedirectBox::new_send () - -{ -} - -void -RedirectBox::show_insert_menu (gint arg) -{ - if (insert_menu == 0) { - insert_menu = build_insert_menu (); - } - - paste_action->set_sensitive (!_rr_selection.inserts.empty()); - - insert_menu->popup (1, arg); -} - -void -RedirectBox::insert_drag_begin (GdkDragContext *context) -{ - insert_drag_in_progress = true; -} - -void -RedirectBox::insert_drag_end (GdkDragContext *context) -{ - insert_drag_in_progress = false; -} - -bool -RedirectBox::insert_button_press_event (GdkEventButton *ev) -{ - TreeIter iter; - TreeModel::Path path; - TreeViewColumn* column; - int cellx; - int celly; - boost::shared_ptr<Insert> insert; - int ret = false; - bool selected = false; - - if (insert_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { - if ((iter = model->get_iter (path))) { - insert = (*iter)[columns.insert]; - selected = insert_display.get_selection()->is_selected (iter); - } - - } - - if (insert && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS))) { - - if (_session.engine().connected()) { - /* XXX giving an error message here is hard, because we may be in the midst of a button press */ - edit_insert (insert); - } - ret = true; - - } else if (insert && ev->button == 1 && selected) { - - // this is purely informational but necessary - InsertSelected (insert); // emit - } - - return ret; -} - -bool -RedirectBox::insert_button_release_event (GdkEventButton *ev) -{ - TreeIter iter; - TreeModel::Path path; - TreeViewColumn* column; - int cellx; - int celly; - boost::shared_ptr<Insert> insert; - int ret = false; - - - if (insert_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { - if ((iter = model->get_iter (path))) { - insert = (*iter)[columns.insert]; - } - } - - if (insert && Keyboard::is_delete_event (ev)) { - - Glib::signal_idle().connect (bind (mem_fun(*this, &RedirectBox::idle_delete_insert), boost::weak_ptr<Insert>(insert))); - ret = true; - - } else if (Keyboard::is_context_menu_event (ev)) { - - show_insert_menu(ev->time); - ret = true; - - } else if (insert && (ev->button == 2) && (ev->state == Gdk::BUTTON2_MASK)) { - - insert->set_active (!insert->active()); - ret = true; - - } - - return ret; -} - -Menu * -RedirectBox::build_insert_menu () -{ - insert_menu = dynamic_cast<Gtk::Menu*>(ActionManager::get_widget("/redirectmenu") ); - insert_menu->set_name ("ArdourContextMenu"); - - show_all_children(); - - return insert_menu; -} - -void -RedirectBox::selection_changed () -{ - bool sensitive = (insert_display.get_selection()->count_selected_rows()) ? true : false; - ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive); -} - -void -RedirectBox::select_all_inserts () -{ - insert_display.get_selection()->select_all(); -} - -void -RedirectBox::deselect_all_inserts () -{ - insert_display.get_selection()->unselect_all(); -} - -void -RedirectBox::choose_plugin () -{ - sigc::connection newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&RedirectBox::insert_plugin_chosen)); - _plugin_selector.show_all(); - _plugin_selector.run (); - newplug_connection.disconnect(); -} - -void -RedirectBox::insert_plugin_chosen (boost::shared_ptr<Plugin> plugin) -{ - if (plugin) { - - boost::shared_ptr<Insert> insert (new PluginInsert (_session, plugin, _placement)); - - insert->ActiveChanged.connect (bind (mem_fun (*this, &RedirectBox::show_insert_active), boost::weak_ptr<Insert>(insert))); - - Route::InsertStreams err; - - if (_route->add_insert (insert, &err)) { - weird_plugin_dialog (*plugin, err, _route); - // XXX SHAREDPTR delete plugin here .. do we even need to care? - } - } -} - -void -RedirectBox::weird_plugin_dialog (Plugin& p, Route::InsertStreams streams, boost::shared_ptr<IO> io) -{ - ArdourDialog dialog (_("ardour: weird plugin dialog")); - Label label; - - /* i hate this kind of code */ - - if (streams.count > p.get_info()->n_inputs) { - label.set_text (string_compose (_( -"You attempted to add a plugin (%1).\n" -"The plugin has %2 inputs\n" -"but at the insertion point, there are\n" -"%3 active signal streams.\n" -"\n" -"This makes no sense - you are throwing away\n" -"part of the signal."), - p.name(), - p.get_info()->n_inputs.n_total(), - streams.count.n_total())); - } else if (streams.count < p.get_info()->n_inputs) { - label.set_text (string_compose (_( -"You attempted to add a plugin (%1).\n" -"The plugin has %2 inputs\n" -"but at the insertion point there are\n" -"only %3 active signal streams.\n" -"\n" -"This makes no sense - unless the plugin supports\n" -"side-chain inputs. A future version of Ardour will\n" -"support this type of configuration."), - p.name(), - p.get_info()->n_inputs.n_total(), - streams.count.n_total())); - } else { - label.set_text (string_compose (_( -"You attempted to add a plugin (%1).\n" -"\n" -"The I/O configuration doesn't make sense:\n" -"\n" -"The plugin has %2 inputs and %3 outputs.\n" -"The track/bus has %4 inputs and %5 outputs.\n" -"The insertion point, has %6 active signals.\n" -"\n" -"Ardour does not understand what to do in such situations.\n"), - p.name(), - p.get_info()->n_inputs.n_total(), - p.get_info()->n_outputs.n_total(), - io->n_inputs().n_total(), - io->n_outputs().n_total(), - streams.count.n_total())); - } - - dialog.get_vbox()->pack_start (label); - dialog.add_button (Stock::OK, RESPONSE_ACCEPT); - - dialog.set_name (X_("PluginIODialog")); - dialog.set_position (Gtk::WIN_POS_MOUSE); - dialog.set_modal (true); - dialog.show_all (); - - dialog.run (); -} - -void -RedirectBox::choose_insert () -{ - boost::shared_ptr<Insert> insert (new PortInsert (_session, _placement)); - insert->ActiveChanged.connect (bind (mem_fun(*this, &RedirectBox::show_insert_active), boost::weak_ptr<Insert>(insert))); - _route->add_insert (insert); -} - -void -RedirectBox::choose_send () -{ - boost::shared_ptr<Send> send (new Send (_session, _placement)); - //send->set_default_type(_route->default_type()); - - /* XXX need redirect lock on route */ - - // This will be set properly in route->add_insert - send->configure_io (_route->max_insert_outs(), _route->max_insert_outs()); - - IOSelectorWindow *ios = new IOSelectorWindow (_session, send->io(), false, true); - - ios->show_all (); - - ios->selector().Finished.connect (bind (mem_fun(*this, &RedirectBox::send_io_finished), send, ios)); -} - -void -RedirectBox::send_io_finished (IOSelector::Result r, boost::shared_ptr<Send> send, IOSelectorWindow* ios) -{ - if (!send) { - return; - } - - switch (r) { - case IOSelector::Cancelled: - // send will go away when all shared_ptrs to it vanish - break; - - case IOSelector::Accepted: - _route->add_insert (send); - break; - } - - delete_when_idle (ios); -} - -void -RedirectBox::redisplay_inserts () -{ - ENSURE_GUI_THREAD(mem_fun(*this, &RedirectBox::redisplay_inserts)); - - if (no_insert_redisplay) { - return; - } - - ignore_delete = true; - model->clear (); - ignore_delete = false; - - insert_active_connections.clear (); - insert_name_connections.clear (); - - void (RedirectBox::*pmf)(boost::shared_ptr<Insert>) = &RedirectBox::add_insert_to_display; - _route->foreach_insert (this, pmf); - - switch (_placement) { - case PreFader: - build_insert_tooltip(insert_eventbox, _("Pre-fader inserts, sends & plugins:")); - break; - case PostFader: - build_insert_tooltip(insert_eventbox, _("Post-fader inserts, sends & plugins:")); - break; - } -} - -void -RedirectBox::add_insert_to_display (boost::shared_ptr<Insert> insert) -{ - if (insert->placement() != _placement) { - return; - } - - Gtk::TreeModel::Row row = *(model->append()); - row[columns.text] = insert_name (insert); - row[columns.insert] = insert; - - show_insert_active (insert); - - insert_active_connections.push_back (insert->ActiveChanged.connect (bind (mem_fun(*this, &RedirectBox::show_insert_active), boost::weak_ptr<Insert>(insert)))); - insert_name_connections.push_back (insert->NameChanged.connect (bind (mem_fun(*this, &RedirectBox::show_insert_name), boost::weak_ptr<Insert>(insert)))); -} - -string -RedirectBox::insert_name (boost::weak_ptr<Insert> weak_insert) -{ - boost::shared_ptr<Insert> insert (weak_insert.lock()); - - if (!insert) { - return string(); - } - - boost::shared_ptr<Send> send; - string name_display; - - if (!insert->active()) { - name_display = " ("; - } - - if ((send = boost::dynamic_pointer_cast<Send> (insert)) != 0) { - - name_display += '>'; - - /* grab the send name out of its overall name */ - - string::size_type lbracket, rbracket; - lbracket = send->name().find ('['); - rbracket = send->name().find (']'); - - switch (_width) { - case Wide: - name_display += send->name().substr (lbracket+1, lbracket-rbracket-1); - break; - case Narrow: - name_display += PBD::short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4); - break; - } - - } else { - - switch (_width) { - case Wide: - name_display += insert->name(); - break; - case Narrow: - name_display += PBD::short_version (insert->name(), 5); - break; - } - - } - - if (!insert->active()) { - name_display += ')'; - } - - return name_display; -} - -void -RedirectBox::build_insert_tooltip (EventBox& box, string start) -{ - string tip(start); - - Gtk::TreeModel::Children children = model->children(); - for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { - Gtk::TreeModel::Row row = *iter; - tip += '\n'; - - /* don't use the column text, since it may be narrowed */ - - boost::shared_ptr<Insert> i = row[columns.insert]; - tip += i->name(); - } - ARDOUR_UI::instance()->tooltips().set_tip (box, tip); -} - -void -RedirectBox::show_insert_name (boost::weak_ptr<Insert> insert) -{ - ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_insert_name), insert)); - show_insert_active (insert); -} - -void -RedirectBox::show_insert_active (boost::weak_ptr<Insert> weak_insert) -{ - ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_insert_active), weak_insert)); - - boost::shared_ptr<Insert> insert (weak_insert.lock()); - - if (!insert) { - return; - } - - Gtk::TreeModel::Children children = model->children(); - Gtk::TreeModel::Children::iterator iter = children.begin(); - - while (iter != children.end()) { - - boost::shared_ptr<Insert> r = (*iter)[columns.insert]; - - if (r == insert) { - (*iter)[columns.text] = insert_name (r); - - if (insert->active()) { - (*iter)[columns.color] = *active_insert_color; - } else { - (*iter)[columns.color] = *inactive_insert_color; - } - break; - } - - iter++; - } -} - -void -RedirectBox::row_deleted (const Gtk::TreeModel::Path& path) -{ - if (!ignore_delete) { - compute_insert_sort_keys (); - } -} - -void -RedirectBox::compute_insert_sort_keys () -{ - uint32_t sort_key = 0; - Gtk::TreeModel::Children children = model->children(); - - for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { - boost::shared_ptr<Insert> i = (*iter)[columns.insert]; - i->set_sort_key (sort_key); - sort_key++; - } - - if (_route->sort_inserts ()) { - - redisplay_inserts (); - - /* now tell them about the problem */ - - ArdourDialog dialog (_("ardour: weird plugin dialog")); - Label label; - - label.set_text (_("\ -You cannot reorder this set of inserts\n\ -in that way because the inputs and\n\ -outputs do not work correctly.")); - - dialog.get_vbox()->pack_start (label); - dialog.add_button (Stock::OK, RESPONSE_ACCEPT); - - dialog.set_name (X_("PluginIODialog")); - dialog.set_position (Gtk::WIN_POS_MOUSE); - dialog.set_modal (true); - dialog.show_all (); - - dialog.run (); - } -} - -void -RedirectBox::rename_inserts () -{ - vector<boost::shared_ptr<Insert> > to_be_renamed; - - get_selected_inserts (to_be_renamed); - - if (to_be_renamed.empty()) { - return; - } - - for (vector<boost::shared_ptr<Insert> >::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) { - rename_insert (*i); - } -} - -void -RedirectBox::cut_inserts () -{ - vector<boost::shared_ptr<Insert> > to_be_removed; - - get_selected_inserts (to_be_removed); - - if (to_be_removed.empty()) { - return; - } - - /* this essentially transfers ownership of the insert - of the insert from the route to the mixer - selection. - */ - - _rr_selection.set (to_be_removed); - - no_insert_redisplay = true; - for (vector<boost::shared_ptr<Insert> >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) { - // Do not cut inserts or sends - if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0) { - void* gui = (*i)->get_gui (); - - if (gui) { - static_cast<Gtk::Widget*>(gui)->hide (); - } - - if (_route->remove_insert (*i)) { - /* removal failed */ - _rr_selection.remove (*i); - } - } else { - _rr_selection.remove (*i); - } - - } - no_insert_redisplay = false; - redisplay_inserts (); -} - -void -RedirectBox::copy_inserts () -{ - vector<boost::shared_ptr<Insert> > to_be_copied; - vector<boost::shared_ptr<Insert> > copies; - - get_selected_inserts (to_be_copied); - - if (to_be_copied.empty()) { - return; - } - - for (vector<boost::shared_ptr<Insert> >::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) { - // Do not copy inserts or sends - if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0) { - copies.push_back (Insert::clone (*i)); - } - } - - _rr_selection.set (copies); - -} - -void -RedirectBox::delete_inserts () -{ - vector<boost::shared_ptr<Insert> > to_be_deleted; - - get_selected_inserts (to_be_deleted); - - if (to_be_deleted.empty()) { - return; - } - - for (vector<boost::shared_ptr<Insert> >::iterator i = to_be_deleted.begin(); i != to_be_deleted.end(); ++i) { - - void* gui = (*i)->get_gui (); - - if (gui) { - static_cast<Gtk::Widget*>(gui)->hide (); - } - - _route->remove_insert(*i); - } - - no_insert_redisplay = false; - redisplay_inserts (); -} - -gint -RedirectBox::idle_delete_insert (boost::weak_ptr<Insert> weak_insert) -{ - boost::shared_ptr<Insert> insert (weak_insert.lock()); - - if (!insert) { - return false; - } - - /* NOT copied to _mixer.selection() */ - - no_insert_redisplay = true; - _route->remove_insert (insert); - no_insert_redisplay = false; - redisplay_inserts (); - - return false; -} - -void -RedirectBox::rename_insert (boost::shared_ptr<Insert> insert) -{ - ArdourPrompter name_prompter (true); - string result; - name_prompter.set_prompt (_("rename insert")); - name_prompter.set_initial_text (insert->name()); - name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT); - name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); - name_prompter.show_all (); - - switch (name_prompter.run ()) { - - case Gtk::RESPONSE_ACCEPT: - name_prompter.get_result (result); - if (result.length()) { - insert->set_name (result); - } - break; - } - - return; -} - -void -RedirectBox::cut_insert (boost::shared_ptr<Insert> insert) -{ - /* this essentially transfers ownership of the insert - of the insert from the route to the mixer - selection. - */ - - _rr_selection.add (insert); - - void* gui = insert->get_gui (); - - if (gui) { - static_cast<Gtk::Widget*>(gui)->hide (); - } - - no_insert_redisplay = true; - if (_route->remove_insert (insert)) { - _rr_selection.remove (insert); - } - no_insert_redisplay = false; - redisplay_inserts (); -} - -void -RedirectBox::copy_insert (boost::shared_ptr<Insert> insert) -{ - boost::shared_ptr<Insert> copy = Insert::clone (insert); - _rr_selection.add (copy); -} - -void -RedirectBox::paste_inserts () -{ - if (_rr_selection.inserts.empty()) { - return; - } - - paste_insert_list (_rr_selection.inserts); -} - -void -RedirectBox::paste_insert_list (list<boost::shared_ptr<Insert> >& inserts) -{ - list<boost::shared_ptr<Insert> > copies; - - for (list<boost::shared_ptr<Insert> >::iterator i = inserts.begin(); i != inserts.end(); ++i) { - - boost::shared_ptr<Insert> copy = Insert::clone (*i); - - copy->set_placement (_placement); - copies.push_back (copy); - } - - if (_route->add_inserts (copies)) { - - string msg = _( - "Copying the set of inserts on the clipboard failed,\n\ -probably because the I/O configuration of the plugins\n\ -could not match the configuration of this track."); - MessageDialog am (msg); - am.run (); - } -} - -void -RedirectBox::activate_insert (boost::shared_ptr<Insert> r) -{ - r->set_active (true); -} - -void -RedirectBox::deactivate_insert (boost::shared_ptr<Insert> r) -{ - r->set_active (false); -} - -void -RedirectBox::get_selected_inserts (vector<boost::shared_ptr<Insert> >& inserts) -{ - vector<Gtk::TreeModel::Path> pathlist = insert_display.get_selection()->get_selected_rows(); - - for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { - inserts.push_back ((*(model->get_iter(*iter)))[columns.insert]); - } -} - -void -RedirectBox::for_selected_inserts (void (RedirectBox::*pmf)(boost::shared_ptr<Insert>)) -{ - vector<Gtk::TreeModel::Path> pathlist = insert_display.get_selection()->get_selected_rows(); - - for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { - boost::shared_ptr<Insert> insert = (*(model->get_iter(*iter)))[columns.insert]; - (this->*pmf)(insert); - } -} - -void -RedirectBox::clone_inserts () -{ - RouteSelection& routes (_rr_selection.routes); - - if (!routes.empty()) { - if (_route->copy_inserts (*routes.front(), _placement)) { - string msg = _( -"Copying the set of inserts on the clipboard failed,\n\ -probably because the I/O configuration of the plugins\n\ -could not match the configuration of this track."); - MessageDialog am (msg); - am.run (); - } - } -} - -void -RedirectBox::all_inserts_active (bool state) -{ - _route->all_inserts_active (_placement, state); -} - -void -RedirectBox::all_plugins_active (bool state) -{ - if (state) { - // XXX not implemented - } else { - _route->disable_plugins (_placement); - } -} - -void -RedirectBox::ab_plugins () -{ - _route->ab_plugins (ab_direction); - ab_direction = !ab_direction; -} - -void -RedirectBox::clear_inserts () -{ - string prompt; - vector<string> choices; - - if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) { - if (_placement == PreFader) { - prompt = _("Do you really want to remove all pre-fader inserts from this track?\n" - "(this cannot be undone)"); - } else { - prompt = _("Do you really want to remove all post-fader inserts from this track?\n" - "(this cannot be undone)"); - } - } else { - if (_placement == PreFader) { - prompt = _("Do you really want to remove all pre-fader inserts from this bus?\n" - "(this cannot be undone)"); - } else { - prompt = _("Do you really want to remove all post-fader inserts from this bus?\n" - "(this cannot be undone)"); - } - } - - choices.push_back (_("Cancel")); - choices.push_back (_("Yes, remove them all")); - - Gtkmm2ext::Choice prompter (prompt, choices); - - if (prompter.run () == 1) { - _route->clear_inserts (_placement); - } -} - -void -RedirectBox::edit_insert (boost::shared_ptr<Insert> insert) -{ - boost::shared_ptr<Send> send; - boost::shared_ptr<PluginInsert> plugin_insert; - boost::shared_ptr<PortInsert> port_insert; - - if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) { - - if (boost::dynamic_pointer_cast<AudioTrack> (_route)->freeze_state() == AudioTrack::Frozen) { - return; - } - } - - if ((send = boost::dynamic_pointer_cast<Send> (send)) != 0) { - - if (!_session.engine().connected()) { - return; - } - - SendUIWindow *send_ui; - - if (send->get_gui() == 0) { - - send_ui = new SendUIWindow (send, _session); - - WindowTitle title(Glib::get_application_name()); - title += send->name(); - send_ui->set_title (title.get_string()); - - send->set_gui (send_ui); - - } else { - send_ui = reinterpret_cast<SendUIWindow *> (send->get_gui()); - } - - if (send_ui->is_visible()) { - send_ui->get_window()->raise (); - } else { - send_ui->show_all (); - send_ui->present (); - } - - } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) { - - ARDOUR::PluginType type = plugin_insert->type(); - - if (type == ARDOUR::LADSPA || type == ARDOUR::VST) { - PluginUIWindow *plugin_ui; - - if (plugin_insert->get_gui() == 0) { - - plugin_ui = new PluginUIWindow (plugin_insert); - - if (_owner_is_mixer) { - ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui); - } else { - ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui); - } - - WindowTitle title(Glib::get_application_name()); - title += generate_insert_title (plugin_insert); - plugin_ui->set_title (title.get_string()); - - plugin_insert->set_gui (plugin_ui); - - // change window title when route name is changed - _route->NameChanged.connect (bind (mem_fun(*this, &RedirectBox::route_name_changed), plugin_ui, boost::weak_ptr<PluginInsert> (plugin_insert))); - - - } else { - plugin_ui = reinterpret_cast<PluginUIWindow *> (plugin_insert->get_gui()); - } - - if (plugin_ui->is_visible()) { - plugin_ui->get_window()->raise (); - } else { - plugin_ui->show_all (); - plugin_ui->present (); - } -#ifdef HAVE_AUDIOUNIT - } else if (type == ARDOUR::AudioUnit) { - AUPluginUI* plugin_ui; - if (plugin_insert->get_gui() == 0) { - plugin_ui = new AUPluginUI (plugin_insert); - } else { - plugin_ui = reinterpret_cast<AUPluginUI*> (plugin_insert->get_gui()); - } - - if (plugin_ui->is_visible()) { - plugin_ui->get_window()->raise (); - } else { - plugin_ui->show_all (); - plugin_ui->present (); - } -#endif - } else { - warning << "Unsupported plugin sent to RedirectBox::edit_insert()" << endmsg; - return; - } - - } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (insert)) != 0) { - - if (!_session.engine().connected()) { - MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible")); - msg.run (); - return; - } - - PortInsertWindow *io_selector; - - if (port_insert->get_gui() == 0) { - io_selector = new PortInsertWindow (_session, port_insert); - port_insert->set_gui (io_selector); - - } else { - io_selector = reinterpret_cast<PortInsertWindow *> (port_insert->get_gui()); - } - - if (io_selector->is_visible()) { - io_selector->get_window()->raise (); - } else { - io_selector->show_all (); - io_selector->present (); - } - } -} - -bool -RedirectBox::enter_box (GdkEventCrossing *ev, RedirectBox* rb) -{ - switch (ev->detail) { - case GDK_NOTIFY_INFERIOR: - break; - - case GDK_NOTIFY_VIRTUAL: - /* fallthru */ - - default: - _current_insert_box = rb; - } - - return false; -} - -void -RedirectBox::register_actions () -{ - Glib::RefPtr<Gtk::ActionGroup> popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu")); - Glib::RefPtr<Action> act; - - /* new stuff */ - ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin ..."), sigc::ptr_fun (RedirectBox::rb_choose_plugin)); - - act = ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"), sigc::ptr_fun (RedirectBox::rb_choose_insert)); - ActionManager::jack_sensitive_actions.push_back (act); - act = ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."), sigc::ptr_fun (RedirectBox::rb_choose_send)); - ActionManager::jack_sensitive_actions.push_back (act); - - ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear"), sigc::ptr_fun (RedirectBox::rb_clear)); - - /* standard editing stuff */ - act = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"), sigc::ptr_fun (RedirectBox::rb_cut)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (RedirectBox::rb_copy)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - - act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"), sigc::ptr_fun (RedirectBox::rb_delete)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); // ?? - - paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (RedirectBox::rb_paste)); - act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (RedirectBox::rb_rename)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), sigc::ptr_fun (RedirectBox::rb_select_all)); - ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), sigc::ptr_fun (RedirectBox::rb_deselect_all)); - - /* activation */ - act = ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), sigc::ptr_fun (RedirectBox::rb_activate)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - act = ActionManager::register_action (popup_act_grp, X_("deactivate"), _("Deactivate"), sigc::ptr_fun (RedirectBox::rb_deactivate)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"), sigc::ptr_fun (RedirectBox::rb_activate_all)); - ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"), sigc::ptr_fun (RedirectBox::rb_deactivate_all)); - - ActionManager::register_action (popup_act_grp, X_("a_b_plugins"), _("A/B plugins"), sigc::ptr_fun (RedirectBox::rb_ab_plugins)); - ActionManager::register_action (popup_act_grp, X_("deactivate_plugins"), _("Deactivate plugins"), sigc::ptr_fun (RedirectBox::rb_deactivate_plugins)); - - /* show editors */ - act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), sigc::ptr_fun (RedirectBox::rb_edit)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - - ActionManager::add_action_group (popup_act_grp); - - -} - -void -RedirectBox::rb_choose_plugin () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->choose_plugin (); -} - -void -RedirectBox::rb_choose_insert () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->choose_insert (); -} - -void -RedirectBox::rb_choose_send () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->choose_send (); -} - -void -RedirectBox::rb_clear () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->clear_inserts (); -} - -void -RedirectBox::rb_cut () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->cut_inserts (); -} - -void -RedirectBox::rb_delete () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->delete_inserts (); -} - -void -RedirectBox::rb_copy () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->copy_inserts (); -} - -void -RedirectBox::rb_paste () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->paste_inserts (); -} - -void -RedirectBox::rb_rename () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->rename_inserts (); -} - -void -RedirectBox::rb_select_all () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->select_all_inserts (); -} - -void -RedirectBox::rb_deselect_all () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->deselect_all_inserts (); -} - -void -RedirectBox::rb_activate () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->for_selected_inserts (&RedirectBox::activate_insert); -} - -void -RedirectBox::rb_deactivate () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->for_selected_inserts (&RedirectBox::deactivate_insert); -} - -void -RedirectBox::rb_activate_all () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->all_inserts_active (true); -} - -void -RedirectBox::rb_deactivate_all () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->all_inserts_active (false); -} - -void -RedirectBox::rb_deactivate_plugins () -{ - if (_current_insert_box == 0) { - return; - } - _current_insert_box->all_plugins_active (false); -} - - -void -RedirectBox::rb_ab_plugins () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->ab_plugins (); -} - - -void -RedirectBox::rb_edit () -{ - if (_current_insert_box == 0) { - return; - } - - _current_insert_box->for_selected_inserts (&RedirectBox::edit_insert); -} - -void -RedirectBox::route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr<PluginInsert> wpi) -{ - ENSURE_GUI_THREAD(bind (mem_fun (*this, &RedirectBox::route_name_changed), plugin_ui, wpi)); - boost::shared_ptr<PluginInsert> pi (wpi.lock()); - - - if (pi) { - WindowTitle title(Glib::get_application_name()); - title += generate_insert_title (pi); - plugin_ui->set_title (title.get_string()); - } -} - -string -RedirectBox::generate_insert_title (boost::shared_ptr<PluginInsert> pi) -{ - string maker = pi->plugin()->maker(); - string::size_type email_pos; - - if ((email_pos = maker.find_first_of ('<')) != string::npos) { - maker = maker.substr (0, email_pos - 1); - } - - if (maker.length() > 32) { - maker = maker.substr (0, 32); - maker += " ..."; - } - - return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker); -} - diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h deleted file mode 100644 index 914402858a..0000000000 --- a/gtk2_ardour/redirect_box.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - Copyright (C) 2004 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. - -*/ - -#ifndef __ardour_gtk_redirect_box__ -#define __ardour_gtk_redirect_box__ - -#include <vector> - -#include <cmath> -#include <gtkmm/box.h> -#include <gtkmm/eventbox.h> -#include <gtkmm/menu.h> -#include <gtkmm/scrolledwindow.h> -#include <gtkmm2ext/dndtreeview.h> -#include <gtkmm2ext/auto_spin.h> -#include <gtkmm2ext/click_box.h> -#include <gtkmm2ext/dndtreeview.h> - -#include <pbd/stateful.h> - -#include <ardour/types.h> -#include <ardour/ardour.h> -#include <ardour/io.h> -#include <ardour/insert.h> -#include <ardour/redirect.h> - -#include <pbd/fastlog.h> - -#include "route_ui.h" -#include "io_selector.h" -#include "enums.h" - -class MotionController; -class PluginSelector; -class PluginUIWindow; -class RouteRedirectSelection; - -namespace ARDOUR { - class Bundle; - class Insert; - class Plugin; - class PluginInsert; - class PortInsert; - class Route; - class Send; - class Session; -} - - -// FIXME: change name to InsertBox -class RedirectBox : public Gtk::HBox -{ - public: - RedirectBox (ARDOUR::Placement, ARDOUR::Session&, - boost::shared_ptr<ARDOUR::Route>, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false); - ~RedirectBox (); - - void set_width (Width); - - void update(); - - void select_all_inserts (); - void deselect_all_inserts (); - void select_all_plugins (); - void select_all_sends (); - - sigc::signal<void,boost::shared_ptr<ARDOUR::Insert> > InsertSelected; - sigc::signal<void,boost::shared_ptr<ARDOUR::Insert> > InsertUnselected; - - static void register_actions(); - - protected: - void set_stuff_from_route (); - - private: - boost::shared_ptr<ARDOUR::Route> _route; - ARDOUR::Session & _session; - bool _owner_is_mixer; - bool ab_direction; - - ARDOUR::Placement _placement; - - PluginSelector & _plugin_selector; - RouteRedirectSelection & _rr_selection; - - void route_going_away (); - - struct ModelColumns : public Gtk::TreeModel::ColumnRecord { - ModelColumns () { - add (text); - add (insert); - add (color); - } - Gtk::TreeModelColumn<std::string> text; - Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Insert> > insert; - Gtk::TreeModelColumn<Gdk::Color> color; - }; - - ModelColumns columns; - Glib::RefPtr<Gtk::ListStore> model; - - void selection_changed (); - - static bool get_colors; - static Gdk::Color* active_insert_color; - static Gdk::Color* inactive_insert_color; - - Gtk::EventBox insert_eventbox; - Gtk::HBox insert_hpacker; - Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Insert> > insert_display; - Gtk::ScrolledWindow insert_scroller; - - void object_drop (std::string type, uint32_t cnt, const boost::shared_ptr<ARDOUR::Insert>*); - - Width _width; - - Gtk::Menu *send_action_menu; - void build_send_action_menu (); - - void new_send (); - void show_send_controls (); - - Gtk::Menu *insert_menu; - gint insert_menu_map_handler (GdkEventAny *ev); - Gtk::Menu * build_insert_menu (); - void build_insert_tooltip (Gtk::EventBox&, string); - void show_insert_menu (gint arg); - - void choose_send (); - void send_io_finished (IOSelector::Result, boost::shared_ptr<ARDOUR::Send>, IOSelectorWindow*); - void choose_insert (); - void choose_plugin (); - void insert_plugin_chosen (boost::shared_ptr<ARDOUR::Plugin>); - - bool no_insert_redisplay; - bool ignore_delete; - - bool insert_button_press_event (GdkEventButton *); - bool insert_button_release_event (GdkEventButton *); - void redisplay_inserts (); - void add_insert_to_display (boost::shared_ptr<ARDOUR::Insert>); - void row_deleted (const Gtk::TreeModel::Path& path); - void show_insert_active (boost::weak_ptr<ARDOUR::Insert>); - void show_insert_name (boost::weak_ptr<ARDOUR::Insert>); - string insert_name (boost::weak_ptr<ARDOUR::Insert>); - - void remove_insert_gui (boost::shared_ptr<ARDOUR::Insert>); - - void inserts_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); - void compute_insert_sort_keys (); - vector<sigc::connection> insert_active_connections; - vector<sigc::connection> insert_name_connections; - - bool insert_drag_in_progress; - void insert_drag_begin (GdkDragContext*); - void insert_drag_end (GdkDragContext*); - void all_inserts_active(bool state); - void all_plugins_active(bool state); - void ab_plugins (); - - void cut_inserts (); - void copy_inserts (); - void paste_inserts (); - void delete_inserts (); - void clear_inserts (); - void clone_inserts (); - void rename_inserts (); - - void for_selected_inserts (void (RedirectBox::*pmf)(boost::shared_ptr<ARDOUR::Insert>)); - void get_selected_inserts (vector<boost::shared_ptr<ARDOUR::Insert> >&); - - static Glib::RefPtr<Gtk::Action> paste_action; - void paste_insert_list (std::list<boost::shared_ptr<ARDOUR::Insert> >& inserts); - - void activate_insert (boost::shared_ptr<ARDOUR::Insert>); - void deactivate_insert (boost::shared_ptr<ARDOUR::Insert>); - void cut_insert (boost::shared_ptr<ARDOUR::Insert>); - void copy_insert (boost::shared_ptr<ARDOUR::Insert>); - void edit_insert (boost::shared_ptr<ARDOUR::Insert>); - void hide_insert_editor (boost::shared_ptr<ARDOUR::Insert>); - void rename_insert (boost::shared_ptr<ARDOUR::Insert>); - - gint idle_delete_insert (boost::weak_ptr<ARDOUR::Insert>); - - void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::InsertStreams streams, boost::shared_ptr<ARDOUR::IO> io); - - static RedirectBox* _current_insert_box; - static bool enter_box (GdkEventCrossing*, RedirectBox*); - static bool leave_box (GdkEventCrossing*, RedirectBox*); - - static void rb_choose_plugin (); - static void rb_choose_insert (); - static void rb_choose_send (); - static void rb_clear (); - static void rb_cut (); - static void rb_copy (); - static void rb_paste (); - static void rb_delete (); - static void rb_rename (); - static void rb_select_all (); - static void rb_deselect_all (); - static void rb_activate (); - static void rb_deactivate (); - static void rb_activate_all (); - static void rb_deactivate_all (); - static void rb_edit (); - static void rb_ab_plugins (); - static void rb_deactivate_plugins (); - - void route_name_changed (PluginUIWindow* plugin_ui, boost::weak_ptr<ARDOUR::PluginInsert> pi); - std::string generate_insert_title (boost::shared_ptr<ARDOUR::PluginInsert> pi); -}; - -#endif /* __ardour_gtk_redirect_box__ */ diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 6a03d72973..51b1c9e26b 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -211,16 +211,16 @@ RouteParams_UI::route_name_changed (boost::shared_ptr<Route> route) } void -RouteParams_UI::setup_redirect_boxes() +RouteParams_UI::setup_processor_boxes() { if (session && _route) { // just in case... shouldn't need this - cleanup_redirect_boxes(); + cleanup_processor_boxes(); // construct new redirect boxes - pre_insert_box = new RedirectBox(PreFader, *session, _route, *_plugin_selector, _rr_selection); - post_insert_box = new RedirectBox(PostFader, *session, _route, *_plugin_selector, _rr_selection); + pre_insert_box = new ProcessorBox(PreFader, *session, _route, *_plugin_selector, _rr_selection); + post_insert_box = new ProcessorBox(PostFader, *session, _route, *_plugin_selector, _rr_selection); pre_redir_hpane.pack1 (*pre_insert_box); post_redir_hpane.pack1 (*post_insert_box); @@ -237,7 +237,7 @@ RouteParams_UI::setup_redirect_boxes() } void -RouteParams_UI::cleanup_redirect_boxes() +RouteParams_UI::cleanup_processor_boxes() { if (pre_insert_box) { pre_redir_hpane.remove(*pre_insert_box); @@ -344,11 +344,11 @@ RouteParams_UI::route_removed (boost::shared_ptr<Route> route) cleanup_io_frames(); cleanup_pre_view(); cleanup_post_view(); - cleanup_redirect_boxes(); + cleanup_processor_boxes(); _route.reset ((Route*) 0); - _pre_insert.reset ((Redirect*) 0); - _post_insert.reset ((Redirect*) 0); + _pre_processor.reset ((Processor*) 0); + _post_processor.reset ((Processor*) 0); update_title(); } } @@ -386,11 +386,11 @@ RouteParams_UI::session_gone () cleanup_io_frames(); cleanup_pre_view(); cleanup_post_view(); - cleanup_redirect_boxes(); + cleanup_processor_boxes(); _route.reset ((Route*) 0); - _pre_insert.reset ((Redirect*) 0); - _post_insert.reset ((Redirect*) 0); + _pre_processor.reset ((Processor*) 0); + _post_processor.reset ((Processor*) 0); update_title(); ArdourDialog::session_gone(); @@ -415,7 +415,7 @@ RouteParams_UI::route_selected() if (_route) { _route_conn.disconnect(); _route_ds_conn.disconnect(); - cleanup_redirect_boxes(); + cleanup_processor_boxes(); cleanup_pre_view(); cleanup_post_view(); cleanup_io_frames(); @@ -426,10 +426,10 @@ RouteParams_UI::route_selected() //update_routeinfo (route); setup_io_frames(); - setup_redirect_boxes(); + setup_processor_boxes(); // bind to redirects changed event for this route - _route_conn = route->inserts_changed.connect (mem_fun(*this, &RouteParams_UI::inserts_changed)); + _route_conn = route->processors_changed.connect (mem_fun(*this, &RouteParams_UI::processors_changed)); track_input_label.set_text (_route->name()); @@ -443,11 +443,11 @@ RouteParams_UI::route_selected() cleanup_io_frames(); cleanup_pre_view(); cleanup_post_view(); - cleanup_redirect_boxes(); + cleanup_processor_boxes(); _route.reset ((Route*) 0); - _pre_insert.reset ((Redirect*) 0); - _post_insert.reset ((Redirect *) 0); + _pre_processor.reset ((Processor*) 0); + _post_processor.reset ((Processor *) 0); track_input_label.set_text(_("NO TRACK")); update_title(); } @@ -464,21 +464,21 @@ RouteParams_UI::route_selected() // cleanup_io_frames(); // cleanup_pre_view(); // cleanup_post_view(); -// cleanup_redirect_boxes(); +// cleanup_processor_boxes(); // _route.reset ((Route*)0); -// _pre_insert = 0; -// _post_insert = 0; +// _pre_processor = 0; +// _post_processor = 0; // track_input_label.set_text(_("NO TRACK")); // update_title(); // } //} void -RouteParams_UI::inserts_changed () +RouteParams_UI::processors_changed () { - ENSURE_GUI_THREAD(mem_fun(*this, &RouteParams_UI::inserts_changed)); + ENSURE_GUI_THREAD(mem_fun(*this, &RouteParams_UI::processors_changed)); // pre_insert_list.freeze (); // pre_insert_list.clear (); @@ -493,8 +493,8 @@ RouteParams_UI::inserts_changed () cleanup_pre_view(); cleanup_post_view(); - _pre_insert.reset ((Redirect*) 0); - _post_insert.reset ((Redirect*) 0); + _pre_processor.reset ((Processor*) 0); + _post_processor.reset ((Processor*) 0); //update_title(); } @@ -518,10 +518,10 @@ RouteParams_UI::show_track_menu() void -RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Insert> insert, ARDOUR::Placement place) +RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert, ARDOUR::Placement place) { - if ((place == PreFader && _pre_insert == insert) - || (place == PostFader && _post_insert == insert)){ + if ((place == PreFader && _pre_processor == insert) + || (place == PostFader && _post_processor == insert)){ return; } @@ -593,9 +593,9 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Insert> insert, ARD } if (place == PreFader) { - _pre_insert = insert; + _pre_processor = insert; } else { - _post_insert = insert; + _post_processor = insert; } update_title(); @@ -611,28 +611,28 @@ RouteParams_UI::plugin_going_away (Placement place) if (place == PreFader) { cleanup_pre_view (false); - _pre_insert.reset ((Redirect*) 0); + _pre_processor.reset ((Processor*) 0); } else { cleanup_post_view (false); - _post_insert.reset ((Redirect*) 0); + _post_processor.reset ((Processor*) 0); } } void -RouteParams_UI::redirect_going_away (boost::shared_ptr<ARDOUR::Insert> insert) +RouteParams_UI::redirect_going_away (boost::shared_ptr<ARDOUR::Processor> insert) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::redirect_going_away), insert)); printf ("redirect going away\n"); // delete the current view without calling finish - if (insert == _pre_insert) { + if (insert == _pre_processor) { cleanup_pre_view (false); - _pre_insert.reset ((Redirect*) 0); - } else if (insert == _post_insert) { + _pre_processor.reset ((Processor*) 0); + } else if (insert == _post_processor) { cleanup_post_view (false); - _post_insert.reset ((Redirect*) 0); + _post_processor.reset ((Processor*) 0); } } diff --git a/gtk2_ardour/route_params_ui.h b/gtk2_ardour/route_params_ui.h index ffcf6e1366..39305ae467 100644 --- a/gtk2_ardour/route_params_ui.h +++ b/gtk2_ardour/route_params_ui.h @@ -36,17 +36,17 @@ #include <ardour/ardour.h> #include <ardour/io.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include "io_selector.h" #include "ardour_dialog.h" -#include "redirect_box.h" -#include "route_redirect_selection.h" +#include "processor_box.h" +#include "route_processor_selection.h" namespace ARDOUR { class Route; class Send; - class Insert; + class Processor; class Session; class PortInsert; class Connection; @@ -89,8 +89,8 @@ class RouteParams_UI : public ArdourDialog Gtk::HBox route_hpacker; Gtk::VBox route_vpacker; - RedirectBox * pre_insert_box; - RedirectBox * post_insert_box; + ProcessorBox * pre_insert_box; + ProcessorBox * post_insert_box; Gtk::HPaned list_hpane; @@ -121,11 +121,11 @@ class RouteParams_UI : public ArdourDialog sigc::connection _route_conn; sigc::connection _route_ds_conn; - boost::shared_ptr<ARDOUR::Insert> _pre_insert; - sigc::connection _pre_plugin_conn; + boost::shared_ptr<ARDOUR::Processor> _pre_processor; + sigc::connection _pre_plugin_conn; - boost::shared_ptr<ARDOUR::Insert> _post_insert; - sigc::connection _post_plugin_conn; + boost::shared_ptr<ARDOUR::Processor> _post_processor; + sigc::connection _post_plugin_conn; enum ConfigView { @@ -171,15 +171,15 @@ class RouteParams_UI : public ArdourDialog - void inserts_changed (); + void processors_changed (); - void setup_redirect_boxes(); - void cleanup_redirect_boxes(); + void setup_processor_boxes(); + void cleanup_processor_boxes(); - void redirect_selected (boost::shared_ptr<ARDOUR::Insert>, ARDOUR::Placement); + void redirect_selected (boost::shared_ptr<ARDOUR::Processor>, ARDOUR::Placement); void plugin_going_away (ARDOUR::Placement); - void redirect_going_away (boost::shared_ptr<ARDOUR::Insert>); + void redirect_going_away (boost::shared_ptr<ARDOUR::Processor>); gint edit_input_configuration (GdkEventButton *ev); gint edit_output_configuration (GdkEventButton *ev); diff --git a/gtk2_ardour/route_redirect_selection.cc b/gtk2_ardour/route_processor_selection.cc index 735c1b4dc5..33dd1bfe7b 100644 --- a/gtk2_ardour/route_redirect_selection.cc +++ b/gtk2_ardour/route_processor_selection.cc @@ -22,10 +22,10 @@ #include <pbd/error.h> #include <ardour/playlist.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/route.h> -#include "route_redirect_selection.h" +#include "route_processor_selection.h" #include "i18n.h" @@ -37,7 +37,7 @@ RouteRedirectSelection& RouteRedirectSelection::operator= (const RouteRedirectSelection& other) { if (&other != this) { - inserts = other.inserts; + processors = other.processors; routes = other.routes; } return *this; @@ -46,22 +46,22 @@ RouteRedirectSelection::operator= (const RouteRedirectSelection& other) bool operator== (const RouteRedirectSelection& a, const RouteRedirectSelection& b) { - return a.inserts == b.inserts && + return a.processors == b.processors && a.routes == b.routes; } void RouteRedirectSelection::clear () { - clear_inserts (); + clear_processors (); clear_routes (); } void -RouteRedirectSelection::clear_inserts () +RouteRedirectSelection::clear_processors () { - inserts.clear (); - InsertsChanged (); + processors.clear (); + ProcessorsChanged (); } void @@ -72,27 +72,27 @@ RouteRedirectSelection::clear_routes () } void -RouteRedirectSelection::add (boost::shared_ptr<Insert> r) +RouteRedirectSelection::add (boost::shared_ptr<Processor> r) { - if (find (inserts.begin(), inserts.end(), r) == inserts.end()) { - inserts.push_back (r); + if (find (processors.begin(), processors.end(), r) == processors.end()) { + processors.push_back (r); // XXX SHAREDPTR FIXME // void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; // r->GoingAway.connect (mem_fun(*this, pmf)); - InsertsChanged(); + ProcessorsChanged(); } } void -RouteRedirectSelection::add (const vector<boost::shared_ptr<Insert> >& rlist) +RouteRedirectSelection::add (const vector<boost::shared_ptr<Processor> >& rlist) { bool changed = false; - for (vector<boost::shared_ptr<Insert> >::const_iterator i = rlist.begin(); i != rlist.end(); ++i) { - if (find (inserts.begin(), inserts.end(), *i) == inserts.end()) { - inserts.push_back (*i); + for (vector<boost::shared_ptr<Processor> >::const_iterator i = rlist.begin(); i != rlist.end(); ++i) { + if (find (processors.begin(), processors.end(), *i) == processors.end()) { + processors.push_back (*i); // XXX SHAREDPTR FIXME @@ -103,31 +103,31 @@ RouteRedirectSelection::add (const vector<boost::shared_ptr<Insert> >& rlist) } if (changed) { - InsertsChanged(); + ProcessorsChanged(); } } void -RouteRedirectSelection::remove (boost::shared_ptr<Insert> r) +RouteRedirectSelection::remove (boost::shared_ptr<Processor> r) { - list<boost::shared_ptr<Insert> >::iterator i; - if ((i = find (inserts.begin(), inserts.end(), r)) != inserts.end()) { - inserts.erase (i); - InsertsChanged (); + list<boost::shared_ptr<Processor> >::iterator i; + if ((i = find (processors.begin(), processors.end(), r)) != processors.end()) { + processors.erase (i); + ProcessorsChanged (); } } void -RouteRedirectSelection::set (boost::shared_ptr<Insert> r) +RouteRedirectSelection::set (boost::shared_ptr<Processor> r) { - clear_inserts (); + clear_processors (); add (r); } void -RouteRedirectSelection::set (const vector<boost::shared_ptr<Insert> >& rlist) +RouteRedirectSelection::set (const vector<boost::shared_ptr<Processor> >& rlist) { - clear_inserts (); + clear_processors (); add (rlist); } @@ -171,6 +171,6 @@ RouteRedirectSelection::selected (boost::shared_ptr<Route> r) bool RouteRedirectSelection::empty () { - return inserts.empty () && routes.empty (); + return processors.empty () && routes.empty (); } diff --git a/gtk2_ardour/route_redirect_selection.h b/gtk2_ardour/route_processor_selection.h index 395012c32e..78f6ddca48 100644 --- a/gtk2_ardour/route_redirect_selection.h +++ b/gtk2_ardour/route_processor_selection.h @@ -17,42 +17,42 @@ */ -#ifndef __ardour_gtk_route_redirect_selection_h__ -#define __ardour_gtk_route_redirect_selection_h__ +#ifndef __ardour_gtk_route_processor_selection_h__ +#define __ardour_gtk_route_processor_selection_h__ #include <vector> #include <sigc++/signal.h> -#include "redirect_selection.h" +#include "processor_selection.h" #include "route_selection.h" class RouteRedirectSelection : public sigc::trackable { public: - InsertSelection inserts; - RouteSelection routes; + ProcessorSelection processors; + RouteSelection routes; RouteRedirectSelection() {} RouteRedirectSelection& operator= (const RouteRedirectSelection& other); - sigc::signal<void> InsertsChanged; + sigc::signal<void> ProcessorsChanged; sigc::signal<void> RoutesChanged; void clear (); bool empty(); - void set (boost::shared_ptr<ARDOUR::Insert>); - void set (const std::vector<boost::shared_ptr<ARDOUR::Insert> >&); - void add (boost::shared_ptr<ARDOUR::Insert>); - void add (const std::vector<boost::shared_ptr<ARDOUR::Insert> >&); - void remove (boost::shared_ptr<ARDOUR::Insert>); + void set (boost::shared_ptr<ARDOUR::Processor>); + void set (const std::vector<boost::shared_ptr<ARDOUR::Processor> >&); + void add (boost::shared_ptr<ARDOUR::Processor>); + void add (const std::vector<boost::shared_ptr<ARDOUR::Processor> >&); + void remove (boost::shared_ptr<ARDOUR::Processor>); void set (boost::shared_ptr<ARDOUR::Route>); void add (boost::shared_ptr<ARDOUR::Route>); void remove (boost::shared_ptr<ARDOUR::Route>); - void clear_inserts (); + void clear_processors (); void clear_routes (); bool selected (boost::shared_ptr<ARDOUR::Route>); @@ -60,4 +60,4 @@ class RouteRedirectSelection : public sigc::trackable bool operator==(const RouteRedirectSelection& a, const RouteRedirectSelection& b); -#endif /* __ardour_gtk_route_redirect_selection_h__ */ +#endif /* __ardour_gtk_route_processor_selection_h__ */ diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index f113724cf5..26f7fd6cd4 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -43,7 +43,7 @@ #include <ardour/playlist.h> #include <ardour/audioplaylist.h> #include <ardour/diskstream.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/ladspa_plugin.h> #include <ardour/location.h> #include <ardour/panner.h> @@ -56,8 +56,8 @@ #include "ardour_ui.h" #include "route_time_axis.h" #include "automation_time_axis.h" -#include "redirect_automation_time_axis.h" -#include "redirect_automation_line.h" +#include "processor_automation_time_axis.h" +#include "plugin_automation_line.h" #include "canvas_impl.h" #include "crossfade_view.h" #include "enums.h" @@ -182,7 +182,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)); _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); - _route->inserts_changed.connect (mem_fun(*this, &RouteTimeAxisView::inserts_changed)); + _route->processors_changed.connect (mem_fun(*this, &RouteTimeAxisView::processors_changed)); _route->NameChanged.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed)); _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); @@ -207,9 +207,9 @@ RouteTimeAxisView::~RouteTimeAxisView () { GoingAway (); /* EMIT_SIGNAL */ - vector_delete (&insert_automation_curves); + vector_delete (&processor_automation_curves); - for (list<InsertAutomationInfo*>::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { delete *i; } @@ -235,9 +235,9 @@ RouteTimeAxisView::post_construct () /* map current state of the route */ update_diskstream_display (); - _route->foreach_insert (this, &RouteTimeAxisView::add_insert_to_subplugin_menu); - _route->foreach_insert (this, &RouteTimeAxisView::add_existing_insert_automation_curves); - reset_insert_automation_curves (); + _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu); + _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves); + reset_processor_automation_curves (); } void @@ -285,8 +285,6 @@ RouteTimeAxisView::set_state (const XMLNode& node) if (param) { - cerr << "RTAV::set_state parameter: " << param.to_string() << endl; - XMLProperty* prop = child_node->property ("shown"); if (_automation_tracks.find(param) == _automation_tracks.end()) @@ -296,7 +294,7 @@ RouteTimeAxisView::set_state (const XMLNode& node) _show_automation.insert(ParamID(GainAutomation)); } else { - cerr << "RTAV: no parameter " << child_node->name() << endl; + warning << "GUI info exists, but no parameter " << child_node->name() << " found." << endmsg; } } } @@ -1542,12 +1540,12 @@ RouteTimeAxisView::show_all_automation () } - /* Show insert automation */ + /* Show processor automation */ - for (list<InsertAutomationInfo*>::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector<InsertAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { if ((*ii)->view == 0) { - add_insert_automation_curve ((*i)->insert, (*ii)->what); + add_processor_automation_curve ((*i)->processor, (*ii)->what); } (*ii)->menu_item->set_active (true); @@ -1581,9 +1579,9 @@ RouteTimeAxisView::show_existing_automation () } - /* Show insert automation */ + /* Show processor automation */ - for (list<InsertAutomationInfo*>::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector<InsertAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { if ((*ii)->view != 0) { (*ii)->menu_item->set_active (true); @@ -1601,7 +1599,7 @@ RouteTimeAxisView::hide_all_automation () { no_redraw = true; - for (list<InsertAutomationInfo*>::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { for (vector<InsertAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { (*ii)->menu_item->set_active (false); } @@ -1625,7 +1623,7 @@ RouteTimeAxisView::region_view_added (RegionView* rv) } void -RouteTimeAxisView::add_ghost_to_insert (RegionView* rv, AutomationTimeAxisView* atv) +RouteTimeAxisView::add_ghost_to_processor (RegionView* rv, AutomationTimeAxisView* atv) { rv->add_ghost (*atv); } @@ -1656,11 +1654,11 @@ RouteTimeAxisView::remove_ran (InsertAutomationNode* ran) } RouteTimeAxisView::InsertAutomationNode* -RouteTimeAxisView::find_insert_automation_node (boost::shared_ptr<Insert> insert, ParamID what) +RouteTimeAxisView::find_processor_automation_node (boost::shared_ptr<Processor> processor, ParamID what) { - for (list<InsertAutomationInfo*>::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { - if ((*i)->insert == insert) { + if ((*i)->processor == processor) { for (vector<InsertAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) { if ((*ii)->what == what) { @@ -1693,16 +1691,16 @@ legalize_for_xml_node (string str) void -RouteTimeAxisView::add_insert_automation_curve (boost::shared_ptr<Insert> insert, ParamID what) +RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> processor, ParamID what) { - RedirectAutomationLine* ral; + ProcessorAutomationLine* ral; string name; InsertAutomationNode* ran; - if ((ran = find_insert_automation_node (insert, what)) == 0) { + if ((ran = find_processor_automation_node (processor, what)) == 0) { fatal << _("programming error: ") - << string_compose (X_("insert automation curve for %1:%2 not registered with audio track!"), - insert->name(), what) + << string_compose (X_("processor automation curve for %1:%2 not registered with track!"), + processor->name(), what) << endmsg; /*NOTREACHED*/ return; @@ -1712,25 +1710,25 @@ RouteTimeAxisView::add_insert_automation_curve (boost::shared_ptr<Insert> insert return; } - name = insert->describe_parameter (what); + name = processor->describe_parameter (what); /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */ char state_name[256]; - snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (insert->name()).c_str(), what.id()); + snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id()); - ran->view = new RedirectAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *insert, state_name); + ran->view = new ProcessorAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *processor, state_name); - ral = new RedirectAutomationLine (name, - *insert, what, _session, *ran->view, - *ran->view->canvas_display, *insert->automation_list (what, true)); + ral = new ProcessorAutomationLine (name, + *processor, what, *ran->view, + *ran->view->canvas_display, *processor->automation_list (what, true)); - ral->set_line_color (Config->canvasvar_RedirectAutomationLine.get()); + ral->set_line_color (Config->canvasvar_ProcessorAutomationLine.get()); ral->queue_reset (); ran->view->add_line (*ral); - ran->view->Hiding.connect (bind (mem_fun(*this, &RouteTimeAxisView::insert_automation_track_hidden), ran, insert)); + ran->view->Hiding.connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_automation_track_hidden), ran, processor)); if (!ran->view->marked_for_display()) { ran->view->hide (); @@ -1741,14 +1739,14 @@ RouteTimeAxisView::add_insert_automation_curve (boost::shared_ptr<Insert> insert add_child (ran->view); if (_view) { - _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_insert), ran->view)); + _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_processor), ran->view)); } - insert->mark_automation_visible (what, true); + processor->mark_automation_visible (what, true); } void -RouteTimeAxisView::insert_automation_track_hidden (RouteTimeAxisView::InsertAutomationNode* ran, boost::shared_ptr<Insert> i) +RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::InsertAutomationNode* ran, boost::shared_ptr<Processor> i) { if (!_hidden) { ran->menu_item->set_active (false); @@ -1760,19 +1758,19 @@ RouteTimeAxisView::insert_automation_track_hidden (RouteTimeAxisView::InsertAuto } void -RouteTimeAxisView::add_existing_insert_automation_curves (boost::shared_ptr<Insert> insert) +RouteTimeAxisView::add_existing_processor_automation_curves (boost::shared_ptr<Processor> processor) { set<ParamID> s; - RedirectAutomationLine *ral; + ProcessorAutomationLine *ral; - insert->what_has_visible_automation (s); + processor->what_has_visible_automation (s); for (set<ParamID>::iterator i = s.begin(); i != s.end(); ++i) { - if ((ral = find_insert_automation_curve (insert, *i)) != 0) { + if ((ral = find_processor_automation_curve (processor, *i)) != 0) { ral->queue_reset (); } else { - add_insert_automation_curve (insert, (*i)); + add_processor_automation_curve (processor, (*i)); } } } @@ -1811,31 +1809,31 @@ RouteTimeAxisView::add_automation_child(ParamID param, AutomationTimeAxisView* t void -RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr<Insert> insert) +RouteTimeAxisView::add_processor_to_subplugin_menu (boost::shared_ptr<Processor> processor) { using namespace Menu_Helpers; InsertAutomationInfo *rai; list<InsertAutomationInfo*>::iterator x; - const std::set<ParamID>& automatable = insert->what_can_be_automated (); + const std::set<ParamID>& automatable = processor->what_can_be_automated (); std::set<ParamID> has_visible_automation; - insert->what_has_visible_automation(has_visible_automation); + processor->what_has_visible_automation(has_visible_automation); if (automatable.empty()) { return; } - for (x = insert_automation.begin(); x != insert_automation.end(); ++x) { - if ((*x)->insert == insert) { + for (x = processor_automation.begin(); x != processor_automation.end(); ++x) { + if ((*x)->processor == processor) { break; } } - if (x == insert_automation.end()) { + if (x == processor_automation.end()) { - rai = new InsertAutomationInfo (insert); - insert_automation.push_back (rai); + rai = new InsertAutomationInfo (processor); + processor_automation.push_back (rai); } else { @@ -1843,7 +1841,7 @@ RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr<Insert> inser } - /* any older menu was deleted at the top of inserts_changed() + /* any older menu was deleted at the top of processors_changed() when we cleared the subplugin menu. */ @@ -1858,7 +1856,7 @@ RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr<Insert> inser InsertAutomationNode* ran; CheckMenuItem* mitem; - string name = insert->describe_parameter (*i); + string name = processor->describe_parameter (*i); items.push_back (CheckMenuElem (name)); mitem = dynamic_cast<CheckMenuItem*> (&items.back()); @@ -1867,7 +1865,7 @@ RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr<Insert> inser mitem->set_active(true); } - if ((ran = find_insert_automation_node (insert, *i)) == 0) { + if ((ran = find_processor_automation_node (processor, *i)) == 0) { /* new item */ @@ -1881,28 +1879,28 @@ RouteTimeAxisView::add_insert_to_subplugin_menu (boost::shared_ptr<Insert> inser } - mitem->signal_toggled().connect (bind (mem_fun(*this, &RouteTimeAxisView::insert_menu_item_toggled), rai, ran)); + mitem->signal_toggled().connect (bind (mem_fun(*this, &RouteTimeAxisView::processor_menu_item_toggled), rai, ran)); } - /* add the menu for this insert, because the subplugin - menu is always cleared at the top of inserts_changed(). + /* add the menu for this processor, because the subplugin + menu is always cleared at the top of processors_changed(). this is the result of some poor design in gtkmm and/or GTK+. */ - subplugin_menu.items().push_back (MenuElem (insert->name(), *rai->menu)); + subplugin_menu.items().push_back (MenuElem (processor->name(), *rai->menu)); rai->valid = true; } void -RouteTimeAxisView::insert_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo* rai, +RouteTimeAxisView::processor_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo* rai, RouteTimeAxisView::InsertAutomationNode* ran) { bool showit = ran->menu_item->get_active(); bool redraw = false; if (ran->view == 0 && showit) { - add_insert_automation_curve (rai->insert, ran->what); + add_processor_automation_curve (rai->processor, ran->what); redraw = true; } @@ -1912,7 +1910,7 @@ RouteTimeAxisView::insert_menu_item_toggled (RouteTimeAxisView::InsertAutomation ran->view->set_marked_for_display (true); ran->view->canvas_display->show(); } else { - rai->insert->mark_automation_visible (ran->what, true); + rai->processor->mark_automation_visible (ran->what, true); ran->view->set_marked_for_display (false); ran->view->hide (); } @@ -1931,20 +1929,20 @@ RouteTimeAxisView::insert_menu_item_toggled (RouteTimeAxisView::InsertAutomation } void -RouteTimeAxisView::inserts_changed () +RouteTimeAxisView::processors_changed () { using namespace Menu_Helpers; - for (list<InsertAutomationInfo*>::iterator i = insert_automation.begin(); i != insert_automation.end(); ++i) { + for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) { (*i)->valid = false; } subplugin_menu.items().clear (); - _route->foreach_insert (this, &RouteTimeAxisView::add_insert_to_subplugin_menu); - _route->foreach_insert (this, &RouteTimeAxisView::add_existing_insert_automation_curves); + _route->foreach_processor (this, &RouteTimeAxisView::add_processor_to_subplugin_menu); + _route->foreach_processor (this, &RouteTimeAxisView::add_existing_processor_automation_curves); - for (list<InsertAutomationInfo*>::iterator i = insert_automation.begin(); i != insert_automation.end(); ) { + for (list<InsertAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ) { list<InsertAutomationInfo*>::iterator tmp; @@ -1954,7 +1952,7 @@ RouteTimeAxisView::inserts_changed () if (!(*i)->valid) { delete *i; - insert_automation.erase (i); + processor_automation.erase (i); } @@ -1966,14 +1964,14 @@ RouteTimeAxisView::inserts_changed () _route->gui_changed ("track_height", this); } -RedirectAutomationLine * -RouteTimeAxisView::find_insert_automation_curve (boost::shared_ptr<Insert> insert, ParamID what) +ProcessorAutomationLine * +RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> processor, ParamID what) { InsertAutomationNode* ran; - if ((ran = find_insert_automation_node (insert, what)) != 0) { + if ((ran = find_processor_automation_node (processor, what)) != 0) { if (ran->view) { - return dynamic_cast<RedirectAutomationLine*> (ran->view->lines.front()); + return dynamic_cast<ProcessorAutomationLine*> (ran->view->lines.front()); } } @@ -1981,9 +1979,9 @@ RouteTimeAxisView::find_insert_automation_curve (boost::shared_ptr<Insert> inser } void -RouteTimeAxisView::reset_insert_automation_curves () +RouteTimeAxisView::reset_processor_automation_curves () { - for (vector<RedirectAutomationLine*>::iterator i = insert_automation_curves.begin(); i != insert_automation_curves.end(); ++i) { + for (vector<ProcessorAutomationLine*>::iterator i = processor_automation_curves.begin(); i != processor_automation_curves.end(); ++i) { (*i)->reset(); } } diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 42c889e16f..9e33d46e2a 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -45,8 +45,8 @@ namespace ARDOUR { class Region; class Diskstream; class RouteGroup; - class Redirect; - class Insert; + class IOProcessor; + class Processor; class Location; class Playlist; } @@ -59,7 +59,7 @@ class RegionSelection; class Selectable; class AutomationTimeAxisView; class AutomationLine; -class RedirectAutomationLine; +class ProcessorAutomationLine; class TimeSelection; class RouteTimeAxisView : public RouteUI, public TimeAxisView @@ -128,13 +128,13 @@ protected: }; struct InsertAutomationInfo { - boost::shared_ptr<ARDOUR::Insert> insert; - bool valid; - Gtk::Menu* menu; - vector<InsertAutomationNode*> lines; + boost::shared_ptr<ARDOUR::Processor> processor; + bool valid; + Gtk::Menu* menu; + vector<InsertAutomationNode*> lines; - InsertAutomationInfo (boost::shared_ptr<ARDOUR::Insert> i) - : insert (i), valid (true), menu (0) {} + InsertAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i) + : processor (i), valid (true), menu (0) {} ~InsertAutomationInfo (); }; @@ -145,16 +145,16 @@ protected: gint edit_click (GdkEventButton *); - void inserts_changed (); + void processors_changed (); - void add_insert_to_subplugin_menu (boost::shared_ptr<ARDOUR::Insert>); + void add_processor_to_subplugin_menu (boost::shared_ptr<ARDOUR::Processor>); void remove_ran (InsertAutomationNode* ran); - void insert_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo*, + void processor_menu_item_toggled (RouteTimeAxisView::InsertAutomationInfo*, RouteTimeAxisView::InsertAutomationNode*); - void insert_automation_track_hidden (InsertAutomationNode*, - boost::shared_ptr<ARDOUR::Insert>); + void processor_automation_track_hidden (InsertAutomationNode*, + boost::shared_ptr<ARDOUR::Processor>); void automation_track_hidden (ARDOUR::ParamID param); @@ -162,17 +162,17 @@ protected: RouteAutomationNode* automation_track(ARDOUR::AutomationType type); InsertAutomationNode* - find_insert_automation_node (boost::shared_ptr<ARDOUR::Insert> i, ARDOUR::ParamID); + find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::ParamID); - RedirectAutomationLine* - find_insert_automation_curve (boost::shared_ptr<ARDOUR::Insert> i, ARDOUR::ParamID); + ProcessorAutomationLine* + find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::ParamID); - void add_insert_automation_curve (boost::shared_ptr<ARDOUR::Insert> r, ARDOUR::ParamID); - void add_existing_insert_automation_curves (boost::shared_ptr<ARDOUR::Insert>); + void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, ARDOUR::ParamID); + void add_existing_processor_automation_curves (boost::shared_ptr<ARDOUR::Processor>); void add_automation_child(ARDOUR::ParamID param, AutomationTimeAxisView* track); - void reset_insert_automation_curves (); + void reset_processor_automation_curves (); void take_name_changed (void *src); void route_name_changed (); @@ -222,7 +222,7 @@ protected: void color_handler (); void region_view_added (RegionView*); - void add_ghost_to_insert (RegionView*, AutomationTimeAxisView*); + void add_ghost_to_processor (RegionView*, AutomationTimeAxisView*); StreamView* _view; ArdourCanvas::Canvas& parent_canvas; @@ -230,7 +230,7 @@ protected: Gtk::HBox other_button_hbox; Gtk::Table button_table; - Gtk::Button insert_button; + Gtk::Button processor_button; Gtk::Button edit_group_button; Gtk::Button playlist_button; Gtk::Button size_button; @@ -257,8 +257,8 @@ protected: void _set_track_mode (ARDOUR::Track* track, ARDOUR::TrackMode mode, Gtk::RadioMenuItem* reset_item); void track_mode_changed (); - list<InsertAutomationInfo*> insert_automation; - vector<RedirectAutomationLine*> insert_automation_curves; + list<InsertAutomationInfo*> processor_automation; + vector<ProcessorAutomationLine*> processor_automation_curves; // Set from XML so context menu automation buttons can be correctly initialized set<ARDOUR::ParamID> _show_automation; diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index e727c2e56d..4a4fed5b75 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -98,7 +98,7 @@ class RouteUI : public virtual AxisView void solo_changed(void*); void solo_changed_so_update_mute (); void mute_changed(void*); - virtual void inserts_changed () {} + virtual void processors_changed () {} void route_rec_enable_changed(); void session_rec_enable_changed(); diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 7d68d9bbd0..43dd75df61 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -64,7 +64,7 @@ operator== (const Selection& a, const Selection& b) a.time == b.time && a.lines == b.lines && a.playlists == b.playlists && - a.inserts == b.inserts; + a.processors == b.processors; } /** Clear everything from the Selection */ @@ -77,7 +77,7 @@ Selection::clear () clear_lines(); clear_time (); clear_playlists (); - clear_inserts (); + clear_processors (); } void @@ -91,11 +91,11 @@ Selection::dump_region_layers() void -Selection::clear_inserts () +Selection::clear_processors () { - if (!inserts.empty()) { - inserts.clear (); - InsertsChanged (); + if (!processors.empty()) { + processors.clear (); + ProcessorsChanged (); } } @@ -154,16 +154,16 @@ Selection::clear_lines () } void -Selection::toggle (boost::shared_ptr<Insert> r) +Selection::toggle (boost::shared_ptr<Processor> r) { - InsertSelection::iterator i; + ProcessorSelection::iterator i; - if ((i = find (inserts.begin(), inserts.end(), r)) == inserts.end()) { - inserts.push_back (r); + if ((i = find (processors.begin(), processors.end(), r)) == processors.end()) { + processors.push_back (r); } else { - inserts.erase (i); + processors.erase (i); } - InsertsChanged(); + ProcessorsChanged(); } @@ -254,11 +254,11 @@ Selection::toggle (nframes_t start, nframes_t end) void -Selection::add (boost::shared_ptr<Insert> i) +Selection::add (boost::shared_ptr<Processor> i) { - if (find (inserts.begin(), inserts.end(), i) == inserts.end()) { - inserts.push_back (i); - InsertsChanged(); + if (find (processors.begin(), processors.end(), i) == processors.end()) { + processors.push_back (i); + ProcessorsChanged(); } } @@ -395,12 +395,12 @@ Selection::add (AutomationList* ac) } void -Selection::remove (boost::shared_ptr<Insert> r) +Selection::remove (boost::shared_ptr<Processor> r) { - InsertSelection::iterator i; - if ((i = find (inserts.begin(), inserts.end(), r)) != inserts.end()) { - inserts.erase (i); - InsertsChanged (); + ProcessorSelection::iterator i; + if ((i = find (processors.begin(), processors.end(), r)) != processors.end()) { + processors.erase (i); + ProcessorsChanged (); } } @@ -510,9 +510,9 @@ Selection::remove (AutomationList *ac) } void -Selection::set (boost::shared_ptr<Insert> i) +Selection::set (boost::shared_ptr<Processor> i) { - clear_inserts (); + clear_processors (); add (i); } @@ -625,7 +625,7 @@ Selection::empty () lines.empty () && time.empty () && playlists.empty () && - inserts.empty () + processors.empty () ; } diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h index 401531c30b..4ffb2bb9b0 100644 --- a/gtk2_ardour/selection.h +++ b/gtk2_ardour/selection.h @@ -30,7 +30,7 @@ #include "track_selection.h" #include "automation_selection.h" #include "playlist_selection.h" -#include "redirect_selection.h" +#include "processor_selection.h" #include "point_selection.h" class TimeAxisView; @@ -41,7 +41,7 @@ namespace ARDOUR { class Region; class AudioRegion; class Playlist; - class Insert; + class Processor; class AutomationList; } @@ -69,7 +69,7 @@ class Selection : public sigc::trackable TimeSelection time; AutomationSelection lines; PlaylistSelection playlists; - InsertSelection inserts; + ProcessorSelection processors; PointSelection points; Selection() { @@ -84,7 +84,7 @@ class Selection : public sigc::trackable sigc::signal<void> TimeChanged; sigc::signal<void> LinesChanged; sigc::signal<void> PlaylistsChanged; - sigc::signal<void> InsertsChanged; + sigc::signal<void> ProcessorsChanged; sigc::signal<void> PointsChanged; void clear (); @@ -107,7 +107,7 @@ class Selection : public sigc::trackable void set (ARDOUR::AutomationList*); void set (boost::shared_ptr<ARDOUR::Playlist>); void set (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&); - void set (boost::shared_ptr<ARDOUR::Insert>); + void set (boost::shared_ptr<ARDOUR::Processor>); void set (AutomationSelectable*); void toggle (TimeAxisView*); @@ -118,7 +118,7 @@ class Selection : public sigc::trackable void toggle (ARDOUR::AutomationList*); void toggle (boost::shared_ptr<ARDOUR::Playlist>); void toggle (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&); - void toggle (boost::shared_ptr<ARDOUR::Insert>); + void toggle (boost::shared_ptr<ARDOUR::Processor>); void toggle (const std::vector<AutomationSelectable*>&); void add (TimeAxisView*); @@ -129,7 +129,7 @@ class Selection : public sigc::trackable void add (ARDOUR::AutomationList*); void add (boost::shared_ptr<ARDOUR::Playlist>); void add (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&); - void add (boost::shared_ptr<ARDOUR::Insert>); + void add (boost::shared_ptr<ARDOUR::Processor>); void remove (TimeAxisView*); void remove (const std::list<TimeAxisView*>&); @@ -139,7 +139,7 @@ class Selection : public sigc::trackable void remove (ARDOUR::AutomationList*); void remove (boost::shared_ptr<ARDOUR::Playlist>); void remove (const std::list<boost::shared_ptr<ARDOUR::Playlist> >&); - void remove (boost::shared_ptr<ARDOUR::Insert>); + void remove (boost::shared_ptr<ARDOUR::Processor>); void remove (const list<Selectable*>&); void replace (uint32_t time_index, nframes_t start, nframes_t end); @@ -149,7 +149,7 @@ class Selection : public sigc::trackable void clear_time(); void clear_lines (); void clear_playlists (); - void clear_inserts (); + void clear_processors (); void clear_points (); void foreach_region (void (ARDOUR::Region::*method)(void)); diff --git a/gtk2_ardour/send_ui.h b/gtk2_ardour/send_ui.h index 2d041bb4fe..0cd4b1a265 100644 --- a/gtk2_ardour/send_ui.h +++ b/gtk2_ardour/send_ui.h @@ -26,7 +26,7 @@ namespace ARDOUR { class Send; class Session; - class Redirect; + class IOProcessor; } class IOSelector; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index b2121b26fb..9d368afe01 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -36,7 +36,7 @@ #include <ardour/session.h> #include <ardour/utils.h> #include <ardour/ladspa_plugin.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/location.h> #include "ardour_ui.h" diff --git a/gtk2_ardour/visual_time_axis.cc b/gtk2_ardour/visual_time_axis.cc index b685971144..83b95bb5d2 100644 --- a/gtk2_ardour/visual_time_axis.cc +++ b/gtk2_ardour/visual_time_axis.cc @@ -35,7 +35,7 @@ #include <ardour/session.h> #include <ardour/utils.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/location.h> #include "ardour_ui.h" diff --git a/gtk2_ardour/vst_pluginui.cc b/gtk2_ardour/vst_pluginui.cc index 1320ccdc7a..e1378dbb2a 100644 --- a/gtk2_ardour/vst_pluginui.cc +++ b/gtk2_ardour/vst_pluginui.cc @@ -19,7 +19,7 @@ #include <fst.h> #include <gtk/gtksocket.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/vst_plugin.h> #include "plugin_ui.h" diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript index e2e84c386c..6374047c1f 100644 --- a/libs/ardour/SConscript +++ b/libs/ardour/SConscript @@ -77,7 +77,8 @@ gdither.cc globals.cc import.cc automatable.cc -insert.cc +processor.cc +io_processor.cc plugin_insert.cc port_insert.cc io.cc @@ -92,7 +93,6 @@ playlist_factory.cc plugin.cc plugin_manager.cc recent_sessions.cc -redirect.cc region.cc region_factory.cc reverse.cc diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h index af1a3cb704..f76b12f41d 100644 --- a/libs/ardour/ardour/automation_event.h +++ b/libs/ardour/ardour/automation_event.h @@ -93,7 +93,7 @@ class AutomationList : public PBD::StatefulDestructible void reposition_for_rt_add (double when); void rt_add (double when, double value); void add (double when, double value); - /* this should be private but old-school automation loading needs it in IO/Redirect */ + /* this should be private but old-school automation loading needs it in IO/IOProcessor */ void fast_simple_add (double when, double value); void reset_range (double start, double end); diff --git a/libs/ardour/ardour/canvas_vars.h b/libs/ardour/ardour/canvas_vars.h index 35af35e2ac..2d9e7ae03c 100644 --- a/libs/ardour/ardour/canvas_vars.h +++ b/libs/ardour/ardour/canvas_vars.h @@ -9,7 +9,7 @@ CANVAS_VARIABLE(canvasvar_MidiBusBase, "midi bus base") CANVAS_VARIABLE(canvasvar_TimeStretchFill, "time-stretch-fill") CANVAS_VARIABLE(canvasvar_TimeStretchOutline, "time-stretch-outline") CANVAS_VARIABLE(canvasvar_AutomationLine, "automation line") -CANVAS_VARIABLE(canvasvar_RedirectAutomationLine, "redirect automation line") +CANVAS_VARIABLE(canvasvar_ProcessorAutomationLine, "processor automation line") CANVAS_VARIABLE(canvasvar_ControlPointFill, "control point fill") CANVAS_VARIABLE(canvasvar_ControlPointOutline, "control point outline") CANVAS_VARIABLE(canvasvar_EnteredControlPointOutline, "entered control point outline") diff --git a/libs/ardour/ardour/redirect.h b/libs/ardour/ardour/io_processor.h index bc12bb6a8a..c6224969b9 100644 --- a/libs/ardour/ardour/redirect.h +++ b/libs/ardour/ardour/io_processor.h @@ -32,7 +32,7 @@ #include <pbd/undo.h> #include <ardour/ardour.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/io.h> #include <ardour/automation_event.h> @@ -47,15 +47,15 @@ namespace ARDOUR { class Session; -/** A mixer strip element (Insert) with Jack ports (IO). +/** A mixer strip element (Processor) with Jack ports (IO). */ -class Redirect : public Insert +class IOProcessor : public Processor { public: - Redirect (Session&, const string& name, Placement, + IOProcessor (Session&, const string& name, Placement, int input_min = -1, int input_max = -1, int output_min = -1, int output_max = -1); - Redirect (const Redirect&); - virtual ~Redirect (); + IOProcessor (const IOProcessor&); + virtual ~IOProcessor (); virtual ChanCount output_streams() const { return _io->n_outputs(); } virtual ChanCount input_streams () const { return _io->n_inputs(); } @@ -70,8 +70,8 @@ class Redirect : public Insert virtual void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset) = 0; void silence (nframes_t nframes, nframes_t offset); - sigc::signal<void,Redirect*,bool> AutomationPlaybackChanged; - sigc::signal<void,Redirect*,uint32_t> AutomationChanged; + sigc::signal<void,IOProcessor*,bool> AutomationPlaybackChanged; + sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged; XMLNode& state (bool full_state); int set_state (const XMLNode&); diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index 7e0bf8ac53..c78cdebfb0 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -21,7 +21,7 @@ #include <vector> #include <ardour/types.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <pbd/fastlog.h> namespace ARDOUR { @@ -33,9 +33,9 @@ class Session; /** Meters peaks on the input and stores them for access. */ -class PeakMeter : public Insert { +class PeakMeter : public Processor { public: - PeakMeter(Session& s) : Insert(s, "meter", PreFader) {} + PeakMeter(Session& s) : Processor(s, "meter", PreFader) {} void reset (); void reset_max (); diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index df0460af84..ea8f78b62f 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -27,7 +27,7 @@ #include <ardour/ardour.h> #include <ardour/plugin_state.h> #include <ardour/types.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/automation_event.h> class XMLNode; @@ -40,7 +40,7 @@ class Plugin; /** Plugin inserts: send data through a plugin */ -class PluginInsert : public Insert +class PluginInsert : public Processor { public: PluginInsert (Session&, boost::shared_ptr<Plugin>, Placement); diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 5d9cd583cb..1f366ae259 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -26,7 +26,7 @@ #include <sigc++/signal.h> #include <ardour/ardour.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include <ardour/plugin_state.h> #include <ardour/types.h> @@ -37,10 +37,8 @@ namespace ARDOUR { class Session; /** Port inserts: send output to a Jack port, pick up input at a Jack port - * - * PortInsert IS-A Redirect IS-A Insert, IO */ -class PortInsert : public Redirect +class PortInsert : public IOProcessor { public: PortInsert (Session&, Placement); diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/processor.h index 3fc9fbd1e4..7d126e8e0c 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/processor.h @@ -17,8 +17,8 @@ */ -#ifndef __ardour_insert_h__ -#define __ardour_insert_h__ +#ifndef __ardour_processor_h__ +#define __ardour_processor_h__ #include <vector> #include <string> @@ -43,16 +43,16 @@ class Session; /* A mixer strip element - plugin, send, meter, etc. */ -class Insert : public Automatable +class Processor : public Automatable { public: static const string state_node_name; - Insert(Session&, const string& name, Placement p); // TODO: remove placement in favour of sort key + Processor(Session&, const string& name, Placement p); // TODO: remove placement in favour of sort key - virtual ~Insert() { } + virtual ~Processor() { } - static boost::shared_ptr<Insert> clone (boost::shared_ptr<const Insert>); + static boost::shared_ptr<Processor> clone (boost::shared_ptr<const Processor>); uint32_t sort_key() const { return _sort_key; } void set_sort_key (uint32_t key); @@ -93,7 +93,7 @@ class Insert : public Automatable void *get_gui () const { return _gui; } void set_gui (void *p) { _gui = p; } - static sigc::signal<void,Insert*> InsertCreated; + static sigc::signal<void,Processor*> ProcessorCreated; sigc::signal<void> ActiveChanged; sigc::signal<void> PlacementChanged; @@ -110,4 +110,4 @@ protected: } // namespace ARDOUR -#endif /* __ardour_insert_h__ */ +#endif /* __ardour_processor_h__ */ diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 4f5f863fee..008d8ffcbb 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -39,12 +39,12 @@ #include <ardour/ardour.h> #include <ardour/io.h> #include <ardour/session.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include <ardour/types.h> namespace ARDOUR { -class Insert; +class Processor; class Send; class RouteGroup; @@ -59,7 +59,7 @@ class Route : public IO { protected: - typedef list<boost::shared_ptr<Insert> > InsertList; + typedef list<boost::shared_ptr<Processor> > ProcessorList; public: @@ -100,7 +100,7 @@ class Route : public IO virtual bool can_record() { return false; } virtual void set_record_enable (bool yn, void *src) {} virtual bool record_enabled() const { return false; } - virtual void handle_transport_stopped (bool abort, bool did_locate, bool flush_inserts); + virtual void handle_transport_stopped (bool abort, bool did_locate, bool flush_processors); virtual void set_pending_declick (int); /* end of vfunc-based API */ @@ -137,54 +137,54 @@ class Route : public IO virtual void set_meter_point (MeterPoint, void *src); MeterPoint meter_point() const { return _meter_point; } - /* Inserts */ + /* Processors */ - void flush_inserts (); + void flush_processors (); - template<class T> void foreach_insert (T *obj, void (T::*func)(boost::shared_ptr<Insert>)) { - Glib::RWLock::ReaderLock lm (insert_lock); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + template<class T> void foreach_processor (T *obj, void (T::*func)(boost::shared_ptr<Processor>)) { + Glib::RWLock::ReaderLock lm (_processor_lock); + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (obj->*func) (*i); } } - boost::shared_ptr<Insert> nth_insert (uint32_t n) { - Glib::RWLock::ReaderLock lm (insert_lock); - InsertList::iterator i; - for (i = _inserts.begin(); i != _inserts.end() && n; ++i, --n); - if (i == _inserts.end()) { - return boost::shared_ptr<Redirect> (); + boost::shared_ptr<Processor> nth_processor (uint32_t n) { + Glib::RWLock::ReaderLock lm (_processor_lock); + ProcessorList::iterator i; + for (i = _processors.begin(); i != _processors.end() && n; ++i, --n); + if (i == _processors.end()) { + return boost::shared_ptr<IOProcessor> (); } else { return *i; } } - ChanCount max_insert_outs () const { return insert_max_outs; } + ChanCount max_processor_outs () const { return processor_max_outs; } ChanCount pre_fader_streams() const; - /** A record of the stream configuration at some point in the insert list. - * Used to return where and why an insert list configuration request failed. + /** A record of the stream configuration at some point in the processor list. + * Used to return where and why an processor list configuration request failed. */ - struct InsertStreams { - InsertStreams(size_t i=0, ChanCount c=ChanCount()) : index(i), count(c) {} + struct ProcessorStreams { + ProcessorStreams(size_t i=0, ChanCount c=ChanCount()) : index(i), count(c) {} - size_t index; ///< Index of insert where configuration failed - ChanCount count; ///< Input requested of insert + size_t index; ///< Index of processor where configuration failed + ChanCount count; ///< Input requested of processor }; - int add_insert (boost::shared_ptr<Insert>, InsertStreams* err = 0); - int add_inserts (const InsertList&, InsertStreams* err = 0); - int remove_insert (boost::shared_ptr<Insert>, InsertStreams* err = 0); - int copy_inserts (const Route&, Placement, InsertStreams* err = 0); - int sort_inserts (InsertStreams* err = 0); - void disable_inserts (Placement); - void disable_inserts (); + int add_processor (boost::shared_ptr<Processor>, ProcessorStreams* err = 0); + int add_processors (const ProcessorList&, ProcessorStreams* err = 0); + int remove_processor (boost::shared_ptr<Processor>, ProcessorStreams* err = 0); + int copy_processors (const Route&, Placement, ProcessorStreams* err = 0); + int sort_processors (ProcessorStreams* err = 0); + void disable_processors (Placement); + void disable_processors (); void disable_plugins (Placement); void disable_plugins (); void ab_plugins (bool forward); - void clear_inserts (Placement); - void all_inserts_flip(); - void all_inserts_active (Placement, bool state); + void clear_processors (Placement); + void all_processors_flip(); + void all_processors_active (Placement, bool state); virtual nframes_t update_total_latency(); nframes_t signal_latency() const { return _own_latency; } @@ -198,7 +198,7 @@ class Route : public IO sigc::signal<void,void*> post_fader_changed; sigc::signal<void,void*> control_outs_changed; sigc::signal<void,void*> main_outs_changed; - sigc::signal<void> inserts_changed; + sigc::signal<void> processors_changed; sigc::signal<void,void*> record_enable_changed; sigc::signal<void,void*> edit_group_changed; sigc::signal<void,void*> mix_group_changed; @@ -215,8 +215,8 @@ class Route : public IO int set_state(const XMLNode& node); virtual XMLNode& get_template(); - XMLNode& get_insert_state (); - int set_insert_state (const XMLNode&); + XMLNode& get_processor_state (); + int set_processor_state (const XMLNode&); sigc::signal<void,void*> SelectedChanged; @@ -290,29 +290,31 @@ class Route : public IO gain_t desired_solo_gain; gain_t desired_mute_gain; - nframes_t check_initial_delay (nframes_t, nframes_t&, nframes_t&); + nframes_t _initial_delay; nframes_t _roll_delay; nframes_t _own_latency; - InsertList _inserts; - Glib::RWLock insert_lock; - IO *_control_outs; - Glib::Mutex control_outs_lock; - RouteGroup *_edit_group; - RouteGroup *_mix_group; - std::string _comment; - bool _have_internal_generator; + ProcessorList _processors; + Glib::RWLock _processor_lock; + IO *_control_outs; + Glib::Mutex _control_outs_lock; + RouteGroup *_edit_group; + RouteGroup *_mix_group; + std::string _comment; + bool _have_internal_generator; ToggleControllable _solo_control; ToggleControllable _mute_control; + nframes_t check_initial_delay (nframes_t, nframes_t&, nframes_t&); + void passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter_inputs); virtual void process_output_buffers (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, - nframes_t nframes, nframes_t offset, bool with_inserts, int declick, + nframes_t nframes, nframes_t offset, bool with_processors, int declick, bool meter); protected: @@ -327,14 +329,14 @@ class Route : public IO sigc::connection input_signal_connection; - ChanCount insert_max_outs; + ChanCount processor_max_outs; uint32_t _remote_control_id; uint32_t pans_required() const; ChanCount n_process_buffers (); virtual int _set_state (const XMLNode&, bool call_base); - virtual void _set_insert_states (const XMLNodeList&); + virtual void _set_processor_states (const XMLNodeList&); private: void init (); @@ -355,24 +357,24 @@ class Route : public IO void input_change_handler (IOChange, void *src); void output_change_handler (IOChange, void *src); - int reset_plugin_counts (InsertStreams*); /* locked */ - int _reset_plugin_counts (InsertStreams*); /* unlocked */ + int reset_plugin_counts (ProcessorStreams*); /* locked */ + int _reset_plugin_counts (ProcessorStreams*); /* unlocked */ - /* insert I/O channels and plugin count handling */ + /* processor I/O channels and plugin count handling */ - struct InsertCount { - boost::shared_ptr<ARDOUR::Insert> insert; + struct ProcessorCount { + boost::shared_ptr<ARDOUR::Processor> processor; ChanCount in; ChanCount out; - InsertCount (boost::shared_ptr<ARDOUR::Insert> ins) : insert(ins) {} + ProcessorCount (boost::shared_ptr<ARDOUR::Processor> ins) : processor(ins) {} }; - int32_t apply_some_plugin_counts (std::list<InsertCount>& iclist); - bool check_some_plugin_counts (std::list<InsertCount>& iclist, ChanCount required_inputs, InsertStreams* err_streams); + int32_t apply_some_plugin_counts (std::list<ProcessorCount>& iclist); + bool check_some_plugin_counts (std::list<ProcessorCount>& iclist, ChanCount required_inputs, ProcessorStreams* err_streams); void set_deferred_state (); - void add_insert_from_xml (const XMLNode&); + void add_processor_from_xml (const XMLNode&); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index dc509514e2..26d0351bb2 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -28,11 +28,11 @@ #include <ardour/ardour.h> #include <ardour/audioengine.h> #include <ardour/io.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> namespace ARDOUR { -class Send : public Redirect +class Send : public IOProcessor { public: Send (Session&, Placement); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 9001196b60..3a4a21cb8a 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -87,9 +87,9 @@ class MidiDiskstream; class AudioFileSource; class MidiSource; class Auditioner; -class Insert; +class Processor; class Send; -class Redirect; +class IOProcessor; class PortInsert; class PluginInsert; class Bundle; @@ -1519,8 +1519,8 @@ class Session : public PBD::StatefulDestructible uint32_t insert_cnt; - void add_insert (Insert *); - void remove_insert (Insert *); + void add_processor (Processor *); + void remove_processor (Processor *); /* S/W RAID */ diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 5d87a13886..06ce398896 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -103,14 +103,14 @@ class Track : public Route TrackMode _mode; //private: (FIXME) - struct FreezeRecordInsertInfo { - FreezeRecordInsertInfo(XMLNode& st, boost::shared_ptr<Insert> ins) - : state (st), insert (ins) {} - - XMLNode state; - boost::shared_ptr<Insert> insert; - PBD::ID id; - UndoAction memento; + struct FreezeRecordProcessorInfo { + FreezeRecordProcessorInfo(XMLNode& st, boost::shared_ptr<Processor> proc) + : state (st), processor (proc) {} + + XMLNode state; + boost::shared_ptr<Processor> processor; + PBD::ID id; + UndoAction memento; }; struct FreezeRecord { @@ -120,10 +120,10 @@ class Track : public Route ~FreezeRecord(); - boost::shared_ptr<Playlist> playlist; - vector<FreezeRecordInsertInfo*> insert_info; - bool have_mementos; - FreezeState state; + boost::shared_ptr<Playlist> playlist; + vector<FreezeRecordProcessorInfo*> processor_info; + bool have_mementos; + FreezeState state; }; struct RecEnableControllable : public PBD::Controllable { @@ -135,11 +135,6 @@ class Track : public Route Track& track; }; - //virtual void diskstream_record_enable_changed (void *src) = 0; - //virtual void diskstream_input_channel_changed (void *src) = 0; - - //virtual void input_change_handler (void *src) = 0; - virtual void set_state_part_two () = 0; FreezeRecord _freeze_record; diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 151b434c6b..9f13aee465 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -27,12 +27,12 @@ #include <ardour/audio_track.h> #include <ardour/audio_diskstream.h> #include <ardour/session.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include <ardour/audioregion.h> #include <ardour/audiosource.h> #include <ardour/region_factory.h> #include <ardour/route_group_specialized.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/plugin_insert.h> #include <ardour/audioplaylist.h> #include <ardour/playlist_factory.h> @@ -304,8 +304,8 @@ AudioTrack::state(bool full_state) freeze_node->add_property ("playlist", _freeze_record.playlist->name()); freeze_node->add_property ("state", enum_2_string (_freeze_record.state)); - for (vector<FreezeRecordInsertInfo*>::iterator i = _freeze_record.insert_info.begin(); i != _freeze_record.insert_info.end(); ++i) { - inode = new XMLNode (X_("insert")); + for (vector<FreezeRecordProcessorInfo*>::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { + inode = new XMLNode (X_("processor")); (*i)->id.print (buf, sizeof (buf)); inode->add_property (X_("id"), buf); inode->add_child_copy ((*i)->state); @@ -360,10 +360,10 @@ AudioTrack::set_state_part_two () _freeze_record.have_mementos = false; _freeze_record.state = Frozen; - for (vector<FreezeRecordInsertInfo*>::iterator i = _freeze_record.insert_info.begin(); i != _freeze_record.insert_info.end(); ++i) { + for (vector<FreezeRecordProcessorInfo*>::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { delete *i; } - _freeze_record.insert_info.clear (); + _freeze_record.processor_info.clear (); if ((prop = fnode->property (X_("playlist"))) != 0) { boost::shared_ptr<Playlist> pl = _session.playlist_by_name (prop->value()); @@ -384,7 +384,7 @@ AudioTrack::set_state_part_two () XMLNodeList clist = fnode->children(); for (citer = clist.begin(); citer != clist.end(); ++citer) { - if ((*citer)->name() != X_("insert")) { + if ((*citer)->name() != X_("processor")) { continue; } @@ -392,10 +392,10 @@ AudioTrack::set_state_part_two () continue; } - FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo (*((*citer)->children().front()), - boost::shared_ptr<Insert>()); + FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo (*((*citer)->children().front()), + boost::shared_ptr<Processor>()); frii->id = prop->value (); - _freeze_record.insert_info.push_back (frii); + _freeze_record.processor_info.push_back (frii); } } @@ -515,7 +515,7 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream(); { - Glib::RWLock::ReaderLock lm (insert_lock, Glib::TRY_LOCK); + Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (lm.locked()) { // automation snapshot can also be called from the non-rt context // and it uses the redirect list, so we take the lock out here @@ -524,7 +524,7 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, } - if (n_outputs().n_total() == 0 && _inserts.empty()) { + if (n_outputs().n_total() == 0 && _processors.empty()) { return 0; } @@ -620,7 +620,7 @@ int AudioTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, bool can_record, bool rec_monitors_input) { - if (n_outputs().n_total() == 0 && _inserts.empty()) { + if (n_outputs().n_total() == 0 && _processors.empty()) { return 0; } @@ -643,12 +643,12 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes gain_t gain_automation[nframes]; gain_t gain_buffer[nframes]; float mix_buffer[nframes]; - InsertList::iterator i; + ProcessorList::iterator i; bool post_fader_work = false; gain_t this_gain = _gain; boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream(); - Glib::RWLock::ReaderLock rlock (insert_lock); + Glib::RWLock::ReaderLock rlock (_processor_lock); boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist()); assert(apl); @@ -677,17 +677,17 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes } - /* note: only run inserts during export. other layers in the machinery - will already have checked that there are no external port inserts. + /* note: only run processors during export. other layers in the machinery + will already have checked that there are no external port processors. */ - for (i = _inserts.begin(); i != _inserts.end(); ++i) { - boost::shared_ptr<Insert> insert; + for (i = _processors.begin(); i != _processors.end(); ++i) { + boost::shared_ptr<Processor> processor; - if ((insert = boost::dynamic_pointer_cast<Insert>(*i)) != 0) { - switch (insert->placement()) { + if ((processor = boost::dynamic_pointer_cast<Processor>(*i)) != 0) { + switch (processor->placement()) { case PreFader: - insert->run (buffers, start, start+nframes, nframes, 0); + processor->run (buffers, start, start+nframes, nframes, 0); break; case PostFader: post_fader_work = true; @@ -719,15 +719,15 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes if (post_fader_work) { - for (i = _inserts.begin(); i != _inserts.end(); ++i) { - boost::shared_ptr<PluginInsert> insert; + for (i = _processors.begin(); i != _processors.end(); ++i) { + boost::shared_ptr<PluginInsert> processor; - if ((insert = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { + if ((processor = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { switch ((*i)->placement()) { case PreFader: break; case PostFader: - insert->run (buffers, start, start+nframes, nframes, 0); + processor->run (buffers, start, start+nframes, nframes, 0); break; } } @@ -796,27 +796,27 @@ AudioTrack::freeze (InterThreadInfo& itt) return; } - _freeze_record.insert_info.clear (); + _freeze_record.processor_info.clear (); _freeze_record.have_mementos = true; { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); - for (InsertList::iterator r = _inserts.begin(); r != _inserts.end(); ++r) { + for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); ++r) { - boost::shared_ptr<Insert> insert; + boost::shared_ptr<Processor> processor; - if ((insert = boost::dynamic_pointer_cast<Insert>(*r)) != 0) { + if ((processor = boost::dynamic_pointer_cast<Processor>(*r)) != 0) { - FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo ((*r)->get_state(), insert); + FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo ((*r)->get_state(), processor); - frii->id = insert->id(); + frii->id = processor->id(); - _freeze_record.insert_info.push_back (frii); + _freeze_record.processor_info.push_back (frii); - /* now deactivate the insert */ + /* now deactivate the processor */ - insert->set_active (false); + processor->set_active (false); _session.set_dirty (); } } @@ -852,15 +852,15 @@ AudioTrack::unfreeze () if (_freeze_record.have_mementos) { - for (vector<FreezeRecordInsertInfo*>::iterator i = _freeze_record.insert_info.begin(); i != _freeze_record.insert_info.end(); ++i) { + for (vector<FreezeRecordProcessorInfo*>::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { (*i)->memento (); } } else { - Glib::RWLock::ReaderLock lm (insert_lock); // should this be a write lock? jlc - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { - for (vector<FreezeRecordInsertInfo*>::iterator ii = _freeze_record.insert_info.begin(); ii != _freeze_record.insert_info.end(); ++ii) { + Glib::RWLock::ReaderLock lm (_processor_lock); // should this be a write lock? jlc + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { + for (vector<FreezeRecordProcessorInfo*>::iterator ii = _freeze_record.processor_info.begin(); ii != _freeze_record.processor_info.end(); ++ii) { if ((*ii)->id == (*i)->id()) { (*i)->set_state (((*ii)->state)); break; diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 40ab7af769..9f3ba6deb6 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -122,8 +122,7 @@ Automatable::add_automation_parameter(AutomationList* al) /* let derived classes do whatever they need with this */ automation_list_creation_callback (al->param_id(), *al); - cerr << _name << ": added (visible, can_automate) parameter " << al->param_id().to_string() << ", # params = " - << _parameter_automation.size() << endl; + cerr << _name << ": added parameter " << al->param_id().to_string() << endl; // FIXME: sane default behaviour? _visible_parameter_automation.insert(al->param_id()); @@ -168,7 +167,7 @@ Automatable::automation_list (ParamID parameter, bool create_if_missing) return al; } else { - warning << "AutomationList " << parameter.to_string() << " not found for " << _name << endmsg; + //warning << "AutomationList " << parameter.to_string() << " not found for " << _name << endmsg; return NULL; } } @@ -181,7 +180,7 @@ Automatable::automation_list (ParamID parameter) const if (i != _parameter_automation.end()) { return i->second; } else { - warning << "AutomationList " << parameter.to_string() << " not found for " << _name << endmsg; + //warning << "AutomationList " << parameter.to_string() << " not found for " << _name << endmsg; return NULL; } } diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index 82d3e457cb..b620054558 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -1372,8 +1372,6 @@ AutomationList::set_state (const XMLNode& node) warning << "Legacy session: automation list has no automation-id property."; } - cerr << "Loaded automation " << _param_id.to_string() << endl; - if ((prop = node.property (X_("default"))) != 0){ _default_value = atof (prop->value()); } else { diff --git a/libs/ardour/redirect.cc b/libs/ardour/io_processor.cc index ef01f3437a..9802c83330 100644 --- a/libs/ardour/redirect.cc +++ b/libs/ardour/io_processor.cc @@ -29,7 +29,7 @@ #include <pbd/xml++.h> #include <pbd/enumwriter.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include <ardour/session.h> #include <ardour/utils.h> #include <ardour/send.h> @@ -42,10 +42,10 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -Redirect::Redirect (Session& s, const string& name, Placement p, +IOProcessor::IOProcessor (Session& s, const string& name, Placement p, int input_min, int input_max, int output_min, int output_max) - : Insert(s, name, p) + : Processor(s, name, p) , _io(new IO(s, name, input_min, input_max, output_min, output_max)) { _active = false; @@ -54,15 +54,15 @@ Redirect::Redirect (Session& s, const string& name, Placement p, _extra_xml = 0; } -Redirect::~Redirect () +IOProcessor::~IOProcessor () { notify_callbacks (); } XMLNode& -Redirect::state (bool full_state) +IOProcessor::state (bool full_state) { - XMLNode& node = Insert::state(full_state); + XMLNode& node = Processor::state(full_state); node.add_child_nocopy (_io->state (full_state)); @@ -70,11 +70,11 @@ Redirect::state (bool full_state) } int -Redirect::set_state (const XMLNode& node) +IOProcessor::set_state (const XMLNode& node) { const XMLProperty *prop; - Insert::set_state(node); + Processor::set_state(node); XMLNodeList nlist = node.children(); XMLNodeIterator niter; @@ -101,7 +101,7 @@ Redirect::set_state (const XMLNode& node) } void -Redirect::silence (nframes_t nframes, nframes_t offset) +IOProcessor::silence (nframes_t nframes, nframes_t offset) { _io->silence(nframes, offset); } diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index a7a287e9c1..fb8dafbc7b 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -118,7 +118,7 @@ PeakMeter::configure_io (ChanCount in, ChanCount out) assert(_visible_peak_power.size() == limit); assert(_max_peak_power.size() == limit); - Insert::configure_io(in, out); + Processor::configure_io(in, out); return true; } diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 3385727f0e..71a2735606 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -26,11 +26,11 @@ #include <ardour/midi_track.h> #include <ardour/midi_diskstream.h> #include <ardour/session.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include <ardour/midi_region.h> #include <ardour/midi_source.h> #include <ardour/route_group_specialized.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/midi_playlist.h> #include <ardour/panner.h> #include <ardour/utils.h> @@ -219,8 +219,8 @@ MidiTrack::state(bool full_state) freeze_node->add_property ("playlist", _freeze_record.playlist->name()); freeze_node->add_property ("state", enum_2_string (_freeze_record.state)); - for (vector<FreezeRecordInsertInfo*>::iterator i = _freeze_record.insert_info.begin(); i != _freeze_record.insert_info.end(); ++i) { - inode = new XMLNode (X_("insert")); + for (vector<FreezeRecordProcessorInfo*>::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { + inode = new XMLNode (X_("processor")); (*i)->id.print (buf, sizeof(buf)); inode->add_property (X_("id"), buf); inode->add_child_copy ((*i)->state); @@ -275,10 +275,10 @@ MidiTrack::set_state_part_two () _freeze_record.have_mementos = false; _freeze_record.state = Frozen; - for (vector<FreezeRecordInsertInfo*>::iterator i = _freeze_record.insert_info.begin(); i != _freeze_record.insert_info.end(); ++i) { + for (vector<FreezeRecordProcessorInfo*>::iterator i = _freeze_record.processor_info.begin(); i != _freeze_record.processor_info.end(); ++i) { delete *i; } - _freeze_record.insert_info.clear (); + _freeze_record.processor_info.clear (); if ((prop = fnode->property (X_("playlist"))) != 0) { boost::shared_ptr<Playlist> pl = _session.playlist_by_name (prop->value()); @@ -299,7 +299,7 @@ MidiTrack::set_state_part_two () XMLNodeList clist = fnode->children(); for (citer = clist.begin(); citer != clist.end(); ++citer) { - if ((*citer)->name() != X_("insert")) { + if ((*citer)->name() != X_("processor")) { continue; } @@ -307,10 +307,10 @@ MidiTrack::set_state_part_two () continue; } - FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo (*((*citer)->children().front()), - boost::shared_ptr<Insert>()); + FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo (*((*citer)->children().front()), + boost::shared_ptr<Processor>()); frii->id = prop->value (); - _freeze_record.insert_info.push_back (frii); + _freeze_record.processor_info.push_back (frii); } } @@ -427,7 +427,7 @@ MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, int dret; boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream(); - if (n_outputs().n_total() == 0 && _inserts.empty()) { + if (n_outputs().n_total() == 0 && _processors.empty()) { return 0; } @@ -498,7 +498,7 @@ int MidiTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, bool can_record, bool rec_monitors_input) { - if (n_outputs().n_midi() == 0 && _inserts.empty()) { + if (n_outputs().n_midi() == 0 && _processors.empty()) { return 0; } @@ -518,7 +518,7 @@ MidiTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_ void MidiTrack::process_output_buffers (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, - nframes_t nframes, nframes_t offset, bool with_inserts, int declick, + nframes_t nframes, nframes_t offset, bool with_processors, int declick, bool meter) { /* There's no such thing as a MIDI bus for the time being. @@ -529,11 +529,11 @@ MidiTrack::process_output_buffers (BufferSet& bufs, _meter->run(bufs, start_frame, end_frame, nframes, offset); } - // Run all inserts - if (with_inserts) { - Glib::RWLock::ReaderLock rm (insert_lock, Glib::TRY_LOCK); + // Run all processors + if (with_processors) { + Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK); if (rm.locked()) { - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->run (bufs, start_frame, end_frame, nframes, offset); } } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 1b0130fc37..0ec5dde0db 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -53,7 +53,7 @@ using namespace PBD; const string PluginInsert::port_automation_node_name = "PortAutomation"; PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug, Placement placement) - : Insert (s, plug->name(), placement) + : Processor (s, plug->name(), placement) { /* the first is the master */ @@ -68,11 +68,11 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug, Placemen IO::MoreChannels (max(input_streams(), output_streams())); } - InsertCreated (this); /* EMIT SIGNAL */ + ProcessorCreated (this); /* EMIT SIGNAL */ } PluginInsert::PluginInsert (Session& s, const XMLNode& node) - : Insert (s, "unnamed plugin insert", PreFader) + : Processor (s, "unnamed plugin insert", PreFader) { if (set_state (node)) { throw failed_constructor(); @@ -89,7 +89,7 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node) } PluginInsert::PluginInsert (const PluginInsert& other) - : Insert (other._session, other._name, other.placement()) + : Processor (other._session, other._name, other.placement()) { uint32_t count = other._plugins.size(); @@ -103,7 +103,7 @@ PluginInsert::PluginInsert (const PluginInsert& other) init (); - InsertCreated (this); /* EMIT SIGNAL */ + ProcessorCreated (this); /* EMIT SIGNAL */ } bool @@ -496,7 +496,7 @@ PluginInsert::configure_io (ChanCount in, ChanCount out) } else { bool success = set_count (count_for_configuration(in, out)); if (success) - Insert::configure_io(in, out); + Processor::configure_io(in, out); return success; } } @@ -634,7 +634,7 @@ XMLNode& PluginInsert::state (bool full) { char buf[256]; - XMLNode& node = Insert::state (full); + XMLNode& node = Processor::state (full); node.add_property ("type", _plugins[0]->state_node_name()); snprintf(buf, sizeof(buf), "%s", _plugins[0]->name()); @@ -745,15 +745,15 @@ PluginInsert::set_state(const XMLNode& node) const XMLNode* insert_node = &node; - // legacy sessions: search for child Redirect node + // legacy sessions: search for child IOProcessor node for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == "Redirect") { + if ((*niter)->name() == "IOProcessor") { insert_node = *niter; break; } } - Insert::set_state (*insert_node); + Processor::set_state (*insert_node); /* look for port automation node */ diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index 51bf8fb0fb..0c12c0ed2c 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -41,17 +41,17 @@ using namespace ARDOUR; using namespace PBD; PortInsert::PortInsert (Session& s, Placement p) - : Redirect (s, string_compose (_("insert %1"), (bitslot = s.next_insert_id()) + 1), p, 1, -1, 1, -1) + : IOProcessor (s, string_compose (_("insert %1"), (bitslot = s.next_insert_id()) + 1), p, 1, -1, 1, -1) { init (); - InsertCreated (this); /* EMIT SIGNAL */ + ProcessorCreated (this); /* EMIT SIGNAL */ } PortInsert::PortInsert (const PortInsert& other) - : Redirect (other._session, string_compose (_("insert %1"), (bitslot = other._session.next_insert_id()) + 1), other.placement(), 1, -1, 1, -1) + : IOProcessor (other._session, string_compose (_("insert %1"), (bitslot = other._session.next_insert_id()) + 1), other.placement(), 1, -1, 1, -1) { init (); - InsertCreated (this); /* EMIT SIGNAL */ + ProcessorCreated (this); /* EMIT SIGNAL */ } void @@ -69,13 +69,13 @@ PortInsert::init () } PortInsert::PortInsert (Session& s, const XMLNode& node) - : Redirect (s, "unnamed port insert", PreFader) + : IOProcessor (s, "unnamed port insert", PreFader) { if (set_state (node)) { throw failed_constructor(); } - InsertCreated (this); /* EMIT SIGNAL */ + ProcessorCreated (this); /* EMIT SIGNAL */ } PortInsert::~PortInsert () @@ -110,7 +110,7 @@ PortInsert::get_state(void) XMLNode& PortInsert::state (bool full) { - XMLNode& node = Redirect::state(full); + XMLNode& node = IOProcessor::state(full); char buf[32]; node.add_property ("type", "port"); snprintf (buf, sizeof (buf), "%" PRIu32, bitslot); @@ -146,15 +146,15 @@ PortInsert::set_state(const XMLNode& node) const XMLNode* insert_node = &node; - // legacy sessions: search for child Redirect node + // legacy sessions: search for child IOProcessor node for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == "Redirect") { + if ((*niter)->name() == "IOProcessor") { insert_node = *niter; break; } } - Redirect::set_state (*insert_node); + IOProcessor::set_state (*insert_node); return 0; } @@ -227,7 +227,7 @@ PortInsert::configure_io (ChanCount in, ChanCount out) bool success = (_io->ensure_io (out, in, false, this) == 0); if (success) - return Insert::configure_io(in, out); + return Processor::configure_io(in, out); else return false; } diff --git a/libs/ardour/insert.cc b/libs/ardour/processor.cc index 1e73c398c2..b192eb85c1 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/processor.cc @@ -25,7 +25,7 @@ #include <pbd/enumwriter.h> #include <pbd/xml++.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/plugin.h> #include <ardour/port.h> #include <ardour/route.h> @@ -53,12 +53,12 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -sigc::signal<void,Insert*> Insert::InsertCreated; +sigc::signal<void,Processor*> Processor::ProcessorCreated; -// Always saved as Insert, but may be Redirect or Send in legacy sessions -const string Insert::state_node_name = "Insert"; +// Always saved as Processor, but may be IOProcessor or Send in legacy sessions +const string Processor::state_node_name = "Processor"; -Insert::Insert(Session& session, const string& name, Placement p) +Processor::Processor(Session& session, const string& name, Placement p) : Automatable(session, name) , _active(false) , _next_ab_is_active(false) @@ -68,35 +68,35 @@ Insert::Insert(Session& session, const string& name, Placement p) { } -boost::shared_ptr<Insert> -Insert::clone (boost::shared_ptr<const Insert> other) +boost::shared_ptr<Processor> +Processor::clone (boost::shared_ptr<const Processor> other) { boost::shared_ptr<const Send> send; boost::shared_ptr<const PortInsert> port_insert; boost::shared_ptr<const PluginInsert> plugin_insert; if ((send = boost::dynamic_pointer_cast<const Send>(other)) != 0) { - return boost::shared_ptr<Insert> (new Send (*send)); + return boost::shared_ptr<Processor> (new Send (*send)); } else if ((port_insert = boost::dynamic_pointer_cast<const PortInsert>(other)) != 0) { - return boost::shared_ptr<Insert> (new PortInsert (*port_insert)); + return boost::shared_ptr<Processor> (new PortInsert (*port_insert)); } else if ((plugin_insert = boost::dynamic_pointer_cast<const PluginInsert>(other)) != 0) { - return boost::shared_ptr<Insert> (new PluginInsert (*plugin_insert)); + return boost::shared_ptr<Processor> (new PluginInsert (*plugin_insert)); } else { - fatal << _("programming error: unknown Insert type in Insert::Clone!\n") + fatal << _("programming error: unknown Processor type in Processor::Clone!\n") << endmsg; /*NOTREACHED*/ } - return boost::shared_ptr<Insert>(); + return boost::shared_ptr<Processor>(); } void -Insert::set_sort_key (uint32_t key) +Processor::set_sort_key (uint32_t key) { _sort_key = key; } void -Insert::set_placement (Placement p) +Processor::set_placement (Placement p) { if (_placement != p) { _placement = p; @@ -105,14 +105,14 @@ Insert::set_placement (Placement p) } void -Insert::set_active (bool yn) +Processor::set_active (bool yn) { _active = yn; ActiveChanged (); } XMLNode& -Insert::get_state (void) +Processor::get_state (void) { return state (true); } @@ -132,7 +132,7 @@ Insert::get_state (void) */ XMLNode& -Insert::state (bool full_state) +Processor::state (bool full_state) { XMLNode* node = new XMLNode (state_node_name); stringstream sstr; @@ -173,7 +173,7 @@ Insert::state (bool full_state) } int -Insert::set_state (const XMLNode& node) +Processor::set_state (const XMLNode& node) { const XMLProperty *prop; @@ -184,7 +184,6 @@ Insert::set_state (const XMLNode& node) XMLNodeList nlist = node.children(); XMLNodeIterator niter; - bool have_io = false; for (niter = nlist.begin(); niter != nlist.end(); ++niter) { @@ -221,13 +220,8 @@ Insert::set_state (const XMLNode& node) } } - if (!have_io && dynamic_cast<IO*>(this)) { - error << _("XML node describing a redirect is missing an IO node") << endmsg; - return -1; - } - if ((prop = node.property ("active")) == 0) { - error << _("XML node describing an insert is missing the `active' field") << endmsg; + error << _("XML node describing a processor is missing the `active' field") << endmsg; return -1; } @@ -237,7 +231,7 @@ Insert::set_state (const XMLNode& node) } if ((prop = node.property ("placement")) == 0) { - error << _("XML node describing an insert is missing the `placement' field") << endmsg; + error << _("XML node describing a processor is missing the `placement' field") << endmsg; return -1; } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 3353149efa..d8ecabb1c0 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -29,7 +29,7 @@ #include <ardour/audioengine.h> #include <ardour/route.h> #include <ardour/buffer.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/plugin_insert.h> #include <ardour/port_insert.h> #include <ardour/send.h> @@ -76,7 +76,7 @@ Route::Route (Session& sess, const XMLNode& node, DataType default_type) void Route::init () { - insert_max_outs.reset(); + processor_max_outs.reset(); _muted = false; _soloed = false; _solo_safe = false; @@ -115,8 +115,8 @@ Route::init () Route::~Route () { - clear_inserts (PreFader); - clear_inserts (PostFader); + clear_processors (PreFader); + clear_processors (PostFader); for (OrderKeys::iterator i = order_keys.begin(); i != order_keys.end(); ++i) { free ((void*)(i->first)); @@ -238,13 +238,13 @@ Route::set_gain (gain_t val, void *src) void Route::process_output_buffers (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, - nframes_t nframes, nframes_t offset, bool with_inserts, int declick, + nframes_t nframes, nframes_t offset, bool with_processors, int declick, bool meter) { // This is definitely very audio-only for now assert(_default_type == DataType::AUDIO); - InsertList::iterator i; + ProcessorList::iterator i; bool post_fader_work = false; bool mute_declick_applied = false; gain_t dmg, dsg, dg; @@ -266,7 +266,7 @@ Route::process_output_buffers (BufferSet& bufs, declick = _pending_declick; { - Glib::Mutex::Lock cm (control_outs_lock, Glib::TRY_LOCK); + Glib::Mutex::Lock cm (_control_outs_lock, Glib::TRY_LOCK); if (cm.locked()) { co = _control_outs; @@ -373,11 +373,11 @@ Route::process_output_buffers (BufferSet& bufs, PRE-FADER REDIRECTS -------------------------------------------------------------------------------------------------- */ - if (with_inserts) { - Glib::RWLock::ReaderLock rm (insert_lock, Glib::TRY_LOCK); + if (with_processors) { + Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK); if (rm.locked()) { if (mute_gain > 0 || !_mute_affects_pre_fader) { - for (i = _inserts.begin(); i != _inserts.end(); ++i) { + for (i = _processors.begin(); i != _processors.end(); ++i) { switch ((*i)->placement()) { case PreFader: (*i)->run (bufs, start_frame, end_frame, nframes, offset); @@ -388,7 +388,7 @@ Route::process_output_buffers (BufferSet& bufs, } } } else { - for (i = _inserts.begin(); i != _inserts.end(); ++i) { + for (i = _processors.begin(); i != _processors.end(); ++i) { switch ((*i)->placement()) { case PreFader: (*i)->silence (nframes, offset); @@ -538,14 +538,14 @@ Route::process_output_buffers (BufferSet& bufs, POST-FADER REDIRECTS -------------------------------------------------------------------------------------------------- */ - /* note that post_fader_work cannot be true unless with_inserts was also true, so don't test both */ + /* note that post_fader_work cannot be true unless with_processors was also true, so don't test both */ if (post_fader_work) { - Glib::RWLock::ReaderLock rm (insert_lock, Glib::TRY_LOCK); + Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK); if (rm.locked()) { if (mute_gain > 0 || !_mute_affects_post_fader) { - for (i = _inserts.begin(); i != _inserts.end(); ++i) { + for (i = _processors.begin(); i != _processors.end(); ++i) { switch ((*i)->placement()) { case PreFader: break; @@ -555,7 +555,7 @@ Route::process_output_buffers (BufferSet& bufs, } } } else { - for (i = _inserts.begin(); i != _inserts.end(); ++i) { + for (i = _processors.begin(); i != _processors.end(); ++i) { switch ((*i)->placement()) { case PreFader: break; @@ -651,7 +651,7 @@ Route::process_output_buffers (BufferSet& bufs, ) { /* don't use Route::silence() here, because that causes - all outputs (sends, port inserts, etc. to be silent). + all outputs (sends, port processors, etc. to be silent). */ if (_meter_point == MeterPostFader) { @@ -684,7 +684,7 @@ Route::process_output_buffers (BufferSet& bufs, ChanCount Route::n_process_buffers () { - return max (n_inputs(), insert_max_outs); + return max (n_inputs(), processor_max_outs); } void @@ -770,23 +770,23 @@ Route::set_mute (bool yn, void *src) } int -Route::add_insert (boost::shared_ptr<Insert> insert, InsertStreams* err) +Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorStreams* err) { - ChanCount old_rmo = insert_max_outs; + ChanCount old_rmo = processor_max_outs; if (!_session.engine().connected()) { return 1; } { - Glib::RWLock::WriterLock lm (insert_lock); + Glib::RWLock::WriterLock lm (_processor_lock); boost::shared_ptr<PluginInsert> pi; boost::shared_ptr<PortInsert> porti; - //insert->set_default_type(_default_type); + //processor->set_default_type(_default_type); - if ((pi = boost::dynamic_pointer_cast<PluginInsert>(insert)) != 0) { + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(processor)) != 0) { pi->set_count (1); if (pi->natural_input_streams() == ChanCount::ZERO) { @@ -796,51 +796,51 @@ Route::add_insert (boost::shared_ptr<Insert> insert, InsertStreams* err) } - _inserts.push_back (insert); + _processors.push_back (processor); - // Set up insert list channels. This will set insert->[input|output]_streams(), + // Set up processor list channels. This will set processor->[input|output]_streams(), // configure redirect ports properly, etc. if (_reset_plugin_counts (err)) { - _inserts.pop_back (); + _processors.pop_back (); _reset_plugin_counts (0); // it worked before we tried to add it ... return -1; } // Ensure peak vector sizes before the plugin is activated - ChanCount potential_max_streams = max(insert->input_streams(), insert->output_streams()); + ChanCount potential_max_streams = max(processor->input_streams(), processor->output_streams()); _meter->configure_io(potential_max_streams, potential_max_streams); - insert->activate (); - insert->ActiveChanged.connect (bind (mem_fun (_session, &Session::update_latency_compensation), false, false)); + processor->activate (); + processor->ActiveChanged.connect (bind (mem_fun (_session, &Session::update_latency_compensation), false, false)); } - if (insert_max_outs != old_rmo || old_rmo == ChanCount::ZERO) { + if (processor_max_outs != old_rmo || old_rmo == ChanCount::ZERO) { reset_panner (); } - inserts_changed (); /* EMIT SIGNAL */ + processors_changed (); /* EMIT SIGNAL */ return 0; } int -Route::add_inserts (const InsertList& others, InsertStreams* err) +Route::add_processors (const ProcessorList& others, ProcessorStreams* err) { - ChanCount old_rmo = insert_max_outs; + ChanCount old_rmo = processor_max_outs; if (!_session.engine().connected()) { return 1; } { - Glib::RWLock::WriterLock lm (insert_lock); + Glib::RWLock::WriterLock lm (_processor_lock); - InsertList::iterator existing_end = _inserts.end(); + ProcessorList::iterator existing_end = _processors.end(); --existing_end; ChanCount potential_max_streams; - for (InsertList::const_iterator i = others.begin(); i != others.end(); ++i) { + for (ProcessorList::const_iterator i = others.begin(); i != others.end(); ++i) { boost::shared_ptr<PluginInsert> pi; @@ -855,11 +855,11 @@ Route::add_inserts (const InsertList& others, InsertStreams* err) // Ensure peak vector sizes before the plugin is activated _meter->configure_io(potential_max_streams, potential_max_streams); - _inserts.push_back (*i); + _processors.push_back (*i); if (_reset_plugin_counts (err)) { ++existing_end; - _inserts.erase (existing_end, _inserts.end()); + _processors.erase (existing_end, _processors.end()); _reset_plugin_counts (0); // it worked before we tried to add it ... return -1; } @@ -869,24 +869,24 @@ Route::add_inserts (const InsertList& others, InsertStreams* err) } } - if (insert_max_outs != old_rmo || old_rmo == ChanCount::ZERO) { + if (processor_max_outs != old_rmo || old_rmo == ChanCount::ZERO) { reset_panner (); } - inserts_changed (); /* EMIT SIGNAL */ + processors_changed (); /* EMIT SIGNAL */ return 0; } -/** Turn off all inserts with a given placement - * @param p Placement of inserts to disable +/** Turn off all processors with a given placement + * @param p Placement of processors to disable */ void -Route::disable_inserts (Placement p) +Route::disable_processors (Placement p) { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->placement() == p) { (*i)->set_active (false); } @@ -899,11 +899,11 @@ Route::disable_inserts (Placement p) */ void -Route::disable_inserts () +Route::disable_processors () { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->set_active (false); } @@ -917,9 +917,9 @@ Route::disable_inserts () void Route::disable_plugins (Placement p) { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if (boost::dynamic_pointer_cast<PluginInsert> (*i) && (*i)->placement() == p) { (*i)->set_active (false); } @@ -934,9 +934,9 @@ Route::disable_plugins (Placement p) void Route::disable_plugins () { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if (boost::dynamic_pointer_cast<PluginInsert> (*i)) { (*i)->set_active (false); } @@ -949,7 +949,7 @@ Route::disable_plugins () void Route::ab_plugins (bool forward) { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); if (forward) { @@ -957,7 +957,7 @@ Route::ab_plugins (bool forward) we go the other way, we will revert them */ - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) { continue; } @@ -974,7 +974,7 @@ Route::ab_plugins (bool forward) /* backward = if the redirect was marked to go active on the next ab, do so */ - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) { continue; @@ -996,40 +996,40 @@ Route::ab_plugins (bool forward) ChanCount Route::pre_fader_streams() const { - boost::shared_ptr<Insert> insert; + boost::shared_ptr<Processor> processor; // Find the last pre-fader redirect - for (InsertList::const_iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->placement() == PreFader) { - insert = *i; + processor = *i; } } - if (insert) { - return insert->output_streams(); + if (processor) { + return processor->output_streams(); } else { return n_inputs (); } } -/** Remove inserts with a given placement. - * @param p Placement of inserts to remove. +/** Remove processors with a given placement. + * @param p Placement of processors to remove. */ void -Route::clear_inserts (Placement p) +Route::clear_processors (Placement p) { - const ChanCount old_rmo = insert_max_outs; + const ChanCount old_rmo = processor_max_outs; if (!_session.engine().connected()) { return; } { - Glib::RWLock::WriterLock lm (insert_lock); - InsertList new_list; + Glib::RWLock::WriterLock lm (_processor_lock); + ProcessorList new_list; - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->placement() == p) { /* it's the placement we want to get rid of */ (*i)->drop_references (); @@ -1039,42 +1039,42 @@ Route::clear_inserts (Placement p) } } - _inserts = new_list; + _processors = new_list; } /* FIXME: can't see how this test can ever fire */ - if (insert_max_outs != old_rmo) { + if (processor_max_outs != old_rmo) { reset_panner (); } - insert_max_outs.reset(); + processor_max_outs.reset(); _have_internal_generator = false; - inserts_changed (); /* EMIT SIGNAL */ + processors_changed (); /* EMIT SIGNAL */ } int -Route::remove_insert (boost::shared_ptr<Insert> insert, InsertStreams* err) +Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStreams* err) { - ChanCount old_rmo = insert_max_outs; + ChanCount old_rmo = processor_max_outs; if (!_session.engine().connected()) { return 1; } - insert_max_outs.reset(); + processor_max_outs.reset(); { - Glib::RWLock::WriterLock lm (insert_lock); - InsertList::iterator i; + Glib::RWLock::WriterLock lm (_processor_lock); + ProcessorList::iterator i; bool removed = false; - for (i = _inserts.begin(); i != _inserts.end(); ++i) { - if (*i == insert) { + for (i = _processors.begin(); i != _processors.end(); ++i) { + if (*i == processor) { - InsertList::iterator tmp; + ProcessorList::iterator tmp; /* move along, see failure case for reset_plugin_counts() - where we may need to reinsert the insert. + where we may need to reprocessor the processor. */ tmp = i; @@ -1085,14 +1085,14 @@ Route::remove_insert (boost::shared_ptr<Insert> insert, InsertStreams* err) run. */ - boost::shared_ptr<Redirect> redirect; + boost::shared_ptr<IOProcessor> redirect; - if ((redirect = boost::dynamic_pointer_cast<Redirect> (*i)) != 0) { + if ((redirect = boost::dynamic_pointer_cast<IOProcessor> (*i)) != 0) { redirect->io()->disconnect_inputs (this); redirect->io()->disconnect_outputs (this); } - _inserts.erase (i); + _processors.erase (i); i = tmp; removed = true; @@ -1107,7 +1107,7 @@ Route::remove_insert (boost::shared_ptr<Insert> insert, InsertStreams* err) if (_reset_plugin_counts (err)) { /* get back to where we where */ - _inserts.insert (i, insert); + _processors.insert (i, processor); /* we know this will work, because it worked before :) */ _reset_plugin_counts (0); return -1; @@ -1115,7 +1115,7 @@ Route::remove_insert (boost::shared_ptr<Insert> insert, InsertStreams* err) bool foo = false; - for (i = _inserts.begin(); i != _inserts.end(); ++i) { + for (i = _processors.begin(); i != _processors.end(); ++i) { boost::shared_ptr<PluginInsert> pi; if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { @@ -1128,55 +1128,55 @@ Route::remove_insert (boost::shared_ptr<Insert> insert, InsertStreams* err) _have_internal_generator = foo; } - if (old_rmo != insert_max_outs) { + if (old_rmo != processor_max_outs) { reset_panner (); } - insert->drop_references (); + processor->drop_references (); - inserts_changed (); /* EMIT SIGNAL */ + processors_changed (); /* EMIT SIGNAL */ return 0; } int -Route::reset_plugin_counts (InsertStreams* err) +Route::reset_plugin_counts (ProcessorStreams* err) { - Glib::RWLock::WriterLock lm (insert_lock); + Glib::RWLock::WriterLock lm (_processor_lock); return _reset_plugin_counts (err); } int -Route::_reset_plugin_counts (InsertStreams* err) +Route::_reset_plugin_counts (ProcessorStreams* err) { - InsertList::iterator r; - map<Placement,list<InsertCount> > insert_map; + ProcessorList::iterator r; + map<Placement,list<ProcessorCount> > processor_map; ChanCount initial_streams; /* Process each placement in order, checking to see if we can really do what has been requested. */ - /* divide inserts up by placement so we get the signal flow - properly modelled. we need to do this because the _inserts + /* divide processors up by placement so we get the signal flow + properly modelled. we need to do this because the _processors list is not sorted by placement */ /* ... but it should/will be... */ - for (r = _inserts.begin(); r != _inserts.end(); ++r) { + for (r = _processors.begin(); r != _processors.end(); ++r) { - boost::shared_ptr<Insert> insert; + boost::shared_ptr<Processor> processor; - if ((insert = boost::dynamic_pointer_cast<Insert>(*r)) != 0) { - insert_map[insert->placement()].push_back (InsertCount (insert)); + if ((processor = boost::dynamic_pointer_cast<Processor>(*r)) != 0) { + processor_map[processor->placement()].push_back (ProcessorCount (processor)); } } /* A: PreFader */ - if ( ! check_some_plugin_counts (insert_map[PreFader], n_inputs (), err)) { + if ( ! check_some_plugin_counts (processor_map[PreFader], n_inputs (), err)) { return -1; } @@ -1184,22 +1184,22 @@ Route::_reset_plugin_counts (InsertStreams* err) /* B: PostFader */ - if ( ! check_some_plugin_counts (insert_map[PostFader], post_fader_input, err)) { + if ( ! check_some_plugin_counts (processor_map[PostFader], post_fader_input, err)) { return -1; } /* OK, everything can be set up correctly, so lets do it */ - apply_some_plugin_counts (insert_map[PreFader]); - apply_some_plugin_counts (insert_map[PostFader]); + apply_some_plugin_counts (processor_map[PreFader]); + apply_some_plugin_counts (processor_map[PostFader]); - /* recompute max outs of any insert */ + /* recompute max outs of any processor */ - insert_max_outs.reset(); - InsertList::iterator prev = _inserts.end(); + processor_max_outs.reset(); + ProcessorList::iterator prev = _processors.end(); - for (r = _inserts.begin(); r != _inserts.end(); prev = r, ++r) { - insert_max_outs = max ((*r)->output_streams (), insert_max_outs); + for (r = _processors.begin(); r != _processors.end(); prev = r, ++r) { + processor_max_outs = max ((*r)->output_streams (), processor_max_outs); } /* we're done */ @@ -1208,31 +1208,31 @@ Route::_reset_plugin_counts (InsertStreams* err) } int32_t -Route::apply_some_plugin_counts (list<InsertCount>& iclist) +Route::apply_some_plugin_counts (list<ProcessorCount>& iclist) { - list<InsertCount>::iterator i; + list<ProcessorCount>::iterator i; for (i = iclist.begin(); i != iclist.end(); ++i) { - if ((*i).insert->configure_io ((*i).in, (*i).out)) { + if ((*i).processor->configure_io ((*i).in, (*i).out)) { return -1; } /* make sure that however many we have, they are all active */ - (*i).insert->activate (); + (*i).processor->activate (); } return 0; } /** Returns whether \a iclist can be configured and run starting with - * \a required_inputs at the first insert's inputs. + * \a required_inputs at the first processor's inputs. * If false is returned, \a iclist can not be run with \a required_inputs, and \a err is set. * Otherwise, \a err is set to the output of the list. */ bool -Route::check_some_plugin_counts (list<InsertCount>& iclist, ChanCount required_inputs, InsertStreams* err) +Route::check_some_plugin_counts (list<ProcessorCount>& iclist, ChanCount required_inputs, ProcessorStreams* err) { - list<InsertCount>::iterator i; + list<ProcessorCount>::iterator i; size_t index = 0; if (err) { @@ -1242,7 +1242,7 @@ Route::check_some_plugin_counts (list<InsertCount>& iclist, ChanCount required_i for (i = iclist.begin(); i != iclist.end(); ++i) { - if ((*i).insert->can_support_input_configuration (required_inputs) < 0) { + if ((*i).processor->can_support_input_configuration (required_inputs) < 0) { if (err) { err->index = index; err->count = required_inputs; @@ -1251,7 +1251,7 @@ Route::check_some_plugin_counts (list<InsertCount>& iclist, ChanCount required_i } (*i).in = required_inputs; - (*i).out = (*i).insert->output_for_input_configuration (required_inputs); + (*i).out = (*i).processor->output_for_input_configuration (required_inputs); required_inputs = (*i).out; @@ -1261,7 +1261,7 @@ Route::check_some_plugin_counts (list<InsertCount>& iclist, ChanCount required_i if (err) { if (!iclist.empty()) { err->index = index; - err->count = iclist.back().insert->output_for_input_configuration(required_inputs); + err->count = iclist.back().processor->output_for_input_configuration(required_inputs); } } @@ -1269,28 +1269,28 @@ Route::check_some_plugin_counts (list<InsertCount>& iclist, ChanCount required_i } int -Route::copy_inserts (const Route& other, Placement placement, InsertStreams* err) +Route::copy_processors (const Route& other, Placement placement, ProcessorStreams* err) { - ChanCount old_rmo = insert_max_outs; + ChanCount old_rmo = processor_max_outs; - InsertList to_be_deleted; + ProcessorList to_be_deleted; { - Glib::RWLock::WriterLock lm (insert_lock); - InsertList::iterator tmp; - InsertList the_copy; + Glib::RWLock::WriterLock lm (_processor_lock); + ProcessorList::iterator tmp; + ProcessorList the_copy; - the_copy = _inserts; + the_copy = _processors; - /* remove all relevant inserts */ + /* remove all relevant processors */ - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ) { tmp = i; ++tmp; if ((*i)->placement() == placement) { to_be_deleted.push_back (*i); - _inserts.erase (i); + _processors.erase (i); } i = tmp; @@ -1298,9 +1298,9 @@ Route::copy_inserts (const Route& other, Placement placement, InsertStreams* err /* now copy the relevant ones from "other" */ - for (InsertList::const_iterator i = other._inserts.begin(); i != other._inserts.end(); ++i) { + for (ProcessorList::const_iterator i = other._processors.begin(); i != other._processors.end(); ++i) { if ((*i)->placement() == placement) { - _inserts.push_back (Redirect::clone (*i)); + _processors.push_back (IOProcessor::clone (*i)); } } @@ -1310,15 +1310,15 @@ Route::copy_inserts (const Route& other, Placement placement, InsertStreams* err /* FAILED COPY ATTEMPT: we have to restore order */ - /* delete all cloned inserts */ + /* delete all cloned processors */ - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ) { tmp = i; ++tmp; if ((*i)->placement() == placement) { - _inserts.erase (i); + _processors.erase (i); } i = tmp; @@ -1326,8 +1326,8 @@ Route::copy_inserts (const Route& other, Placement placement, InsertStreams* err /* restore the natural order */ - _inserts = the_copy; - insert_max_outs = old_rmo; + _processors = the_copy; + processor_max_outs = old_rmo; /* we failed, even though things are OK again */ @@ -1335,51 +1335,51 @@ Route::copy_inserts (const Route& other, Placement placement, InsertStreams* err } else { - /* SUCCESSFUL COPY ATTEMPT: delete the inserts we removed pre-copy */ + /* SUCCESSFUL COPY ATTEMPT: delete the processors we removed pre-copy */ to_be_deleted.clear (); } } - if (insert_max_outs != old_rmo || old_rmo == ChanCount::ZERO) { + if (processor_max_outs != old_rmo || old_rmo == ChanCount::ZERO) { reset_panner (); } - inserts_changed (); /* EMIT SIGNAL */ + processors_changed (); /* EMIT SIGNAL */ return 0; } void -Route::all_inserts_flip () +Route::all_processors_flip () { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); - if (_inserts.empty()) { + if (_processors.empty()) { return; } - bool first_is_on = _inserts.front()->active(); + bool first_is_on = _processors.front()->active(); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->set_active (!first_is_on); } _session.set_dirty (); } -/** Set all inserts with a given placement to a given active state. - * @param p Placement of inserts to change. - * @param state New active state for those inserts. +/** Set all processors with a given placement to a given active state. + * @param p Placement of processors to change. + * @param state New active state for those processors. */ void -Route::all_inserts_active (Placement p, bool state) +Route::all_processors_active (Placement p, bool state) { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); - if (_inserts.empty()) { + if (_processors.empty()) { return; } - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->placement() == p) { (*i)->set_active (state); } @@ -1388,35 +1388,35 @@ Route::all_inserts_active (Placement p, bool state) _session.set_dirty (); } -struct InsertSorter { - bool operator() (boost::shared_ptr<const Insert> a, boost::shared_ptr<const Insert> b) { +struct ProcessorSorter { + bool operator() (boost::shared_ptr<const Processor> a, boost::shared_ptr<const Processor> b) { return a->sort_key() < b->sort_key(); } }; int -Route::sort_inserts (InsertStreams* err) +Route::sort_processors (ProcessorStreams* err) { { - InsertSorter comparator; - Glib::RWLock::WriterLock lm (insert_lock); - ChanCount old_rmo = insert_max_outs; + ProcessorSorter comparator; + Glib::RWLock::WriterLock lm (_processor_lock); + ChanCount old_rmo = processor_max_outs; /* the sweet power of C++ ... */ - InsertList as_it_was_before = _inserts; + ProcessorList as_it_was_before = _processors; - _inserts.sort (comparator); + _processors.sort (comparator); if (_reset_plugin_counts (err)) { - _inserts = as_it_was_before; - insert_max_outs = old_rmo; + _processors = as_it_was_before; + processor_max_outs = old_rmo; return -1; } } reset_panner (); - inserts_changed (); /* EMIT SIGNAL */ + processors_changed (); /* EMIT SIGNAL */ return 0; } @@ -1437,7 +1437,7 @@ XMLNode& Route::state(bool full_state) { XMLNode *node = new XMLNode("Route"); - InsertList:: iterator i; + ProcessorList:: iterator i; char buf[32]; if (_flags) { @@ -1502,7 +1502,7 @@ Route::state(bool full_state) cmt->add_content (_comment); } - for (i = _inserts.begin(); i != _inserts.end(); ++i) { + for (i = _processors.begin(); i != _processors.end(); ++i) { node->add_child_nocopy((*i)->state (full_state)); } @@ -1514,10 +1514,10 @@ Route::state(bool full_state) } XMLNode& -Route::get_insert_state () +Route::get_processor_state () { XMLNode* root = new XMLNode (X_("redirects")); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { root->add_child_nocopy ((*i)->state (true)); } @@ -1525,7 +1525,7 @@ Route::get_insert_state () } int -Route::set_insert_state (const XMLNode& root) +Route::set_processor_state (const XMLNode& root) { if (root.name() != X_("redirects")) { return -1; @@ -1535,13 +1535,13 @@ Route::set_insert_state (const XMLNode& root) XMLNodeList nnlist; XMLNodeConstIterator iter; XMLNodeConstIterator niter; - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); nlist = root.children(); for (iter = nlist.begin(); iter != nlist.end(); ++iter){ - /* iter now points to a Redirect state node */ + /* iter now points to a IOProcessor state node */ nnlist = (*iter)->children (); @@ -1556,15 +1556,15 @@ Route::set_insert_state (const XMLNode& root) XMLProperty* prop = (*niter)->property (X_("id")); if (!prop) { - warning << _("Redirect node has no ID, ignored") << endmsg; + warning << _("IOProcessor node has no ID, ignored") << endmsg; break; } ID id = prop->value (); - /* now look for a insert with that ID */ + /* now look for a processor with that ID */ - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->id() == id) { (*i)->set_state (**iter); break; @@ -1594,7 +1594,7 @@ Route::set_deferred_state () nlist = deferred_state->children(); for (niter = nlist.begin(); niter != nlist.end(); ++niter){ - add_insert_from_xml (**niter); + add_processor_from_xml (**niter); } delete deferred_state; @@ -1602,7 +1602,7 @@ Route::set_deferred_state () } void -Route::add_insert_from_xml (const XMLNode& node) +Route::add_processor_from_xml (const XMLNode& node) { const XMLProperty *prop; @@ -1611,7 +1611,7 @@ Route::add_insert_from_xml (const XMLNode& node) try { boost::shared_ptr<Send> send (new Send (_session, node)); - add_insert (send); + add_processor (send); } catch (failed_constructor &err) { @@ -1619,39 +1619,40 @@ Route::add_insert_from_xml (const XMLNode& node) return; } - } else if (node.name() == "Insert") { + // use "Processor" in XML? + } else if (node.name() == "Processor") { try { if ((prop = node.property ("type")) != 0) { - boost::shared_ptr<Insert> insert; + boost::shared_ptr<Processor> processor; if (prop->value() == "ladspa" || prop->value() == "Ladspa" || prop->value() == "vst") { - insert.reset (new PluginInsert(_session, node)); + processor.reset (new PluginInsert(_session, node)); } else if (prop->value() == "port") { - insert.reset (new PortInsert (_session, node)); + processor.reset (new PortInsert (_session, node)); } else if (prop->value() == "send") { - insert.reset (new Send (_session, node)); + processor.reset (new Send (_session, node)); } else { - error << string_compose(_("unknown Insert type \"%1\"; ignored"), prop->value()) << endmsg; + error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg; } - add_insert (insert); + add_processor (processor); } else { - error << _("Insert XML node has no type property") << endmsg; + error << _("Processor XML node has no type property") << endmsg; } } catch (failed_constructor &err) { - warning << _("insert could not be created. Ignored.") << endmsg; + warning << _("processor could not be created. Ignored.") << endmsg; return; } } @@ -1797,24 +1798,24 @@ Route::_set_state (const XMLNode& node, bool call_base) } } - XMLNodeList insert_nodes; + XMLNodeList processor_nodes; for (niter = nlist.begin(); niter != nlist.end(); ++niter){ child = *niter; - if (child->name() == X_("Send") || child->name() == X_("Insert")) { - insert_nodes.push_back(child); + if (child->name() == X_("Send") || child->name() == X_("Processor")) { + processor_nodes.push_back(child); } } - _set_insert_states(insert_nodes); + _set_processor_states(processor_nodes); for (niter = nlist.begin(); niter != nlist.end(); ++niter){ child = *niter; - // All inserts have been applied already + // All processors have been applied already if (child->name() == X_("Automation")) { @@ -1874,37 +1875,37 @@ Route::_set_state (const XMLNode& node, bool call_base) } void -Route::_set_insert_states(const XMLNodeList &nlist) +Route::_set_processor_states(const XMLNodeList &nlist) { XMLNodeConstIterator niter; char buf[64]; - InsertList::iterator i, o; + ProcessorList::iterator i, o; - // Iterate through existing inserts, remove those which are not in the state list - for (i = _inserts.begin(); i != _inserts.end(); ) { - InsertList::iterator tmp = i; + // Iterate through existing processors, remove those which are not in the state list + for (i = _processors.begin(); i != _processors.end(); ) { + ProcessorList::iterator tmp = i; ++tmp; - bool insertInStateList = false; + bool processorInStateList = false; (*i)->id().print (buf, sizeof (buf)); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - // legacy sessions (Redirect as a child of Insert, both is-a IO) - if (strncmp(buf,(*niter)->child(X_("Redirect"))->child(X_("IO"))->property(X_("id"))->value().c_str(), sizeof(buf)) == 0) { - insertInStateList = true; + // legacy sessions (IOProcessor as a child of Processor, both is-a IO) + if (strncmp(buf,(*niter)->child(X_("IOProcessor"))->child(X_("IO"))->property(X_("id"))->value().c_str(), sizeof(buf)) == 0) { + processorInStateList = true; break; } else if (strncmp(buf,(*niter)->property(X_("id"))->value().c_str(), sizeof(buf)) == 0) { - insertInStateList = true; + processorInStateList = true; break; } } - if (!insertInStateList) { - remove_insert (*i); + if (!processorInStateList) { + remove_processor (*i); } @@ -1912,17 +1913,17 @@ Route::_set_insert_states(const XMLNodeList &nlist) } - // Iterate through state list and make sure all inserts are on the track and in the correct order, - // set the state of existing inserts according to the new state on the same go - i = _inserts.begin(); + // Iterate through state list and make sure all processors are on the track and in the correct order, + // set the state of existing processors according to the new state on the same go + i = _processors.begin(); for (niter = nlist.begin(); niter != nlist.end(); ++niter, ++i) { - // Check whether the next insert in the list + // Check whether the next processor in the list o = i; - while (o != _inserts.end()) { + while (o != _processors.end()) { (*o)->id().print (buf, sizeof (buf)); - if ( strncmp(buf, (*niter)->child(X_("Redirect"))->child(X_("IO"))->property(X_("id"))->value().c_str(), sizeof(buf)) == 0) + if ( strncmp(buf, (*niter)->child(X_("IOProcessor"))->child(X_("IO"))->property(X_("id"))->value().c_str(), sizeof(buf)) == 0) break; else if (strncmp(buf,(*niter)->property(X_("id"))->value().c_str(), sizeof(buf)) == 0) break; @@ -1930,50 +1931,50 @@ Route::_set_insert_states(const XMLNodeList &nlist) ++o; } - if (o == _inserts.end()) { - // If the insert (*niter) is not on the route, we need to create it + if (o == _processors.end()) { + // If the processor (*niter) is not on the route, we need to create it // and move it to the correct location - InsertList::iterator prev_last = _inserts.end(); + ProcessorList::iterator prev_last = _processors.end(); --prev_last; // We need this to check whether adding succeeded - add_insert_from_xml (**niter); + add_processor_from_xml (**niter); - InsertList::iterator last = _inserts.end(); + ProcessorList::iterator last = _processors.end(); --last; if (prev_last == last) { - cerr << "Could not fully restore state as some inserts were not possible to create" << endl; + cerr << "Could not fully restore state as some processors were not possible to create" << endl; continue; } - boost::shared_ptr<Insert> tmp = (*last); - // remove the insert from the wrong location - _inserts.erase(last); - // insert the new insert at the current location - _inserts.insert(i, tmp); + boost::shared_ptr<Processor> tmp = (*last); + // remove the processor from the wrong location + _processors.erase(last); + // processor the new processor at the current location + _processors.insert(i, tmp); - --i; // move pointer to the newly inserted insert + --i; // move pointer to the newly processored processor continue; } - // We found the insert (*niter) on the route, first we must make sure the insert + // We found the processor (*niter) on the route, first we must make sure the processor // is at the location provided in the XML state if (i != o) { - boost::shared_ptr<Insert> tmp = (*o); + boost::shared_ptr<Processor> tmp = (*o); // remove the old copy - _inserts.erase(o); - // insert the insert at the correct location - _inserts.insert(i, tmp); + _processors.erase(o); + // processor the processor at the correct location + _processors.insert(i, tmp); - --i; // move pointer so it points to the right insert + --i; // move pointer so it points to the right processor } (*i)->set_state( (**niter) ); } - inserts_changed (); + processors_changed (); } void @@ -1995,10 +1996,10 @@ Route::silence (nframes_t nframes, nframes_t offset) } { - Glib::RWLock::ReaderLock lm (insert_lock, Glib::TRY_LOCK); + Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (lm.locked()) { - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { boost::shared_ptr<PluginInsert> pi; if (!_active && (pi = boost::dynamic_pointer_cast<PluginInsert> (*i)) != 0) { // skip plugins, they don't need anything when we're not active @@ -2020,7 +2021,7 @@ Route::silence (nframes_t nframes, nframes_t offset) int Route::set_control_outs (const vector<string>& ports) { - Glib::Mutex::Lock lm (control_outs_lock); + Glib::Mutex::Lock lm (_control_outs_lock); vector<string>::const_iterator i; size_t limit; @@ -2148,11 +2149,11 @@ Route::feeds (boost::shared_ptr<Route> other) } } - /* check Redirects which may also interconnect Routes */ + /* check IOProcessors which may also interconnect Routes */ - for (InsertList::iterator r = _inserts.begin(); r != _inserts.end(); r++) { + for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); r++) { - boost::shared_ptr<Redirect> redirect = boost::dynamic_pointer_cast<Redirect>(*r); + boost::shared_ptr<IOProcessor> redirect = boost::dynamic_pointer_cast<IOProcessor>(*r); if ( ! redirect) continue; @@ -2245,20 +2246,20 @@ Route::set_active (bool yn) } void -Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_inserts) +Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_processors) { nframes_t now = _session.transport_frame(); { - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); if (!did_locate) { automation_snapshot (now); } - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - if (Config->get_plugins_stop_with_transport() && can_flush_inserts) { + if (Config->get_plugins_stop_with_transport() && can_flush_processors) { (*i)->deactivate (); (*i)->activate (); } @@ -2299,7 +2300,7 @@ Route::pans_required () const return 0; } - return max (n_inputs ().n_audio(), static_cast<size_t>(insert_max_outs.n_audio())); + return max (n_inputs ().n_audio(), static_cast<size_t>(processor_max_outs.n_audio())); } int @@ -2356,15 +2357,15 @@ Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nfra bool can_record, bool rec_monitors_input) { { - Glib::RWLock::ReaderLock lm (insert_lock, Glib::TRY_LOCK); + Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (lm.locked()) { // automation snapshot can also be called from the non-rt context - // and it uses the insert list, so we take the lock out here + // and it uses the processor list, so we take the lock out here automation_snapshot (_session.transport_frame()); } } - if ((n_outputs().n_total() == 0 && _inserts.empty()) || n_inputs().n_total() == 0 || !_active) { + if ((n_outputs().n_total() == 0 && _processors.empty()) || n_inputs().n_total() == 0 || !_active) { silence (nframes, offset); return 0; } @@ -2420,7 +2421,7 @@ Route::has_external_redirects () const boost::shared_ptr<const PortInsert> pi; - for (InsertList::const_iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((pi = boost::dynamic_pointer_cast<const PortInsert>(*i)) != 0) { for (PortSet::const_iterator port = pi->io()->outputs().begin(); @@ -2442,15 +2443,15 @@ Route::has_external_redirects () const } void -Route::flush_inserts () +Route::flush_processors () { /* XXX shouldn't really try to take this lock, since this is called from the RT audio thread. */ - Glib::RWLock::ReaderLock lm (insert_lock); + Glib::RWLock::ReaderLock lm (_processor_lock); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->deactivate (); (*i)->activate (); } @@ -2471,7 +2472,7 @@ Route::update_total_latency () { _own_latency = 0; - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->active ()) { _own_latency += (*i)->latency (); } @@ -2506,7 +2507,7 @@ Route::automation_snapshot (nframes_t now) { IO::automation_snapshot (now); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->automation_snapshot (now); } } @@ -2556,7 +2557,7 @@ Route::ToggleControllable::get_value (void) const void Route::set_block_size (nframes_t nframes) { - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->set_block_size (nframes); } } @@ -2566,7 +2567,7 @@ Route::protect_automation () { Automatable::protect_automation(); - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) (*i)->protect_automation(); } diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 37867a2cfa..99589d2a8c 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -33,14 +33,14 @@ using namespace ARDOUR; using namespace PBD; Send::Send (Session& s, Placement p) - : Redirect (s, string_compose (_("send %1"), (bitslot = s.next_send_id()) + 1), p) + : IOProcessor (s, string_compose (_("send %1"), (bitslot = s.next_send_id()) + 1), p) { _metering = false; - InsertCreated (this); /* EMIT SIGNAL */ + ProcessorCreated (this); /* EMIT SIGNAL */ } Send::Send (Session& s, const XMLNode& node) - : Redirect (s, "send", PreFader) + : IOProcessor (s, "send", PreFader) { _metering = false; @@ -48,14 +48,14 @@ Send::Send (Session& s, const XMLNode& node) throw failed_constructor(); } - InsertCreated (this); /* EMIT SIGNAL */ + ProcessorCreated (this); /* EMIT SIGNAL */ } Send::Send (const Send& other) - : Redirect (other._session, string_compose (_("send %1"), (bitslot = other._session.next_send_id()) + 1), other.placement()) + : IOProcessor (other._session, string_compose (_("send %1"), (bitslot = other._session.next_send_id()) + 1), other.placement()) { _metering = false; - InsertCreated (this); /* EMIT SIGNAL */ + ProcessorCreated (this); /* EMIT SIGNAL */ } Send::~Send () @@ -72,7 +72,7 @@ Send::get_state(void) XMLNode& Send::state(bool full) { - XMLNode& node = Redirect::state(full); + XMLNode& node = IOProcessor::state(full); char buf[32]; node.add_property ("type", "send"); snprintf (buf, sizeof (buf), "%" PRIu32, bitslot); @@ -100,14 +100,14 @@ Send::set_state(const XMLNode& node) /* Send has regular IO automation (gain, pan) */ for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == "Redirect") { + if ((*niter)->name() == "IOProcessor") { insert_node = *niter; } else if ((*niter)->name() == X_("Automation")) { _io->set_automation_state (*(*niter), ParamID(GainAutomation)); } } - Redirect::set_state (*insert_node); + IOProcessor::set_state (*insert_node); return 0; } @@ -201,7 +201,7 @@ Send::configure_io (ChanCount in, ChanCount out) bool success = _io->ensure_io (ChanCount::ZERO, in, false, this) == 0; if (success) { - Insert::configure_io(in, out); + Processor::configure_io(in, out); _io->reset_panner(); return true; } else { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 6df71611ce..c40dd6fd7a 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -56,9 +56,9 @@ #include <ardour/smf_source.h> #include <ardour/auditioner.h> #include <ardour/recent_sessions.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include <ardour/send.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/plugin_insert.h> #include <ardour/port_insert.h> #include <ardour/bundle.h> @@ -1890,7 +1890,7 @@ Session::add_routes (RouteList& new_routes, bool save) (*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), wpr)); (*x)->mute_changed.connect (mem_fun (*this, &Session::route_mute_changed)); (*x)->output_changed.connect (mem_fun (*this, &Session::set_worst_io_latencies_x)); - (*x)->inserts_changed.connect (bind (mem_fun (*this, &Session::update_latency_compensation), false, false)); + (*x)->processors_changed.connect (bind (mem_fun (*this, &Session::update_latency_compensation), false, false)); if ((*x)->master()) { _master_out = (*x); @@ -3532,44 +3532,44 @@ Session::record_enable_change_all (bool yn) } void -Session::add_insert (Insert* insert) +Session::add_processor (Processor* processor) { Send* send; PortInsert* port_insert; PluginInsert* plugin_insert; - if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) { + if ((port_insert = dynamic_cast<PortInsert *> (processor)) != 0) { _port_inserts.insert (_port_inserts.begin(), port_insert); - } else if ((plugin_insert = dynamic_cast<PluginInsert *> (insert)) != 0) { + } else if ((plugin_insert = dynamic_cast<PluginInsert *> (processor)) != 0) { _plugin_inserts.insert (_plugin_inserts.begin(), plugin_insert); - } else if ((send = dynamic_cast<Send *> (insert)) != 0) { + } else if ((send = dynamic_cast<Send *> (processor)) != 0) { _sends.insert (_sends.begin(), send); } else { fatal << _("programming error: unknown type of Insert created!") << endmsg; /*NOTREACHED*/ } - insert->GoingAway.connect (sigc::bind (mem_fun (*this, &Session::remove_insert), insert)); + processor->GoingAway.connect (sigc::bind (mem_fun (*this, &Session::remove_processor), processor)); set_dirty(); } void -Session::remove_insert (Insert* insert) +Session::remove_processor (Processor* processor) { Send* send; PortInsert* port_insert; PluginInsert* plugin_insert; - if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) { + if ((port_insert = dynamic_cast<PortInsert *> (processor)) != 0) { list<PortInsert*>::iterator x = find (_port_inserts.begin(), _port_inserts.end(), port_insert); if (x != _port_inserts.end()) { insert_bitset[port_insert->bit_slot()] = false; _port_inserts.erase (x); } - } else if ((plugin_insert = dynamic_cast<PluginInsert *> (insert)) != 0) { + } else if ((plugin_insert = dynamic_cast<PluginInsert *> (processor)) != 0) { _plugin_inserts.remove (plugin_insert); - } else if ((send = dynamic_cast<Send *> (insert)) != 0) { + } else if ((send = dynamic_cast<Send *> (processor)) != 0) { list<Send*>::iterator x = find (_sends.begin(), _sends.end(), send); if (x != _sends.end()) { send_bitset[send->bit_slot()] = false; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 446743796d..65c48a2296 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -78,9 +78,9 @@ #include <ardour/sndfile_helpers.h> #include <ardour/auditioner.h> #include <ardour/export.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include <ardour/send.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/bundle.h> #include <ardour/slave.h> #include <ardour/tempo.h> @@ -260,7 +260,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) RegionFactory::CheckNewRegion.connect (mem_fun (*this, &Session::add_region)); SourceFactory::SourceCreated.connect (mem_fun (*this, &Session::add_source)); PlaylistFactory::PlaylistCreated.connect (mem_fun (*this, &Session::add_playlist)); - Insert::InsertCreated.connect (mem_fun (*this, &Session::add_insert)); + Processor::ProcessorCreated.connect (mem_fun (*this, &Session::add_processor)); NamedSelection::NamedSelectionCreated.connect (mem_fun (*this, &Session::add_named_selection)); AutomationList::AutomationListCreated.connect (mem_fun (*this, &Session::add_automation_list)); diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 7deb40c161..de836b79da 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -581,7 +581,7 @@ Session::flush_all_inserts () boost::shared_ptr<RouteList> r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - (*i)->flush_inserts (); + (*i)->flush_processors (); } } diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index f84b53cacb..eac2ffd31a 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -23,11 +23,11 @@ #include <ardour/track.h> #include <ardour/diskstream.h> #include <ardour/session.h> -#include <ardour/redirect.h> +#include <ardour/io_processor.h> #include <ardour/audioregion.h> #include <ardour/audiosource.h> #include <ardour/route_group_specialized.h> -#include <ardour/insert.h> +#include <ardour/processor.h> #include <ardour/audioplaylist.h> #include <ardour/panner.h> #include <ardour/utils.h> @@ -92,7 +92,7 @@ Track::update_total_latency () { _own_latency = 0; - for (InsertList::iterator i = _inserts.begin(); i != _inserts.end(); ++i) { + for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { if ((*i)->active ()) { _own_latency += (*i)->latency (); } @@ -106,7 +106,7 @@ Track::update_total_latency () Track::FreezeRecord::~FreezeRecord () { - for (vector<FreezeRecordInsertInfo*>::iterator i = insert_info.begin(); i != insert_info.end(); ++i) { + for (vector<FreezeRecordProcessorInfo*>::iterator i = processor_info.begin(); i != processor_info.end(); ++i) { delete *i; } } |