diff options
author | David Robillard <d@drobilla.net> | 2006-07-28 01:08:57 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-07-28 01:08:57 +0000 |
commit | 8277d134b9733aee344782891c99f07114384d9e (patch) | |
tree | 4472cc8608cf59272b127e1c5c722e0530aaac58 | |
parent | 60454cc8dc1ca5e1819b853b55916d52497d495c (diff) |
Merged with trunk R708
git-svn-id: svn://localhost/ardour2/branches/midi@712 d708f5d6-7413-0410-9779-e7cbd77b26cf
147 files changed, 3522 insertions, 2681 deletions
diff --git a/LAST_MERGE b/LAST_MERGE deleted file mode 100644 index 772ba09dc6..0000000000 --- a/LAST_MERGE +++ /dev/null @@ -1 +0,0 @@ -Last merged with trunk revision: 627 diff --git a/SConstruct b/SConstruct index f7683b2143..1349355187 100644 --- a/SConstruct +++ b/SConstruct @@ -31,6 +31,7 @@ opts.AddOptions( PathOption('DESTDIR', 'Set the intermediate install "prefix"', '/'), EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'tiger', 'panther', 'none' ), ignorecase=2), BoolOption('DMALLOC', 'Compile and link using the dmalloc library', 0), + BoolOption('EXTRA_WARN', 'Compile with -Wextra, -ansi, and -pedantic. Might break compilation. For pedants', 0), BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0), BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1), BoolOption('LIBLO', 'Compile with support for liblo library', 1), @@ -833,6 +834,10 @@ else: env.Append(CCFLAGS="-Wall") env.Append(CXXFLAGS="-Woverloaded-virtual") +if env['EXTRA_WARN']: + env.Append(CCFLAGS="-Wextra -pedantic") + env.Append(CXXFLAGS="-ansi") + if env['LIBLO']: env.Append(CCFLAGS="-DHAVE_LIBLO") diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 15bff16562..11cb8fcbce 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -144,8 +144,6 @@ marker.cc marker_time_axis.cc marker_time_axis_view.cc marker_view.cc -meter_bridge.cc -meter_bridge_strip.cc mixer_strip.cc mixer_ui.cc new_session_dialog.cc diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index ee688c3660..2197d4dc00 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -19,7 +19,7 @@ */ #include <vector> -#include <string.h> +#include <string> #include <gtk/gtkaccelmap.h> #include <gtk/gtkuimanager.h> diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 4328ec9ce6..ab87fbb3ef 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -15,8 +15,10 @@ <separator/> <menu action='addExistingAudioFiles'> <menuitem action='addExternalAudioAsRegion'/> - <menuitem action='addExternalAudioAsTrack'/> <menuitem action='addExternalAudioToTrack'/> + <separator/> + <menuitem action='addExternalAudioAsTrack'/> + <menuitem action='addExternalAudioAsTapeTrack'/> </menu> <separator/> <menu name='Export' action='Export'> diff --git a/gtk2_ardour/ardour_dialog.h b/gtk2_ardour/ardour_dialog.h index a23dcda9e0..069768c143 100644 --- a/gtk2_ardour/ardour_dialog.h +++ b/gtk2_ardour/ardour_dialog.h @@ -26,7 +26,7 @@ namespace ARDOUR { class Session; -}; +} /* * This virtual parent class is so that each dialog box uses the @@ -55,3 +55,4 @@ class ArdourDialog : public Gtk::Dialog }; #endif // __ardour_dialog_h__ + diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index fafaf8e6e0..16a9be8faf 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -340,15 +340,15 @@ ARDOUR_UI::save_ardour_state () Config->add_extra_xml (*node); Config->save_state(); - XMLNode& enode (static_cast<Stateful*>(editor)->get_state()); - XMLNode& mnode (mixer->get_state()); + XMLNode enode(static_cast<Stateful*>(editor)->get_state()); + XMLNode mnode(mixer->get_state()); if (session) { - session->add_instant_xml(enode, session->path()); - session->add_instant_xml(mnode, session->path()); + session->add_instant_xml (enode, session->path()); + session->add_instant_xml (mnode, session->path()); } else { - Config->add_instant_xml(enode, get_user_ardour_path()); - Config->add_instant_xml(mnode, get_user_ardour_path()); + Config->add_instant_xml (enode, get_user_ardour_path()); + Config->add_instant_xml (mnode, get_user_ardour_path()); } /* keybindings */ @@ -544,9 +544,9 @@ ARDOUR_UI::update_buffer_load () } void -ARDOUR_UI::count_recenabled_diskstreams (Route* route) +ARDOUR_UI::count_recenabled_diskstreams (Route& route) { - Track* track = dynamic_cast<Track*>(route); + Track* track = dynamic_cast<Track*>(&route); if (track && track->diskstream().record_enabled()) { rec_enabled_diskstreams++; } @@ -872,7 +872,7 @@ ARDOUR_UI::open_session () void ARDOUR_UI::session_add_midi_route (bool disk) { - Route* route; + boost::shared_ptr<Route> route; if (session == 0) { warning << _("You cannot add a track without a session already loaded.") << endmsg; @@ -881,27 +881,14 @@ ARDOUR_UI::session_add_midi_route (bool disk) try { if (disk) { - if ((route = session->new_midi_track ()) == 0) { - error << _("could not create new MIDI track") << endmsg; + if ((route = session->new_midi_track (/*mode*/)) == 0) { + error << _("could not create new midi track") << endmsg; } } else { if ((route = session->new_midi_route ()) == 0) { - error << _("could not create new MIDI bus") << endmsg; + error << _("could not create new midi bus") << endmsg; } } -#if 0 -#if CONTROLOUTS - if (need_control_room_outs) { - pan_t pans[2]; - - pans[0] = 0.5; - pans[1] = 0.5; - - route->set_stereo_control_outs (control_lr_channels); - route->control_outs()->set_stereo_pan (pans, this); - } -#endif /* CONTROLOUTS */ -#endif } catch (...) { @@ -918,7 +905,7 @@ restart JACK with more ports.")); void ARDOUR_UI::session_add_audio_route (bool disk, int32_t input_channels, int32_t output_channels, ARDOUR::TrackMode mode) { - Route* route; + boost::shared_ptr<Route> route; if (session == 0) { warning << _("You cannot add a track without a session already loaded.") << endmsg; @@ -1207,13 +1194,13 @@ ARDOUR_UI::toggle_record_enable (uint32_t dstream) return; } - Route* r; + boost::shared_ptr<Route> r; if ((r = session->route_by_remote_id (dstream)) != 0) { Track* t; - if ((t = dynamic_cast<Track*>(r)) != 0) { + if ((t = dynamic_cast<Track*>(r.get())) != 0) { t->diskstream().set_record_enabled (!t->diskstream().record_enabled(), this); } } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index b84015623d..ab2db06090 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -79,7 +79,7 @@ class ColorManager; namespace Gtkmm2ext { class TearOff; -}; +} namespace ARDOUR { class AudioEngine; @@ -87,11 +87,11 @@ namespace ARDOUR { class Port; class IO; class ControlProtocolInfo; -}; +} namespace ALSA { class MultiChannelDevice; -}; +} #define FRAME_NAME "BaseFrame" @@ -628,7 +628,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI void toggle_record_enable (uint32_t); uint32_t rec_enabled_diskstreams; - void count_recenabled_diskstreams (ARDOUR::Route*); + void count_recenabled_diskstreams (ARDOUR::Route&); About* about; bool shown_flag; @@ -714,5 +714,5 @@ class ARDOUR_UI : public Gtkmm2ext::UI void toggle_control_protocol (ARDOUR::ControlProtocolInfo*); }; - #endif /* __ardour_gui_h__ */ + diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h index 14dc6ba673..9ff5f45ddf 100644 --- a/gtk2_ardour/audio_clock.h +++ b/gtk2_ardour/audio_clock.h @@ -30,7 +30,7 @@ namespace ARDOUR { class Session; -}; +} class AudioClock : public Gtk::HBox { @@ -40,7 +40,7 @@ class AudioClock : public Gtk::HBox BBT, MinSec, Frames, - Off, + Off }; AudioClock (const string& name, bool editable, bool is_duration = false, bool with_tempo_meter = false); @@ -87,7 +87,7 @@ class AudioClock : public Gtk::HBox Bars, Beats, Ticks, - AudioFrames, + AudioFrames }; Gtk::EventBox audio_frames_ebox; diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index f6ccfe0084..ea822b97c5 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -86,7 +86,7 @@ using namespace Gtk; using namespace Editing; -AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Canvas& canvas) +AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas) : AxisView(sess), // FIXME: won't compile without this, why?? RouteTimeAxisView(ed, sess, rt, canvas) { @@ -121,8 +121,7 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt set_state (*xml_node); - _route.redirects_changed.connect (mem_fun(*this, &AudioTimeAxisView::redirects_changed)); - _route.panner().Changed.connect (mem_fun(*this, &AudioTimeAxisView::update_pans)); + _route->panner().Changed.connect (mem_fun(*this, &AudioTimeAxisView::update_pans)); if (is_audio_track()) { @@ -341,7 +340,7 @@ AudioTimeAxisView::build_display_menu () items.push_back (SeparatorElem()); items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active))); route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back()); - route_active_menu_item->set_active (_route.active()); + route_active_menu_item->set_active (_route->active()); items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route))); @@ -390,7 +389,9 @@ AudioTimeAxisView::set_waveform_shape (WaveformShape shape) if (asv) { asv->set_waveform_shape (shape); } -} + + map_frozen (); +} void AudioTimeAxisView::set_selected_regionviews (RegionSelection& regions) @@ -414,13 +415,13 @@ AudioTimeAxisView::add_gain_automation_child () *this, parent_canvas, _("gain"), - _route.gain_automation_curve()); + _route->gain_automation_curve()); line = new AutomationGainLine ("automation gain", _session, *gain_track, *gain_track->canvas_display, - _route.gain_automation_curve()); + _route->gain_automation_curve()); line->set_line_color (color_map[cAutomationLine]); @@ -489,11 +490,11 @@ AudioTimeAxisView::update_pans () /* we don't draw lines for "greater than stereo" panning. */ - if (_route.n_outputs() > 2) { + if (_route->n_outputs() > 2) { return; } - for (p = _route.panner().begin(); p != _route.panner().end(); ++p) { + for (p = _route->panner().begin(); p != _route->panner().end(); ++p) { AutomationLine* line; @@ -501,7 +502,7 @@ AudioTimeAxisView::update_pans () *pan_track->canvas_display, (*p)->automation()); - if (p == _route.panner().begin()) { + if (p == _route->panner().begin()) { /* first line is a nice orange */ line->set_line_color (color_map[cLeftPanAutomationLine]); } else { @@ -533,7 +534,7 @@ AudioTimeAxisView::toggle_gain_track () /* now trigger a redisplay */ if (!no_redraw) { - _route.gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */ } } } @@ -547,7 +548,7 @@ AudioTimeAxisView::gain_hidden () gain_automation_item->set_active (false); } - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } void @@ -569,7 +570,7 @@ AudioTimeAxisView::toggle_pan_track () /* now trigger a redisplay */ if (!no_redraw) { - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } } } @@ -583,7 +584,7 @@ AudioTimeAxisView::pan_hidden () pan_automation_item->set_active (false); } - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } AudioTimeAxisView::RedirectAutomationInfo::~RedirectAutomationInfo () @@ -612,7 +613,7 @@ AudioTimeAxisView::remove_ran (RedirectAutomationNode* ran) } AudioTimeAxisView::RedirectAutomationNode* -AudioTimeAxisView::find_redirect_automation_node (Redirect *redirect, uint32_t what) +AudioTimeAxisView::find_redirect_automation_node (boost::shared_ptr<Redirect> redirect, uint32_t what) { for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ++i) { @@ -650,7 +651,7 @@ legalize_for_xml_node (string str) void -AudioTimeAxisView::add_redirect_automation_curve (Redirect *redirect, uint32_t what) +AudioTimeAxisView::add_redirect_automation_curve (boost::shared_ptr<Redirect> redirect, uint32_t what) { RedirectAutomationLine* ral; string name; @@ -703,7 +704,7 @@ AudioTimeAxisView::add_redirect_automation_curve (Redirect *redirect, uint32_t w } void -AudioTimeAxisView::redirect_automation_track_hidden (AudioTimeAxisView::RedirectAutomationNode* ran, Redirect* r) +AudioTimeAxisView::redirect_automation_track_hidden (AudioTimeAxisView::RedirectAutomationNode* ran, boost::shared_ptr<Redirect> r) { if (!_hidden) { ran->menu_item->set_active (false); @@ -711,11 +712,11 @@ AudioTimeAxisView::redirect_automation_track_hidden (AudioTimeAxisView::Redirect r->mark_automation_visible (ran->what, false); - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } void -AudioTimeAxisView::add_existing_redirect_automation_curves (Redirect *redirect) +AudioTimeAxisView::add_existing_redirect_automation_curves (boost::shared_ptr<Redirect> redirect) { set<uint32_t> s; RedirectAutomationLine *ral; @@ -733,7 +734,7 @@ AudioTimeAxisView::add_existing_redirect_automation_curves (Redirect *redirect) } void -AudioTimeAxisView::add_redirect_to_subplugin_menu (Redirect* r) +AudioTimeAxisView::add_redirect_to_subplugin_menu (boost::shared_ptr<Redirect> r) { using namespace Menu_Helpers; RedirectAutomationInfo *rai; @@ -847,7 +848,7 @@ AudioTimeAxisView::redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutoma /* now trigger a redisplay */ - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } } @@ -863,8 +864,8 @@ AudioTimeAxisView::redirects_changed (void *src) subplugin_menu.items().clear (); - _route.foreach_redirect (this, &AudioTimeAxisView::add_redirect_to_subplugin_menu); - _route.foreach_redirect (this, &AudioTimeAxisView::add_existing_redirect_automation_curves); + _route->foreach_redirect (this, &AudioTimeAxisView::add_redirect_to_subplugin_menu); + _route->foreach_redirect (this, &AudioTimeAxisView::add_existing_redirect_automation_curves); for (list<RedirectAutomationInfo*>::iterator i = redirect_automation.begin(); i != redirect_automation.end(); ) { @@ -885,11 +886,11 @@ AudioTimeAxisView::redirects_changed (void *src) /* change in visibility was possible */ - _route.gui_changed ("track_height", this); + _route->gui_changed ("track_height", this); } RedirectAutomationLine * -AudioTimeAxisView::find_redirect_automation_curve (Redirect *redirect, uint32_t what) +AudioTimeAxisView::find_redirect_automation_curve (boost::shared_ptr<Redirect> redirect, uint32_t what) { RedirectAutomationNode* ran; @@ -922,7 +923,7 @@ AudioTimeAxisView::show_all_automation () no_redraw = false; - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } void @@ -943,7 +944,7 @@ AudioTimeAxisView::show_existing_automation () no_redraw = false; - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } void @@ -961,7 +962,7 @@ AudioTimeAxisView::hide_all_automation () } no_redraw = false; - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } void @@ -1032,7 +1033,7 @@ AudioTimeAxisView::route_active_changed () RouteUI::route_active_changed (); if (is_audio_track()) { - if (_route.active()) { + if (_route->active()) { controls_ebox.set_name ("AudioTrackControlsBaseUnselected"); controls_base_selected_name = "AudioTrackControlsBaseSelected"; controls_base_unselected_name = "AudioTrackControlsBaseUnselected"; @@ -1042,7 +1043,7 @@ AudioTimeAxisView::route_active_changed () controls_base_unselected_name = "AudioTrackControlsBaseInactiveUnselected"; } } else { - if (_route.active()) { + if (_route->active()) { controls_ebox.set_name ("BusControlsBaseUnselected"); controls_base_selected_name = "BusControlsBaseSelected"; controls_base_unselected_name = "BusControlsBaseUnselected"; diff --git a/gtk2_ardour/audio_time_axis.h b/gtk2_ardour/audio_time_axis.h index ed7a256812..2a6aa1c4d6 100644 --- a/gtk2_ardour/audio_time_axis.h +++ b/gtk2_ardour/audio_time_axis.h @@ -69,7 +69,7 @@ class AutomationTimeAxisView; class AudioTimeAxisView : public RouteTimeAxisView { public: - AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, ARDOUR::Route&, ArdourCanvas::Canvas& canvas); + AudioTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas); virtual ~AudioTimeAxisView (); AudioStreamView* audio_view(); @@ -106,6 +106,7 @@ class AudioTimeAxisView : public RouteTimeAxisView bool show_gain_automation; bool show_pan_automation; + // FIXME? void redirects_changed (void *); void build_display_menu (); @@ -144,33 +145,33 @@ class AudioTimeAxisView : public RouteTimeAxisView }; struct RedirectAutomationInfo { - ARDOUR::Redirect* redirect; + boost::shared_ptr<ARDOUR::Redirect> redirect; bool valid; Gtk::Menu* menu; vector<RedirectAutomationNode*> lines; - RedirectAutomationInfo (ARDOUR::Redirect* r) + RedirectAutomationInfo (boost::shared_ptr<ARDOUR::Redirect> r) : redirect (r), valid (true) {} ~RedirectAutomationInfo (); }; list<RedirectAutomationInfo*> redirect_automation; - RedirectAutomationNode* find_redirect_automation_node (ARDOUR::Redirect *redirect, uint32_t what); + RedirectAutomationNode* find_redirect_automation_node (boost::shared_ptr<ARDOUR::Redirect> redirect, uint32_t what); Gtk::Menu subplugin_menu; - void add_redirect_to_subplugin_menu (ARDOUR::Redirect *); + void add_redirect_to_subplugin_menu (boost::shared_ptr<ARDOUR::Redirect>); void remove_ran (RedirectAutomationNode* ran); void redirect_menu_item_toggled (AudioTimeAxisView::RedirectAutomationInfo*, AudioTimeAxisView::RedirectAutomationNode*); - void redirect_automation_track_hidden (RedirectAutomationNode*, ARDOUR::Redirect*); + void redirect_automation_track_hidden (RedirectAutomationNode*, boost::shared_ptr<ARDOUR::Redirect>); vector<RedirectAutomationLine*> redirect_automation_curves; - RedirectAutomationLine *find_redirect_automation_curve (ARDOUR::Redirect*,uint32_t); - void add_redirect_automation_curve (ARDOUR::Redirect*, uint32_t); - void add_existing_redirect_automation_curves (ARDOUR::Redirect*); + RedirectAutomationLine *find_redirect_automation_curve (boost::shared_ptr<ARDOUR::Redirect>,uint32_t); + void add_redirect_automation_curve (boost::shared_ptr<ARDOUR::Redirect>, uint32_t); + void add_existing_redirect_automation_curves (boost::shared_ptr<ARDOUR::Redirect>); void add_gain_automation_child (); void add_pan_automation_child (); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 90a9544f97..02a88b578b 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -20,7 +20,7 @@ using namespace PBD; using namespace Gtk; using namespace Editing; -AutomationTimeAxisView::AutomationTimeAxisView (Session& s, Route& r, PublicEditor& e, TimeAxisView& rent, +AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, PublicEditor& e, TimeAxisView& rent, ArdourCanvas::Canvas& canvas, const string & nom, const string & state_name, const string & nomparent) @@ -410,7 +410,7 @@ AutomationTimeAxisView::set_height (TrackHeight ht) if (changed) { /* only emit the signal if the height really changed */ - route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } } diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index 80b451730c..6de11a7c6d 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -4,6 +4,9 @@ #include <vector> #include <list> #include <string> + +#include <boost/shared_ptr.hpp> + #include <ardour/types.h> #include "canvas.h" @@ -31,7 +34,7 @@ class Selectable; class AutomationTimeAxisView : public TimeAxisView { public: AutomationTimeAxisView (ARDOUR::Session&, - ARDOUR::Route&, + boost::shared_ptr<ARDOUR::Route>, PublicEditor&, TimeAxisView& parent, ArdourCanvas::Canvas& canvas, @@ -75,7 +78,7 @@ class AutomationTimeAxisView : public TimeAxisView { XMLNode* get_state_node (); protected: - ARDOUR::Route& route; + boost::shared_ptr<ARDOUR::Route> route; ArdourCanvas::SimpleRect* base_rect; string _name; string _state_name; diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index 5b587594de..b2967dc4a9 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -1077,7 +1077,7 @@ CrossfadeEditor::peaks_ready (AudioRegion* r, WhichFade which) void CrossfadeEditor::audition_both () { - AudioPlaylist& pl (session.the_auditioner().prepare_playlist()); + AudioPlaylist& pl (session.the_auditioner()->prepare_playlist()); jack_nframes_t preroll; jack_nframes_t postroll; jack_nframes_t length; @@ -1140,7 +1140,7 @@ CrossfadeEditor::audition_left_dry () void CrossfadeEditor::audition_left () { - AudioPlaylist& pl (session.the_auditioner().prepare_playlist()); + AudioPlaylist& pl (session.the_auditioner()->prepare_playlist()); AudioRegion* left = new AudioRegion (xfade.out(), xfade.out().length() - xfade.length(), xfade.length(), "xfade left", 0, Region::DefaultFlags, false); @@ -1172,7 +1172,7 @@ CrossfadeEditor::audition_right_dry () void CrossfadeEditor::audition_right () { - AudioPlaylist& pl (session.the_auditioner().prepare_playlist()); + AudioPlaylist& pl (session.the_auditioner()->prepare_playlist()); AudioRegion* left = new AudioRegion (xfade.out(), xfade.out().length() - xfade.length(), xfade.length(), "xfade out", 0, Region::DefaultFlags, false); diff --git a/gtk2_ardour/editing_syms.h b/gtk2_ardour/editing_syms.h index cf36550fb4..654ddc8852 100644 --- a/gtk2_ardour/editing_syms.h +++ b/gtk2_ardour/editing_syms.h @@ -56,4 +56,5 @@ DISPLAYCONTROL(ShowWaveformsRecording) IMPORTMODE(ImportAsRegion) IMPORTMODE(ImportAsTrack) +IMPORTMODE(ImportAsTapeTrack) IMPORTMODE(ImportToTrack) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index c391ba2bf7..6edc738c41 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -877,7 +877,7 @@ Editor::set_frames_per_unit (double fpu) void Editor::instant_save () { - if (!constructed || !ARDOUR_UI::instance()->session_loaded) { + if (!constructed || !ARDOUR_UI::instance()->session_loaded) { return; } @@ -1338,7 +1338,7 @@ Editor::connect_to_session (Session *t) AudioTimeAxisView *atv; if ((atv = dynamic_cast<AudioTimeAxisView*>(tv)) != 0) { - if (atv->route().master()) { + if (atv->route()->master()) { route_list_display.get_selection()->unselect (i); } } @@ -2258,7 +2258,7 @@ Editor::get_state () char buf[32]; if (is_realized()) { - Glib::RefPtr<Gdk::Window> win = get_window(); + Glib::RefPtr<Gdk::Window> win = get_window(); int x, y, xoff, yoff, width, height; win->get_root_origin(x, y); @@ -2973,7 +2973,7 @@ Editor::get_relevant_audio_tracks (AudioTimeAxisView& base, set<AudioTimeAxisVie continue; } - RouteGroup* group = atv->route().edit_group(); + RouteGroup* group = atv->route()->edit_group(); if (group && group->is_active()) { @@ -2985,7 +2985,7 @@ Editor::get_relevant_audio_tracks (AudioTimeAxisView& base, set<AudioTimeAxisVie if ((tatv = dynamic_cast<AudioTimeAxisView*> (*i)) != 0) { - if (tatv->route().edit_group() == group) { + if (tatv->route()->edit_group() == group) { relevant_tracks.insert (tatv); } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 0204e6b10a..97c72c7bd2 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -461,7 +461,7 @@ class Editor : public PublicEditor void add_crossfade_context_items (AudioStreamView*, ARDOUR::Crossfade*, Gtk::Menu_Helpers::MenuList&, bool many); void add_selection_context_items (Gtk::Menu_Helpers::MenuList&); - void handle_new_route (ARDOUR::Route*); + void handle_new_route (boost::shared_ptr<ARDOUR::Route>); void remove_route (TimeAxisView *); bool route_removal; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index e20e6ee8eb..65195ca822 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -357,6 +357,8 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, X_("addExternalAudioAsTrack"), _("as Tracks"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsTrack)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, X_("addExternalAudioAsTapeTrack"), _("as Tape Tracks"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsTapeTrack)); + ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, X_("addExternalAudioToTrack"), _("to Tracks"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportToTrack)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index 1dc3b8b5ef..f8c632f08a 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -267,7 +267,7 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool idspec += string_compose(":%1", n); try { - source = AudioFileSource::create (idspec.c_str()); + source = AudioFileSource::create (idspec.c_str(), (mode == ImportAsTrack ? AudioFileSource::Destructive : AudioFileSource::Flag (0))); sources.push_back(source); } @@ -305,12 +305,14 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool } int - Editor::finish_bringing_in_audio (AudioRegion& region, uint32_t in_chans, uint32_t out_chans, AudioTrack* track, jack_nframes_t& pos, ImportMode mode) - { - switch (mode) { - case ImportAsRegion: - /* relax, its been done */ - break; +Editor::finish_bringing_in_audio (AudioRegion& region, uint32_t in_chans, uint32_t out_chans, AudioTrack* track, jack_nframes_t& pos, ImportMode mode) +{ + AudioRegion* copy; + + switch (mode) { + case ImportAsRegion: + /* relax, its been done */ + break; case ImportToTrack: if (track) { @@ -328,12 +330,22 @@ int break; case ImportAsTrack: - AudioTrack* at = session->new_audio_track (in_chans, out_chans); - AudioRegion* copy = new AudioRegion (region); + { + boost::shared_ptr<AudioTrack> at (session->new_audio_track (in_chans, out_chans, Normal)); + copy = new AudioRegion (region); at->diskstream().playlist()->add_region (*copy, pos); break; } + case ImportAsTapeTrack: + { + boost::shared_ptr<AudioTrack> at (session->new_audio_track (in_chans, out_chans, Destructive)); + copy = new AudioRegion (region); + at->diskstream().playlist()->add_region (*copy, pos); + break; + } + } + return 0; } diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index 9868a868c7..2575c99c67 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -142,8 +142,8 @@ Editor::bounce_region_selection () for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { Region& region ((*i)->region()); - RouteTimeAxisView* atv = dynamic_cast<RouteTimeAxisView*>(&(*i)->get_time_axis_view()); - Track* track = dynamic_cast<Track*>(&(atv->route())); + RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&(*i)->get_time_axis_view()); + Track* track = dynamic_cast<Track*>(rtv->route().get()); InterThreadInfo itt; diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 7a9c6d4153..246dbdc647 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -131,7 +131,7 @@ Editor::set_selected_mixer_strip (TimeAxisView& view) /* might be nothing to do */ - if (¤t_mixer_strip->route() == &at->route()) { + if (current_mixer_strip->route() == at->route()) { return; } @@ -221,7 +221,7 @@ Editor::current_mixer_strip_hidden () AudioTimeAxisView* tmp; if ((tmp = dynamic_cast<AudioTimeAxisView*>(*i)) != 0) { - if (&(tmp->route()) == &(current_mixer_strip->route())) { + if (tmp->route() == current_mixer_strip->route()) { (*i)->set_selected (false); break; } diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index b79c6b3571..7863b0c1a1 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -31,7 +31,6 @@ #include "gui_thread.h" #include <ardour/route.h> -//#include <ardour/audio_track.h> #include "i18n.h" @@ -40,11 +39,12 @@ using namespace ARDOUR; using namespace PBD; using namespace Gtk; + void -Editor::handle_new_route (Route* route) +Editor::handle_new_route (boost::shared_ptr<Route> route) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::handle_new_route), route)); - + TimeAxisView *tv; TreeModel::Row parent; TreeModel::Row row; @@ -58,9 +58,9 @@ Editor::handle_new_route (Route* route) assert(type == Buffer::AUDIO || type == Buffer::MIDI); if (type == Buffer::AUDIO) - tv = new AudioTimeAxisView (*this, *session, *route, track_canvas); + tv = new AudioTimeAxisView (*this, *session, route, track_canvas); else - tv = new MidiTimeAxisView (*this, *session, *route, track_canvas); + tv = new MidiTimeAxisView (*this, *session, route, track_canvas); #if 0 if (route_display_model->children().size() == 0) { @@ -78,7 +78,7 @@ Editor::handle_new_route (Route* route) } - if (dynamic_cast<AudioTrack*>(&route) != 0) { + if (dynamic_cast<AudioTrack*>(route.get()) != 0) { TreeModel::iterator iter = route_display_model->get_iter ("1"); // audio tracks parent = *iter; } else { @@ -103,8 +103,8 @@ Editor::handle_new_route (Route* route) RouteTimeAxisView* rtv = NULL; if ((rtv = dynamic_cast<RouteTimeAxisView*> (tv)) != 0) { /* added a new fresh one at the end */ - if (rtv->route().order_key(N_("editor")) == -1) { - rtv->route().set_order_key (N_("editor"), route_display_model->children().size()-1); + if (rtv->route()->order_key(N_("editor")) == -1) { + rtv->route()->set_order_key (N_("editor"), route_display_model->children().size()-1); } } @@ -192,7 +192,7 @@ Editor::hide_track_in_display (TimeAxisView& tv) AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (&tv); - if (atv && current_mixer_strip && &(atv->route()) == &(current_mixer_strip->route())) { + if (atv && current_mixer_strip && (atv->route() == current_mixer_strip->route())) { // this will hide the mixer strip set_selected_mixer_strip (tv); } @@ -248,7 +248,7 @@ Editor::redisplay_route_list () */ if ((at = dynamic_cast<AudioTimeAxisView*> (tv)) != 0) { - at->route().set_order_key (N_("editor"), order); + at->route()->set_order_key (N_("editor"), order); ++order; } } @@ -481,7 +481,7 @@ Editor::route_list_selection_filter (const Glib::RefPtr<TreeModel>& model, const } struct EditorOrderRouteSorter { - bool operator() (Route* a, Route* b) { + bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) { /* use of ">" forces the correct sort order */ return a->order_key ("editor") < b->order_key ("editor"); } @@ -490,16 +490,17 @@ struct EditorOrderRouteSorter { void Editor::initial_route_list_display () { - Session::RouteList routes = session->get_routes(); + boost::shared_ptr<Session::RouteList> routes = session->get_routes(); + Session::RouteList r (*routes); EditorOrderRouteSorter sorter; - routes.sort (sorter); + r.sort (sorter); no_route_list_redisplay = true; route_display_model->clear (); - for (Session::RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (Session::RouteList::iterator i = r.begin(); i != r.end(); ++i) { handle_new_route (*i); } diff --git a/gtk2_ardour/editor_timefx.cc b/gtk2_ardour/editor_timefx.cc index 5c7470823f..5fbc3d3a3a 100644 --- a/gtk2_ardour/editor_timefx.cc +++ b/gtk2_ardour/editor_timefx.cc @@ -182,7 +182,7 @@ Editor::do_timestretch (TimeStretchDialog& dialog) continue; } - if ((t = dynamic_cast<Track*> (&rtv->route())) == 0) { + if ((t = dynamic_cast<Track*> (rtv->route().get())) == 0) { i = tmp; continue; } diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index bcf8cd85ad..b5a4757090 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -1082,11 +1082,11 @@ ExportDialog::fill_lists () track_list->clear(); master_list->clear(); - Session::RouteList routes = session->get_routes (); + boost::shared_ptr<Session::RouteList> routes = session->get_routes (); - for (Session::RouteList::iterator ri = routes.begin(); ri != routes.end(); ++ri) { - - Route* route = (*ri); + for (Session::RouteList::iterator ri = routes->begin(); ri != routes->end(); ++ri) { + + boost::shared_ptr<Route> route = (*ri); if (route->hidden()) { continue; diff --git a/gtk2_ardour/gain_automation_time_axis.cc b/gtk2_ardour/gain_automation_time_axis.cc index 8f41f5def0..5352015f11 100644 --- a/gtk2_ardour/gain_automation_time_axis.cc +++ b/gtk2_ardour/gain_automation_time_axis.cc @@ -31,7 +31,9 @@ using namespace ARDOUR; using namespace PBD; using namespace Gtk; -GainAutomationTimeAxisView::GainAutomationTimeAxisView (Session& s, Route& r, PublicEditor& e, TimeAxisView& parent, ArdourCanvas::Canvas& canvas, const string & n, ARDOUR::Curve& c) +GainAutomationTimeAxisView::GainAutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, + PublicEditor& e, TimeAxisView& parent, + ArdourCanvas::Canvas& canvas, const string & n, ARDOUR::Curve& c) : AxisView (s), AutomationTimeAxisView (s, r, e, parent, canvas, n, X_("gain"), ""), @@ -72,6 +74,6 @@ void GainAutomationTimeAxisView::set_automation_state (AutoState state) { if (!ignore_state_request) { - route.set_gain_automation_state (state); + route->set_gain_automation_state (state); } } diff --git a/gtk2_ardour/gain_automation_time_axis.h b/gtk2_ardour/gain_automation_time_axis.h index 50f1cba3f9..dc6d5bd28e 100644 --- a/gtk2_ardour/gain_automation_time_axis.h +++ b/gtk2_ardour/gain_automation_time_axis.h @@ -13,7 +13,7 @@ class GainAutomationTimeAxisView : public AutomationTimeAxisView { public: GainAutomationTimeAxisView (ARDOUR::Session&, - ARDOUR::Route&, + boost::shared_ptr<ARDOUR::Route>, PublicEditor&, TimeAxisView& parent_axis, ArdourCanvas::Canvas& canvas, diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 7fa2c33335..5fa8c462bc 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -79,7 +79,7 @@ GainMeter::setup_slider_pix () return 0; } -GainMeter::GainMeter (IO& io, Session& s) +GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s) : _io (io), _session (s), gain_slider (0), @@ -99,7 +99,7 @@ GainMeter::GainMeter (IO& io, Session& s) gain_slider = manage (new VSliderController (slider, rail, &gain_adjustment, - _io.gain_control(), + _io->gain_control(), false)); gain_slider->signal_button_press_event().connect (mem_fun(*this, &GainMeter::start_gain_touch)); @@ -152,7 +152,7 @@ GainMeter::GainMeter (IO& io, Session& s) Route* r; - if ((r = dynamic_cast<Route*> (&_io)) != 0) { + if ((r = dynamic_cast<Route*> (_io.get())) != 0) { /* if we don't have a route (if we're the click), pack some route-dependent stuff. @@ -165,13 +165,13 @@ GainMeter::GainMeter (IO& io, Session& s) using namespace Menu_Helpers; gain_astate_menu.items().push_back (MenuElem (_("Off"), - bind (mem_fun (&_io, &IO::set_gain_automation_state), (AutoState) Off))); + bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Off))); gain_astate_menu.items().push_back (MenuElem (_("Play"), - bind (mem_fun (&_io, &IO::set_gain_automation_state), (AutoState) Play))); + bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Play))); gain_astate_menu.items().push_back (MenuElem (_("Write"), - bind (mem_fun (&_io, &IO::set_gain_automation_state), (AutoState) Write))); + bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Write))); gain_astate_menu.items().push_back (MenuElem (_("Touch"), - bind (mem_fun (&_io, &IO::set_gain_automation_state), (AutoState) Touch))); + bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Touch))); gain_astyle_menu.items().push_back (MenuElem (_("Trim"))); gain_astyle_menu.items().push_back (MenuElem (_("Abs"))); @@ -195,7 +195,7 @@ GainMeter::GainMeter (IO& io, Session& s) pack_start (gain_display_box, Gtk::PACK_SHRINK); pack_start (hbox, Gtk::PACK_SHRINK); - _io.gain_changed.connect (mem_fun(*this, &GainMeter::gain_changed)); + _io->gain_changed.connect (mem_fun(*this, &GainMeter::gain_changed)); meter_metric_area.signal_expose_event().connect (mem_fun(*this, &GainMeter::meter_metrics_expose)); gain_adjustment.signal_value_changed().connect (mem_fun(*this, &GainMeter::gain_adjusted)); @@ -323,7 +323,7 @@ GainMeter::update_meters () for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) { if ((*i).packed) { - peak = _io.peak_input_power (n); + peak = _io->peak_input_power (n); (*i).meter->set (log_meter (peak), peak); @@ -382,14 +382,14 @@ GainMeter::hide_all_meters () void GainMeter::setup_meters () { - uint32_t nmeters = _io.n_outputs(); + uint32_t nmeters = _io->n_outputs(); guint16 width; hide_all_meters (); Route* r; - if ((r = dynamic_cast<Route*> (&_io)) != 0) { + if ((r = dynamic_cast<Route*> (_io.get())) != 0) { switch (r->meter_point()) { case MeterPreFader: @@ -403,7 +403,7 @@ GainMeter::setup_meters () } else { - nmeters = _io.n_outputs(); + nmeters = _io->n_outputs(); } @@ -451,7 +451,7 @@ GainMeter::peak_button_release (GdkEventButton* ev) ResetAllPeakDisplays (); } else if (ev->button == 1 && Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { Route* r; - if ((r = dynamic_cast<Route*> (&_io)) != 0) { + if ((r = dynamic_cast<Route*> (_io.get())) != 0) { ResetGroupPeakDisplays (r->mix_group()); } } else { @@ -472,7 +472,7 @@ void GainMeter::reset_group_peak_display (RouteGroup* group) { Route* r; - if ((r = dynamic_cast<Route*> (&_io)) != 0) { + if ((r = dynamic_cast<Route*> (_io.get())) != 0) { if (group == r->mix_group()) { reset_peak_display (); } @@ -541,14 +541,14 @@ void GainMeter::gain_adjusted () { if (!ignore_toggle) { - _io.set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); + _io->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); } } void GainMeter::effective_gain_display () { - gfloat value = gain_to_slider_position (_io.effective_gain()); + gfloat value = gain_to_slider_position (_io->effective_gain()); if (gain_adjustment.get_value() != value) { ignore_toggle = true; @@ -578,7 +578,7 @@ GainMeter::set_fader_name (const char * name) void GainMeter::update_gain_sensitive () { - static_cast<Gtkmm2ext::SliderController*>(gain_slider)->set_sensitive (!(_io.gain_automation_state() & Play)); + static_cast<Gtkmm2ext::SliderController*>(gain_slider)->set_sensitive (!(_io->gain_automation_state() & Play)); } @@ -609,7 +609,7 @@ GainMeter::meter_press(GdkEventButton* ev) wait_for_release = false; - if ((_route = dynamic_cast<Route*>(&_io)) == 0) { + if ((_route = dynamic_cast<Route*>(_io.get())) == 0) { return FALSE; } @@ -671,7 +671,7 @@ GainMeter::meter_release(GdkEventButton* ev) if(!ignore_toggle){ if (wait_for_release){ wait_for_release = false; - set_meter_point (*(dynamic_cast<Route*>(&_io)), old_meter_point); + set_meter_point (*(dynamic_cast<Route*>(_io.get())), old_meter_point); } } return true; @@ -700,7 +700,7 @@ GainMeter::meter_point_clicked () { Route* r; - if ((r = dynamic_cast<Route*> (&_io)) != 0) { + if ((r = dynamic_cast<Route*> (_io.get())) != 0) { } } @@ -708,14 +708,14 @@ GainMeter::meter_point_clicked () gint GainMeter::start_gain_touch (GdkEventButton* ev) { - _io.start_gain_touch (); + _io->start_gain_touch (); return FALSE; } gint GainMeter::end_gain_touch (GdkEventButton* ev) { - _io.end_gain_touch (); + _io->end_gain_touch (); return FALSE; } @@ -819,10 +819,10 @@ GainMeter::gain_automation_style_changed () // Route* _route = dynamic_cast<Route*>(&_io); switch (_width) { case Wide: - gain_automation_style_button.set_label (astyle_string(_io.gain_automation_curve().automation_style())); + gain_automation_style_button.set_label (astyle_string(_io->gain_automation_curve().automation_style())); break; case Narrow: - gain_automation_style_button.set_label (short_astyle_string(_io.gain_automation_curve().automation_style())); + gain_automation_style_button.set_label (short_astyle_string(_io->gain_automation_curve().automation_style())); break; } } @@ -837,14 +837,14 @@ GainMeter::gain_automation_state_changed () switch (_width) { case Wide: - gain_automation_state_button.set_label (astate_string(_io.gain_automation_curve().automation_state())); + gain_automation_state_button.set_label (astate_string(_io->gain_automation_curve().automation_state())); break; case Narrow: - gain_automation_state_button.set_label (short_astate_string(_io.gain_automation_curve().automation_state())); + gain_automation_state_button.set_label (short_astate_string(_io->gain_automation_curve().automation_state())); break; } - x = (_io.gain_automation_state() != Off); + x = (_io->gain_automation_state() != Off); if (gain_automation_state_button.get_active() != x) { ignore_toggle = true; diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index 0ed09ee383..1dfc088248 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -56,7 +56,7 @@ namespace Gtk { class GainMeter : public Gtk::VBox { public: - GainMeter (ARDOUR::IO&, ARDOUR::Session&); + GainMeter (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&); ~GainMeter (); void update_gain_sensitive (); @@ -75,7 +75,7 @@ class GainMeter : public Gtk::VBox private: friend class MixerStrip; - ARDOUR::IO& _io; + boost::shared_ptr<ARDOUR::IO> _io; ARDOUR::Session& _session; bool ignore_toggle; diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index b0ecd05077..f754435112 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -52,7 +52,7 @@ using namespace ARDOUR; using namespace PBD; using namespace Gtkmm2ext; -IOSelectorWindow::IOSelectorWindow (Session& sess, IO& ior, bool input, bool can_cancel) +IOSelectorWindow::IOSelectorWindow (Session& sess, boost::shared_ptr<IO> ior, bool input, bool can_cancel) : ArdourDialog ("i/o selector"), _selector (sess, ior, input), ok_button (can_cancel ? _("OK"): _("Close")), @@ -65,9 +65,9 @@ IOSelectorWindow::IOSelectorWindow (Session& sess, IO& ior, bool input, bool can string title; if (input) { - title = string_compose(_("%1 input"), ior.name()); + title = string_compose(_("%1 input"), ior->name()); } else { - title = string_compose(_("%1 output"), ior.name()); + title = string_compose(_("%1 output"), ior->name()); } ok_button.set_name ("IOSelectorButton"); @@ -135,7 +135,7 @@ IOSelectorWindow::on_map () The IO Selector "widget" *************************/ -IOSelector::IOSelector (Session& sess, IO& ior, bool input) +IOSelector::IOSelector (Session& sess, boost::shared_ptr<IO> ior, bool input) : session (sess), io (ior), for_input (input), @@ -184,14 +184,14 @@ IOSelector::IOSelector (Session& sess, IO& ior, bool input) port_button_box.pack_start (add_port_button, false, false); if (for_input) { - if (io.input_maximum() < 0 || io.input_maximum() > (int) io.n_inputs()) { + if (io->input_maximum() < 0 || io->input_maximum() > (int) io->n_inputs()) { add_port_button.set_sensitive (true); } else { add_port_button.set_sensitive (false); } } else { - if (io.output_maximum() < 0 || io.output_maximum() > (int) io.n_outputs()) { + if (io->output_maximum() < 0 || io->output_maximum() > (int) io->n_outputs()) { add_port_button.set_sensitive (true); } else { add_port_button.set_sensitive (false); @@ -202,14 +202,14 @@ IOSelector::IOSelector (Session& sess, IO& ior, bool input) port_button_box.pack_start (remove_port_button, false, false); if (for_input) { - if (io.input_minimum() < 0 || io.input_minimum() < (int) io.n_inputs()) { + if (io->input_minimum() < 0 || io->input_minimum() < (int) io->n_inputs()) { remove_port_button.set_sensitive (true); } else { remove_port_button.set_sensitive (false); } } else { - if (io.output_minimum() < 0 || io.output_minimum() < (int) io.n_outputs()) { + if (io->output_minimum() < 0 || io->output_minimum() < (int) io->n_outputs()) { remove_port_button.set_sensitive (true); } else { remove_port_button.set_sensitive (false); @@ -241,12 +241,12 @@ IOSelector::IOSelector (Session& sess, IO& ior, bool input) remove_port_button.signal_clicked().connect (mem_fun(*this, &IOSelector::remove_port)); if (for_input) { - io.input_changed.connect (mem_fun(*this, &IOSelector::ports_changed)); + io->input_changed.connect (mem_fun(*this, &IOSelector::ports_changed)); } else { - io.output_changed.connect (mem_fun(*this, &IOSelector::ports_changed)); + io->output_changed.connect (mem_fun(*this, &IOSelector::ports_changed)); } - io.name_changed.connect (mem_fun(*this, &IOSelector::name_changed)); + io->name_changed.connect (mem_fun(*this, &IOSelector::name_changed)); } IOSelector::~IOSelector () @@ -265,9 +265,9 @@ void IOSelector::clear_connections () { if (for_input) { - io.disconnect_inputs (this); + io->disconnect_inputs (this); } else { - io.disconnect_outputs (this); + io->disconnect_outputs (this); } } @@ -374,9 +374,9 @@ IOSelector::display_ports () uint32_t limit; if (for_input) { - limit = io.n_inputs(); + limit = io->n_inputs(); } else { - limit = io.n_outputs(); + limit = io->n_outputs(); } for (slist<TreeView *>::iterator i = port_displays.begin(); i != port_displays.end(); ) { @@ -401,9 +401,9 @@ IOSelector::display_ports () string really_short_name; if (for_input) { - port = io.input (n); + port = io->input (n); } else { - port = io.output (n); + port = io->output (n); } /* we know there is '/' because we put it there */ @@ -443,7 +443,7 @@ IOSelector::display_ports () if (for_input) { - if (io.input_maximum() == 1) { + if (io->input_maximum() == 1) { selected_port = port; selected_port_tview = tview; } else { @@ -454,7 +454,7 @@ IOSelector::display_ports () } else { - if (io.output_maximum() == 1) { + if (io->output_maximum() == 1) { selected_port = port; selected_port_tview = tview; } else { @@ -516,12 +516,12 @@ IOSelector::port_selection_changed (GdkEventButton *ev, TreeView* treeview) ustring other_port_name = (*i)[port_display_columns.full_name]; if (for_input) { - if ((status = io.connect_input (selected_port, other_port_name, this)) == 0) { + if ((status = io->connect_input (selected_port, other_port_name, this)) == 0) { Port *p = session.engine().get_port_by_name (other_port_name); p->enable_metering(); } } else { - status = io.connect_output (selected_port, other_port_name, this); + status = io->connect_output (selected_port, other_port_name, this); } if (status == 0) { @@ -548,7 +548,7 @@ IOSelector::add_port () if (for_input) { try { - io.add_input_port ("", this); + io->add_input_port ("", this); } catch (AudioEngine::PortRegistrationFailure& err) { @@ -556,18 +556,18 @@ IOSelector::add_port () msg.run (); } - if (io.input_maximum() >= 0 && io.input_maximum() <= (int) io.n_inputs()) { + if (io->input_maximum() >= 0 && io->input_maximum() <= (int) io->n_inputs()) { add_port_button.set_sensitive (false); } - if (io.input_minimum() < (int) io.n_inputs()) { + if (io->input_minimum() < (int) io->n_inputs()) { remove_port_button.set_sensitive (true); } } else { try { - io.add_output_port ("", this); + io->add_output_port ("", this); } catch (AudioEngine::PortRegistrationFailure& err) { @@ -575,7 +575,7 @@ IOSelector::add_port () msg.run (); } - if (io.output_maximum() >= 0 && io.output_maximum() <= (int) io.n_outputs()) { + if (io->output_maximum() >= 0 && io->output_maximum() <= (int) io->n_outputs()) { add_port_button.set_sensitive (false); } } @@ -589,15 +589,15 @@ IOSelector::remove_port () // always remove last port if (for_input) { - if ((nports = io.n_inputs()) > 0) { - io.remove_input_port (io.input(nports-1), this); + if ((nports = io->n_inputs()) > 0) { + io->remove_input_port (io->input(nports-1), this); } - if (io.input_minimum() == (int) io.n_inputs()) { + if (io->input_minimum() == (int) io->n_inputs()) { remove_port_button.set_sensitive (false); } } else { - if ((nports = io.n_outputs()) > 0) { - io.remove_output_port (io.output(nports-1), this); + if ((nports = io->n_outputs()) > 0) { + io->remove_output_port (io->output(nports-1), this); } } } @@ -606,9 +606,9 @@ gint IOSelector::remove_port_when_idle (Port *port) { if (for_input) { - io.remove_input_port (port, this); + io->remove_input_port (port, this); } else { - io.remove_output_port (port, this); + io->remove_output_port (port, this); } return FALSE; @@ -651,9 +651,9 @@ IOSelector::connection_button_release (GdkEventButton *ev, TreeView *treeview) if (for_input) { Port *p = session.engine().get_port_by_name (connected_port_name); p->disable_metering(); - io.disconnect_input (port, connected_port_name, this); + io->disconnect_input (port, connected_port_name, this); } else { - io.disconnect_output (port, connected_port_name, this); + io->disconnect_output (port, connected_port_name, this); } } @@ -749,17 +749,17 @@ IOSelector::redisplay () display_ports (); if (for_input) { - if (io.input_maximum() != 0) { + if (io->input_maximum() != 0) { rescan (); } } else { - if (io.output_maximum() != 0) { + if (io->output_maximum() != 0) { rescan(); } } } -PortInsertUI::PortInsertUI (Session& sess, PortInsert& pi) +PortInsertUI::PortInsertUI (Session& sess, boost::shared_ptr<PortInsert> pi) : input_selector (sess, pi, true), output_selector (sess, pi, false) { @@ -786,9 +786,9 @@ PortInsertUI::finished(IOSelector::Result r) } -PortInsertWindow::PortInsertWindow (Session& sess, PortInsert& pi, bool can_cancel) +PortInsertWindow::PortInsertWindow (Session& sess, boost::shared_ptr<PortInsert> pi, bool can_cancel) : ArdourDialog ("port insert dialog"), - _portinsertui(sess, pi), + _portinsertui (sess, pi), ok_button (can_cancel ? _("OK"): _("Close")), cancel_button (_("Cancel")), rescan_button (_("Rescan")) @@ -796,7 +796,7 @@ PortInsertWindow::PortInsertWindow (Session& sess, PortInsert& pi, bool can_canc set_name ("IOSelectorWindow"); string title = _("ardour: "); - title += pi.name(); + title += pi->name(); set_title (title); ok_button.set_name ("IOSelectorButton"); @@ -823,7 +823,7 @@ PortInsertWindow::PortInsertWindow (Session& sess, PortInsert& pi, bool can_canc rescan_button.signal_clicked().connect (mem_fun(*this, &PortInsertWindow::rescan)); signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window *> (this))); - pi.GoingAway.connect (mem_fun(*this, &PortInsertWindow::plugin_going_away)); + pi->GoingAway.connect (mem_fun(*this, &PortInsertWindow::plugin_going_away)); } void diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h index 44518e6759..993d4aa1ad 100644 --- a/gtk2_ardour/io_selector.h +++ b/gtk2_ardour/io_selector.h @@ -53,7 +53,7 @@ namespace ARDOUR { class IOSelector : public Gtk::VBox { public: - IOSelector (ARDOUR::Session&, ARDOUR::IO&, bool for_input); + IOSelector (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool for_input); ~IOSelector (); void redisplay (); @@ -67,9 +67,9 @@ class IOSelector : public Gtk::VBox { protected: ARDOUR::Session& session; - + private: - ARDOUR::IO& io; + boost::shared_ptr<ARDOUR::IO> io; bool for_input; ARDOUR::Port *selected_port; @@ -135,7 +135,7 @@ class IOSelector : public Gtk::VBox { class IOSelectorWindow : public ArdourDialog { public: - IOSelectorWindow (ARDOUR::Session&, ARDOUR::IO&, bool for_input, bool can_cancel=false); + IOSelectorWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool for_input, bool can_cancel=false); ~IOSelectorWindow (); IOSelector& selector() { return _selector; } @@ -162,7 +162,7 @@ class IOSelectorWindow : public ArdourDialog class PortInsertUI : public Gtk::VBox { public: - PortInsertUI (ARDOUR::Session&, ARDOUR::PortInsert&); + PortInsertUI (ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>); void redisplay (); void finished (IOSelector::Result); @@ -178,7 +178,7 @@ class PortInsertUI : public Gtk::VBox class PortInsertWindow : public ArdourDialog { public: - PortInsertWindow (ARDOUR::Session&, ARDOUR::PortInsert&, bool can_cancel=false); + PortInsertWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>, bool can_cancel=false); protected: void on_map (); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 081fc543db..543cb8bb10 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -78,7 +78,7 @@ using namespace Gtk; using namespace Editing; -MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Canvas& canvas) +MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas) : AxisView(sess), // FIXME: won't compile without this, why?? RouteTimeAxisView(ed, sess, rt, canvas) { @@ -236,7 +236,7 @@ MidiTimeAxisView::build_display_menu () items.push_back (SeparatorElem()); items.push_back (CheckMenuElem (_("Active"), mem_fun(*this, &RouteUI::toggle_route_active))); route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back()); - route_active_menu_item->set_active (_route.active()); + route_active_menu_item->set_active (_route->active()); items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Remove"), mem_fun(*this, &RouteUI::remove_this_route))); @@ -268,7 +268,7 @@ MidiTimeAxisView::route_active_changed () RouteUI::route_active_changed (); if (is_midi_track()) { - if (_route.active()) { + if (_route->active()) { controls_ebox.set_name ("MidiTrackControlsBaseUnselected"); controls_base_selected_name = "MidiTrackControlsBaseSelected"; controls_base_unselected_name = "MidiTrackControlsBaseUnselected"; @@ -278,7 +278,7 @@ MidiTimeAxisView::route_active_changed () controls_base_unselected_name = "MidiTrackControlsBaseInactiveUnselected"; } } else { - if (_route.active()) { + if (_route->active()) { controls_ebox.set_name ("BusControlsBaseUnselected"); controls_base_selected_name = "BusControlsBaseSelected"; controls_base_unselected_name = "BusControlsBaseUnselected"; diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index c34b25ea46..be01e16d26 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -63,7 +63,7 @@ class AutomationTimeAxisView; class MidiTimeAxisView : public RouteTimeAxisView { public: - MidiTimeAxisView (PublicEditor&, ARDOUR::Session&, ARDOUR::Route&, ArdourCanvas::Canvas& canvas); + MidiTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas); virtual ~MidiTimeAxisView (); /* overridden from parent to store display state */ @@ -78,7 +78,7 @@ class MidiTimeAxisView : public RouteTimeAxisView void route_active_changed (); - void redirects_changed (void *); + //void redirects_changed (void *); FIXME? void build_display_menu (); diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 2f55d3b79b..cd2b2c15ba 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -80,7 +80,7 @@ speed_printer (char buf[32], Gtk::Adjustment& adj, void* arg) } #endif -MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) +MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer) : AxisView(sess), RouteUI (rt, sess, _("Mute"), _("Solo"), _("Record")), _mixer(mx), @@ -125,12 +125,12 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) output_button.set_name ("MixerIOButton"); output_label.set_name ("MixerIOButtonLabel"); - _route.meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)); + _route->meter_change.connect (mem_fun(*this, &MixerStrip::meter_changed)); meter_point_button.add (meter_point_label); meter_point_button.set_name ("MixerStripMeterPreButton"); meter_point_label.set_name ("MixerStripMeterPreButton"); - switch (_route.meter_point()) { + switch (_route->meter_point()) { case MeterInput: meter_point_label.set_text (_("input")); break; @@ -191,7 +191,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) rec_enable_button->unset_flags (Gtk::CAN_FOCUS); rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press)); - AudioTrack* at = dynamic_cast<AudioTrack*>(&_route); + AudioTrack* at = audio_track(); at->FreezeChange.connect (mem_fun(*this, &MixerStrip::map_frozen)); @@ -217,10 +217,10 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2); name_label.set_name ("MixerNameButtonLabel"); - if (_route.phase_invert()) { + if (_route->phase_invert()) { name_label.set_text (X_("Ø ") + name_label.get_text()); } else { - name_label.set_text (_route.name()); + name_label.set_text (_route->name()); } group_button.add (group_label); @@ -229,9 +229,9 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) comment_button.set_name ("MixerCommentButton"); - ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route.comment()=="" ? + ARDOUR_UI::instance()->tooltips().set_tip (comment_button, _route->comment()=="" ? _("Click to Add/Edit Comments"): - _route.comment()); + _route->comment()); comment_button.signal_clicked().connect (mem_fun(*this, &MixerStrip::comment_button_clicked)); @@ -281,22 +281,22 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) _session.engine().Stopped.connect (mem_fun(*this, &MixerStrip::engine_stopped)); _session.engine().Running.connect (mem_fun(*this, &MixerStrip::engine_running)); - _route.input_changed.connect (mem_fun(*this, &MixerStrip::input_changed)); - _route.output_changed.connect (mem_fun(*this, &MixerStrip::output_changed)); - _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)); - _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); - _route.solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); - _route.mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)); - _route.panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)); + _route->input_changed.connect (mem_fun(*this, &MixerStrip::input_changed)); + _route->output_changed.connect (mem_fun(*this, &MixerStrip::output_changed)); + _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)); + _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); + _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); + _route->mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)); + _route->panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)); if (is_audio_track()) { audio_track()->DiskstreamChanged.connect (mem_fun(*this, &MixerStrip::diskstream_changed)); get_diskstream()->SpeedChanged.connect (mem_fun(*this, &MixerStrip::speed_changed)); } - _route.name_changed.connect (mem_fun(*this, &RouteUI::name_changed)); - _route.comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed)); - _route.gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed)); + _route->name_changed.connect (mem_fun(*this, &RouteUI::name_changed)); + _route->comment_changed.connect (mem_fun(*this, &MixerStrip::comment_changed)); + _route->gui_changed.connect (mem_fun(*this, &MixerStrip::route_gui_changed)); input_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::input_press), false); output_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::output_press), false); @@ -419,16 +419,16 @@ MixerStrip::set_width (Width w) mute_button->set_label (_("mute")); solo_button->set_label (_("solo")); - if (_route.comment() == "") { + if (_route->comment() == "") { comment_button.set_label (_("comments")); } else { comment_button.set_label (_("*comments*")); } - gpm.gain_automation_style_button.set_label (gpm.astyle_string(_route.gain_automation_curve().automation_style())); - gpm.gain_automation_state_button.set_label (gpm.astate_string(_route.gain_automation_curve().automation_state())); - panners.pan_automation_style_button.set_label (panners.astyle_string(_route.panner().automation_style())); - panners.pan_automation_state_button.set_label (panners.astate_string(_route.panner().automation_state())); + gpm.gain_automation_style_button.set_label (gpm.astyle_string(_route->gain_automation_curve().automation_style())); + gpm.gain_automation_state_button.set_label (gpm.astate_string(_route->gain_automation_curve().automation_state())); + panners.pan_automation_style_button.set_label (panners.astyle_string(_route->panner().automation_style())); + panners.pan_automation_state_button.set_label (panners.astate_string(_route->panner().automation_state())); Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2); break; @@ -442,16 +442,16 @@ MixerStrip::set_width (Width w) mute_button->set_label (_("M")); solo_button->set_label (_("S")); - if (_route.comment() == "") { + if (_route->comment() == "") { comment_button.set_label (_("Cmt")); } else { comment_button.set_label (_("*Cmt*")); } - gpm.gain_automation_style_button.set_label (gpm.short_astyle_string(_route.gain_automation_curve().automation_style())); - gpm.gain_automation_state_button.set_label (gpm.short_astate_string(_route.gain_automation_curve().automation_state())); - panners.pan_automation_style_button.set_label (panners.short_astyle_string(_route.panner().automation_style())); - panners.pan_automation_state_button.set_label (panners.short_astate_string(_route.panner().automation_state())); + gpm.gain_automation_style_button.set_label (gpm.short_astyle_string(_route->gain_automation_curve().automation_style())); + gpm.gain_automation_state_button.set_label (gpm.short_astate_string(_route->gain_automation_curve().automation_state())); + panners.pan_automation_style_button.set_label (panners.short_astyle_string(_route->panner().automation_style())); + panners.pan_automation_state_button.set_label (panners.short_astate_string(_route->panner().automation_state())); Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2); break; } @@ -579,7 +579,7 @@ MixerStrip::connection_input_chosen (ARDOUR::Connection *c) if (!ignore_toggle) { try { - _route.use_input_connection (*c, this); + _route->use_input_connection (*c, this); } catch (AudioEngine::PortRegistrationFailure& err) { @@ -595,7 +595,7 @@ MixerStrip::connection_output_chosen (ARDOUR::Connection *c) if (!ignore_toggle) { try { - _route.use_output_connection (*c, this); + _route->use_output_connection (*c, this); } catch (AudioEngine::PortRegistrationFailure& err) { @@ -616,11 +616,11 @@ MixerStrip::add_connection_to_input_menu (ARDOUR::Connection* c) MenuList& citems = input_menu.items(); - if (c->nports() == _route.n_inputs()) { + if (c->nports() == _route->n_inputs()) { citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_input_chosen), c))); - ARDOUR::Connection *current = _route.input_connection(); + ARDOUR::Connection *current = _route->input_connection(); if (current == c) { ignore_toggle = true; @@ -639,12 +639,12 @@ MixerStrip::add_connection_to_output_menu (ARDOUR::Connection* c) return; } - if (c->nports() == _route.n_outputs()) { + if (c->nports() == _route->n_outputs()) { MenuList& citems = output_menu.items(); citems.push_back (CheckMenuElem (c->name(), bind (mem_fun(*this, &MixerStrip::connection_output_chosen), c))); - ARDOUR::Connection *current = _route.output_connection(); + ARDOUR::Connection *current = _route->output_connection(); if (current == c) { ignore_toggle = true; @@ -686,8 +686,8 @@ MixerStrip::connect_to_pan () panstate_connection.disconnect (); panstyle_connection.disconnect (); - if (!_route.panner().empty()) { - StreamPanner* sp = _route.panner().front(); + if (!_route->panner().empty()) { + StreamPanner* sp = _route->panner().front(); panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed)); panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed)); @@ -701,7 +701,7 @@ MixerStrip::update_input_display () { ARDOUR::Connection *c; - if ((c = _route.input_connection()) != 0) { + if ((c = _route->input_connection()) != 0) { input_label.set_text (c->name()); } else { switch (_width) { @@ -721,7 +721,7 @@ MixerStrip::update_output_display () { ARDOUR::Connection *c; - if ((c = _route.output_connection()) != 0) { + if ((c = _route->output_connection()) != 0) { output_label.set_text (c->name()); } else { switch (_width) { @@ -772,8 +772,8 @@ MixerStrip::comment_button_clicked () if (comment_window->is_visible()) { string str = comment_area->get_buffer()->get_text(); - if (_route.comment() != str) { - _route.set_comment (str, this); + if (_route->comment() != str) { + _route->set_comment (str, this); switch (_width) { @@ -817,7 +817,7 @@ void MixerStrip::setup_comment_editor () { string title; - title = _route.name(); + title = _route->name(); title += _(": comment editor"); comment_window = new ArdourDialog (title, false); @@ -829,7 +829,7 @@ MixerStrip::setup_comment_editor () comment_area->set_size_request (110, 178); comment_area->set_wrap_mode (WRAP_WORD); comment_area->set_editable (true); - comment_area->get_buffer()->set_text (_route.comment()); + comment_area->get_buffer()->set_text (_route->comment()); comment_area->show (); comment_window->get_vbox()->pack_start (*comment_area); @@ -844,7 +844,7 @@ MixerStrip::comment_changed (void *src) if (src != this) { ignore_comment_edit = true; if (comment_area) { - comment_area->get_buffer()->set_text (_route.comment()); + comment_area->get_buffer()->set_text (_route->comment()); } ignore_comment_edit = false; } @@ -853,7 +853,7 @@ MixerStrip::comment_changed (void *src) void MixerStrip::set_mix_group (RouteGroup *rg) { - _route.set_mix_group (rg, this); + _route->set_mix_group (rg, this); } void @@ -865,7 +865,7 @@ MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group) items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg))); - if (_route.mix_group() == rg) { + if (_route->mix_group() == rg) { static_cast<RadioMenuItem*>(&items.back())->set_active (); } } @@ -905,7 +905,7 @@ MixerStrip::mix_group_changed (void *ignored) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &MixerStrip::mix_group_changed), ignored)); - RouteGroup *rg = _route.mix_group(); + RouteGroup *rg = _route->mix_group(); if (rg) { group_label.set_text (rg->name()); @@ -961,11 +961,11 @@ MixerStrip::build_route_ops_menu () items.push_back (SeparatorElem()); items.push_back (CheckMenuElem (_("Active"), mem_fun (*this, &RouteUI::toggle_route_active))); route_active_menu_item = dynamic_cast<CheckMenuItem *> (&items.back()); - route_active_menu_item->set_active (_route.active()); + route_active_menu_item->set_active (_route->active()); items.push_back (SeparatorElem()); items.push_back (CheckMenuElem (_("Invert Polarity"), mem_fun (*this, &RouteUI::toggle_polarity))); polarity_menu_item = dynamic_cast<CheckMenuItem *> (&items.back()); - polarity_menu_item->set_active (_route.phase_invert()); + polarity_menu_item->set_active (_route->phase_invert()); build_remote_control_menu (); @@ -1055,10 +1055,10 @@ MixerStrip::name_changed (void *src) RouteUI::name_changed (src); break; case Narrow: - name_label.set_text (PBD::short_version (_route.name(), 5)); + name_label.set_text (PBD::short_version (_route->name(), 5)); break; } - if (_route.phase_invert()) { + if (_route->phase_invert()) { name_label.set_text (X_("Ø ") + name_label.get_text()); } } @@ -1097,7 +1097,7 @@ MixerStrip::map_frozen () { ENSURE_GUI_THREAD (mem_fun(*this, &MixerStrip::map_frozen)); - AudioTrack* at = dynamic_cast<AudioTrack*>(&_route); + AudioTrack* at = audio_track(); if (at) { switch (at->freeze_state()) { @@ -1113,11 +1113,11 @@ MixerStrip::map_frozen () break; } } - _route.foreach_redirect (this, &MixerStrip::hide_redirect_editor); + _route->foreach_redirect (this, &MixerStrip::hide_redirect_editor); } void -MixerStrip::hide_redirect_editor (Redirect* redirect) +MixerStrip::hide_redirect_editor (boost::shared_ptr<Redirect> redirect) { void* gui = redirect->get_gui (); @@ -1134,7 +1134,7 @@ MixerStrip::route_active_changed () // FIXME: MIDI/Audio bus distinction if (is_midi_track()) { - if (_route.active()) { + if (_route->active()) { set_name ("MidiTrackStripBase"); gpm.set_meter_strip_name ("MidiTrackStripBase"); } else { @@ -1143,7 +1143,7 @@ MixerStrip::route_active_changed () } gpm.set_fader_name ("MidiTrackFader"); } else if (is_audio_track()) { - if (_route.active()) { + if (_route->active()) { set_name ("AudioTrackStripBase"); gpm.set_meter_strip_name ("AudioTrackStripBase"); } else { @@ -1152,7 +1152,7 @@ MixerStrip::route_active_changed () } gpm.set_fader_name ("AudioTrackFader"); } else { - if (_route.active()) { + if (_route->active()) { set_name ("AudioBusStripBase"); gpm.set_meter_strip_name ("AudioBusStripBase"); } else { @@ -1166,7 +1166,7 @@ MixerStrip::route_active_changed () RouteGroup* MixerStrip::mix_group() const { - return _route.mix_group(); + return _route->mix_group(); } void @@ -1195,7 +1195,7 @@ MixerStrip::meter_changed (void *src) ENSURE_GUI_THREAD (bind (mem_fun(*this, &MixerStrip::meter_changed), src)); - switch (_route.meter_point()) { + switch (_route->meter_point()) { case MeterInput: meter_point_label.set_text (_("input")); break; diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 1f9095525a..5460134f5e 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -84,7 +84,7 @@ class Mixer_UI; class MixerStrip : public RouteUI, public Gtk::EventBox { public: - MixerStrip (Mixer_UI&, ARDOUR::Session&, ARDOUR::Route &, bool in_mixer = true); + MixerStrip (Mixer_UI&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, bool in_mixer = true); ~MixerStrip (); void set_width (Width); @@ -237,7 +237,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void name_changed (void *src); void update_speed_display (); void map_frozen (); - void hide_redirect_editor (ARDOUR::Redirect* redirect); + void hide_redirect_editor (boost::shared_ptr<ARDOUR::Redirect> redirect); bool ignore_speed_adjustment; diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 983903d6dd..c2eb588b2f 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -251,7 +251,7 @@ Mixer_UI::show_window () } void -Mixer_UI::add_strip (Route* route) +Mixer_UI::add_strip (boost::shared_ptr<Route> route) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::add_strip), route)); @@ -261,7 +261,7 @@ Mixer_UI::add_strip (Route* route) return; } - strip = new MixerStrip (*this, *session, *route); + strip = new MixerStrip (*this, *session, route); strips.push_back (strip); strip->set_width (_strip_width); @@ -310,7 +310,7 @@ void Mixer_UI::follow_strip_selection () { for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) { - (*i)->set_selected (_selection.selected (&(*i)->route())); + (*i)->set_selected (_selection.selected ((*i)->route())); } } @@ -324,13 +324,13 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) at the same time. */ - if (_selection.selected (&strip->route())) { - _selection.remove (&strip->route()); + if (_selection.selected (strip->route())) { + _selection.remove (strip->route()); } else { if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) { - _selection.add (&strip->route()); + _selection.add (strip->route()); } else { - _selection.set (&strip->route()); + _selection.set (strip->route()); } } } @@ -444,7 +444,7 @@ Mixer_UI::set_all_strips_visibility (bool yn) continue; } - if (strip->route().master() || strip->route().control()) { + if (strip->route()->master() || strip->route()->control()) { continue; } @@ -472,11 +472,11 @@ Mixer_UI::set_all_audio_visibility (int tracks, bool yn) continue; } - if (strip->route().master() || strip->route().control()) { + if (strip->route()->master() || strip->route()->control()) { continue; } - AudioTrack* at = dynamic_cast<AudioTrack*> (&strip->route()); + AudioTrack* at = strip->audio_track(); switch (tracks) { case 0: @@ -570,11 +570,11 @@ Mixer_UI::redisplay_track_list () if (visible) { strip->set_marked_for_display (true); - strip->route().set_order_key (N_("signal"), order); + strip->route()->set_order_key (N_("signal"), order); if (strip->packed()) { - if (strip->route().master() || strip->route().control()) { + if (strip->route()->master() || strip->route()->control()) { out_packer.reorder_child (*strip, -1); } else { strip_packer.reorder_child (*strip, -1); /* put at end */ @@ -582,7 +582,7 @@ Mixer_UI::redisplay_track_list () } else { - if (strip->route().master() || strip->route().control()) { + if (strip->route()->master() || strip->route()->control()) { out_packer.pack_start (*strip, false, false); } else { strip_packer.pack_start (*strip, false, false); @@ -593,7 +593,7 @@ Mixer_UI::redisplay_track_list () } else { - if (strip->route().master() || strip->route().control()) { + if (strip->route()->master() || strip->route()->control()) { /* do nothing, these cannot be hidden */ } else { strip_packer.remove (*strip); @@ -604,7 +604,7 @@ Mixer_UI::redisplay_track_list () } struct SignalOrderRouteSorter { - bool operator() (Route* a, Route* b) { + bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) { /* use of ">" forces the correct sort order */ return a->order_key ("signal") < b->order_key ("signal"); } @@ -613,16 +613,17 @@ struct SignalOrderRouteSorter { void Mixer_UI::initial_track_display () { - Session::RouteList routes = session->get_routes(); + boost::shared_ptr<Session::RouteList> routes = session->get_routes(); + Session::RouteList copy (*routes); SignalOrderRouteSorter sorter; - routes.sort (sorter); + copy.sort (sorter); no_track_list_redisplay = true; track_model->clear (); - for (Session::RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (Session::RouteList::iterator i = copy.begin(); i != copy.end(); ++i) { add_strip (*i); } @@ -670,7 +671,7 @@ Mixer_UI::track_display_button_press (GdkEventButton* ev) MixerStrip* strip = (*iter)[track_columns.strip]; if (strip) { - if (!strip->route().master() && !strip->route().control()) { + if (!strip->route()->master() && !strip->route()->control()) { bool visible = (*iter)[track_columns.visible]; (*iter)[track_columns.visible] = !visible; } @@ -715,7 +716,7 @@ Mixer_UI::strip_name_changed (void* src, MixerStrip* mx) for (i = rows.begin(); i != rows.end(); ++i) { if ((*i)[track_columns.strip] == mx) { - (*i)[track_columns.text] = mx->route().name(); + (*i)[track_columns.text] = mx->route()->name(); return; } } diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 864a110de7..6fe4120427 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -111,7 +111,7 @@ class Mixer_UI : public Gtk::Window bool strip_scroller_button_release (GdkEventButton*); - void add_strip (ARDOUR::Route*); + void add_strip (boost::shared_ptr<ARDOUR::Route>); void remove_strip (MixerStrip *); void hide_all_strips (bool with_select); @@ -194,7 +194,7 @@ class Mixer_UI : public Gtk::Window } Gtk::TreeModelColumn<bool> visible; Gtk::TreeModelColumn<Glib::ustring> text; - Gtk::TreeModelColumn<ARDOUR::Route*> route; + Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route; Gtk::TreeModelColumn<MixerStrip*> strip; }; diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index d4c2715742..b7fc7e746e 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ #include <pbd/whitespace.h> +#include <ardour/audio_library.h> #include <ardour/session.h> #include <ardour/audioengine.h> #include <ardour/configuration.h> @@ -59,9 +60,7 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui) /* Paths */ path_table (11, 2), - sfdb_path_columns(), - sfdb_paths(ListStore::create(sfdb_path_columns)), - sfdb_path_view(sfdb_paths), + sfdb_path_view(), /* Fades */ @@ -163,7 +162,6 @@ OptionEditor::set_session (Session *s) return; } - click_path_entry.set_sensitive (true); click_emphasis_path_entry.set_sensitive (true); session_raid_entry.set_sensitive (true); @@ -251,13 +249,19 @@ OptionEditor::setup_path_options() path_table.attach(*label, 0, 1, 2, 3, FILL|EXPAND, FILL); path_table.attach(sfdb_path_view, 1, 3, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL); - sfdb_path_view.append_column(_("Paths"), sfdb_path_columns.paths); - sfdb_path_view.set_size_request(-1, 100); + sfdb_path_view.set_paths(Library->get_paths()); + sfdb_path_view.PathsUpdated.connect (mem_fun(*this, &OptionEditor::sfdb_paths_changed)); path_table.show_all(); } void +OptionEditor::sfdb_paths_changed () +{ + Library->set_paths (sfdb_path_view.get_paths()); +} + +void OptionEditor::add_session_paths () { click_path_entry.set_sensitive (true); diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index b9690b02e2..1331d3126e 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -33,6 +33,8 @@ #include <gtkmm/radiobutton.h> #include <gtkmm/comboboxtext.h> +#include <gtkmm2ext/pathlist.h> + #include <ardour/session.h> #include "ardour_dialog.h" @@ -70,24 +72,16 @@ class OptionEditor : public Gtk::Dialog /* paths */ - Gtk::Table path_table; - Gtk::Entry session_raid_entry; - - struct SoundFilePathColumns : public Gtk::TreeModel::ColumnRecord { - public: - SoundFilePathColumns() { add (paths); } - Gtk::TreeModelColumn<std::string> paths; - - }; + Gtk::Table path_table; + Gtk::Entry session_raid_entry; - SoundFilePathColumns sfdb_path_columns; - Glib::RefPtr<Gtk::ListStore> sfdb_paths; - Gtk::TreeView sfdb_path_view; + Gtkmm2ext::PathList sfdb_path_view; void setup_path_options(); void add_session_paths (); void remove_session_paths (); void raid_path_changed (); + void sfdb_paths_changed (); /* fades */ diff --git a/gtk2_ardour/pan_automation_time_axis.cc b/gtk2_ardour/pan_automation_time_axis.cc index 4cb319f267..fcef6f812c 100644 --- a/gtk2_ardour/pan_automation_time_axis.cc +++ b/gtk2_ardour/pan_automation_time_axis.cc @@ -34,7 +34,8 @@ using namespace ARDOUR; using namespace PBD; using namespace Gtk; -PanAutomationTimeAxisView::PanAutomationTimeAxisView (Session& s, Route& r, PublicEditor& e, TimeAxisView& parent, Canvas& canvas, std::string n) +PanAutomationTimeAxisView::PanAutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, PublicEditor& e, + TimeAxisView& parent, Canvas& canvas, std::string n) : AxisView (s), AutomationTimeAxisView (s, r, e, parent, canvas, n, X_("pan"), "") @@ -140,6 +141,6 @@ void PanAutomationTimeAxisView::set_automation_state (AutoState state) { if (!ignore_state_request) { - route.panner().set_automation_state (state); + route->panner().set_automation_state (state); } } diff --git a/gtk2_ardour/pan_automation_time_axis.h b/gtk2_ardour/pan_automation_time_axis.h index 638c17cb3b..ca4a4db8e7 100644 --- a/gtk2_ardour/pan_automation_time_axis.h +++ b/gtk2_ardour/pan_automation_time_axis.h @@ -14,11 +14,11 @@ class PanAutomationTimeAxisView : public AutomationTimeAxisView { public: PanAutomationTimeAxisView (ARDOUR::Session&, - ARDOUR::Route&, - PublicEditor&, - TimeAxisView& parent_axis, - ArdourCanvas::Canvas& canvas, - std::string name); + boost::shared_ptr<ARDOUR::Route>, + PublicEditor&, + TimeAxisView& parent_axis, + ArdourCanvas::Canvas& canvas, + std::string name); ~PanAutomationTimeAxisView(); diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 3af08b03f7..ea41781a36 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -47,7 +47,7 @@ using namespace Gtk; using namespace sigc; -PannerUI::PannerUI (IO& io, Session& s) +PannerUI::PannerUI (boost::shared_ptr<IO> io, Session& s) : _io (io), _session (s), hAdjustment(0.0, 0.0, 0.0), @@ -87,13 +87,13 @@ PannerUI::PannerUI (IO& io, Session& s) using namespace Menu_Helpers; pan_astate_menu.items().push_back (MenuElem (_("Off"), - bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Off))); + bind (mem_fun (_io->panner(), &Panner::set_automation_state), (AutoState) Off))); pan_astate_menu.items().push_back (MenuElem (_("Play"), - bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Play))); + bind (mem_fun (_io->panner(), &Panner::set_automation_state), (AutoState) Play))); pan_astate_menu.items().push_back (MenuElem (_("Write"), - bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Write))); + bind (mem_fun (_io->panner(), &Panner::set_automation_state), (AutoState) Write))); pan_astate_menu.items().push_back (MenuElem (_("Touch"), - bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Touch))); + bind (mem_fun (_io->panner(), &Panner::set_automation_state), (AutoState) Touch))); pan_astyle_menu.items().push_back (MenuElem (_("Trim"))); pan_astyle_menu.items().push_back (MenuElem (_("Abs"))); @@ -143,9 +143,9 @@ PannerUI::PannerUI (IO& io, Session& s) set_width(Narrow); - _io.panner().Changed.connect (mem_fun(*this, &PannerUI::panner_changed)); - _io.panner().LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage)); - _io.panner().StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state)); + _io->panner().Changed.connect (mem_fun(*this, &PannerUI::panner_changed)); + _io->panner().LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage)); + _io->panner().StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state)); pan_changed (0); update_pan_sensitive (); @@ -165,7 +165,7 @@ PannerUI::panning_link_button_release (GdkEventButton* ev) { cerr << "link release\n"; if (!ignore_toggle) { - _io.panner().set_linked (!_io.panner().linked()); + _io->panner().set_linked (!_io->panner().linked()); } return true; } @@ -173,12 +173,12 @@ PannerUI::panning_link_button_release (GdkEventButton* ev) void PannerUI::panning_link_direction_clicked() { - switch (_io.panner().link_direction()) { + switch (_io->panner().link_direction()) { case Panner::SameDirection: - _io.panner().set_link_direction (Panner::OppositeDirection); + _io->panner().set_link_direction (Panner::OppositeDirection); break; default: - _io.panner().set_link_direction (Panner::SameDirection); + _io->panner().set_link_direction (Panner::SameDirection); break; } } @@ -188,7 +188,7 @@ PannerUI::update_pan_linkage () { ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::update_pan_linkage)); - bool x = _io.panner().linked(); + bool x = _io->panner().linked(); bool bx = panning_link_button.get_active(); if (x != bx) { @@ -200,7 +200,7 @@ PannerUI::update_pan_linkage () panning_link_direction_button.set_sensitive (x); - switch (_io.panner().link_direction()) { + switch (_io->panner().link_direction()) { case Panner::SameDirection: panning_link_direction_button.set_image (*(manage (new Image (get_xpm ("forwardblarrow.xpm"))))); break; @@ -278,7 +278,7 @@ PannerUI::update_pan_state () void PannerUI::setup_pan () { - uint32_t nouts = _io.n_outputs (); + uint32_t nouts = _io->n_outputs (); if (nouts == 0 || nouts == 1) { @@ -292,7 +292,7 @@ PannerUI::setup_pan () } else if (nouts == 2) { vector<Adjustment*>::size_type asz; - uint32_t npans = _io.panner().size(); + uint32_t npans = _io->panner().size(); while (!pan_adjustments.empty()) { delete pan_bars.back(); @@ -308,23 +308,23 @@ PannerUI::setup_pan () /* initialize adjustment with current value of panner */ - _io.panner()[asz]->get_position (x); + _io->panner()[asz]->get_position (x); pan_adjustments.push_back (new Adjustment (x, 0, 1.0, 0.05, 0.1)); pan_adjustments.back()->signal_value_changed().connect (bind (mem_fun(*this, &PannerUI::pan_adjustment_changed), (uint32_t) asz)); - _io.panner()[asz]->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz)); + _io->panner()[asz]->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz)); bc = new BarController (*pan_adjustments[asz], - _io.panner()[asz]->control(), + _io->panner()[asz]->control(), bind (mem_fun(*this, &PannerUI::pan_printer), pan_adjustments[asz])); bc->set_name ("PanSlider"); bc->set_shadow_type (Gtk::SHADOW_NONE); bc->set_style (BarController::Line); - bc->StartGesture.connect (bind (mem_fun (_io, &IO::start_pan_touch), (uint32_t) asz)); - bc->StopGesture.connect (bind (mem_fun (_io, &IO::end_pan_touch), (uint32_t) asz)); + bc->StartGesture.connect (bind (mem_fun (*_io, &IO::start_pan_touch), (uint32_t) asz)); + bc->StopGesture.connect (bind (mem_fun (*_io, &IO::end_pan_touch), (uint32_t) asz)); char buf[64]; snprintf (buf, sizeof (buf), _("panner for channel %zu"), asz + 1); @@ -371,13 +371,13 @@ PannerUI::setup_pan () } if (panner == 0) { - panner = new Panner2d (_io.panner(), w, 61); + panner = new Panner2d (_io->panner(), w, 61); panner->set_name ("MixerPanZone"); panner->show (); } update_pan_sensitive (); - panner->reset (_io.n_inputs()); + panner->reset (_io->n_inputs()); panner->set_size_request (w, 61); /* and finally, add it to the panner frame */ @@ -420,7 +420,7 @@ PannerUI::build_pan_menu (uint32_t which) /* set state first, connect second */ - (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_io.panner()[which]->muted()); + (dynamic_cast<CheckMenuItem*> (&items.back()))->set_active (_io->panner()[which]->muted()); (dynamic_cast<CheckMenuItem*> (&items.back()))->signal_toggled().connect (bind (mem_fun(*this, &PannerUI::pan_mute), which)); @@ -429,7 +429,7 @@ PannerUI::build_pan_menu (uint32_t which) /* set state first, connect second */ - bypass_menu_item->set_active (_io.panner().bypassed()); + bypass_menu_item->set_active (_io->panner().bypassed()); bypass_menu_item->signal_toggled().connect (mem_fun(*this, &PannerUI::pan_bypass_toggle)); items.push_back (MenuElem (_("Reset"), mem_fun(*this, &PannerUI::pan_reset))); @@ -440,15 +440,15 @@ PannerUI::build_pan_menu (uint32_t which) void PannerUI::pan_mute (uint32_t which) { - StreamPanner* sp = _io.panner()[which]; + StreamPanner* sp = _io->panner()[which]; sp->set_muted (!sp->muted()); } void PannerUI::pan_bypass_toggle () { - if (bypass_menu_item && (_io.panner().bypassed() != bypass_menu_item->get_active())) { - _io.panner().set_bypassed (!_io.panner().bypassed()); + if (bypass_menu_item && (_io->panner().bypassed() != bypass_menu_item->get_active())) { + _io->panner().set_bypassed (!_io->panner().bypassed()); } } @@ -460,11 +460,11 @@ PannerUI::pan_reset () void PannerUI::effective_pan_display () { - if (_io.panner().empty()) { + if (_io->panner().empty()) { return; } - switch (_io.n_outputs()) { + switch (_io->n_outputs()) { case 0: case 1: /* relax */ @@ -487,7 +487,7 @@ PannerUI::pan_changed (void *src) return; } - switch (_io.panner().size()) { + switch (_io->panner().size()) { case 0: panning_link_direction_button.set_sensitive (false); panning_link_button.set_sensitive (false); @@ -501,7 +501,7 @@ PannerUI::pan_changed (void *src) panning_link_button.set_sensitive (true); } - uint32_t nouts = _io.n_outputs(); + uint32_t nouts = _io->n_outputs(); switch (nouts) { case 0: @@ -522,11 +522,11 @@ PannerUI::pan_changed (void *src) void PannerUI::pan_adjustment_changed (uint32_t which) { - if (!in_pan_update && which < _io.panner().size()) { + if (!in_pan_update && which < _io->panner().size()) { float xpos; float val = pan_adjustments[which]->get_value (); - _io.panner()[which]->get_position (xpos); + _io->panner()[which]->get_position (xpos); /* add a kinda-sorta detent for the middle */ @@ -543,7 +543,7 @@ PannerUI::pan_adjustment_changed (uint32_t which) if (!Panner::equivalent (val, xpos)) { - _io.panner()[which]->set_position (val); + _io->panner()[which]->set_position (val); /* XXX the panner objects have no access to the session, so do this here. ick. @@ -558,11 +558,11 @@ PannerUI::pan_value_changed (uint32_t which) { ENSURE_GUI_THREAD (bind (mem_fun(*this, &PannerUI::pan_value_changed), which)); - if (_io.n_outputs() > 1 && which < _io.panner().size()) { + if (_io->n_outputs() > 1 && which < _io->panner().size()) { float xpos; float val = pan_adjustments[which]->get_value (); - _io.panner()[which]->get_position (xpos); + _io->panner()[which]->get_position (xpos); if (!Panner::equivalent (val, xpos)) { in_pan_update = true; @@ -588,14 +588,14 @@ PannerUI::update_pan_bars (bool only_if_aplay) float xpos, val; if (only_if_aplay) { - AutomationList& alist (_io.panner()[n]->automation()); + AutomationList& alist (_io->panner()[n]->automation()); if (!alist.automation_playback()) { continue; } } - _io.panner()[n]->get_effective_position (xpos); + _io->panner()[n]->get_effective_position (xpos); val = (*i)->get_value (); if (!Panner::equivalent (val, xpos)) { @@ -626,9 +626,9 @@ PannerUI::pan_printer (char *buf, uint32_t len, Adjustment* adj) void PannerUI::update_pan_sensitive () { - bool sensitive = !(_io.panner().automation_state() & Play); + bool sensitive = !(_io->panner().automation_state() & Play); - switch (_io.n_outputs()) { + switch (_io->n_outputs()) { case 0: case 1: break; @@ -689,10 +689,10 @@ PannerUI::pan_automation_style_changed () switch (_width) { case Wide: - pan_automation_style_button.set_label (astyle_string(_io.panner().automation_style())); + pan_automation_style_button.set_label (astyle_string(_io->panner().automation_style())); break; case Narrow: - pan_automation_style_button.set_label (short_astyle_string(_io.panner().automation_style())); + pan_automation_style_button.set_label (short_astyle_string(_io->panner().automation_style())); break; } } @@ -706,10 +706,10 @@ PannerUI::pan_automation_state_changed () switch (_width) { case Wide: - pan_automation_state_button.set_label (astate_string(_io.panner().automation_state())); + pan_automation_state_button.set_label (astate_string(_io->panner().automation_state())); break; case Narrow: - pan_automation_state_button.set_label (short_astate_string(_io.panner().automation_state())); + pan_automation_state_button.set_label (short_astate_string(_io->panner().automation_state())); break; } @@ -718,11 +718,11 @@ PannerUI::pan_automation_state_changed () here. */ - if (_io.panner().empty()) { + if (_io->panner().empty()) { return; } - x = (_io.panner().front()->automation().automation_state() != Off); + x = (_io->panner().front()->automation().automation_state() != Off); if (pan_automation_state_button.get_active() != x) { ignore_toggle = true; diff --git a/gtk2_ardour/panner_ui.h b/gtk2_ardour/panner_ui.h index 86a8575802..7658978233 100644 --- a/gtk2_ardour/panner_ui.h +++ b/gtk2_ardour/panner_ui.h @@ -55,7 +55,7 @@ namespace Gtk { class PannerUI : public Gtk::HBox { public: - PannerUI (ARDOUR::IO&, ARDOUR::Session&); + PannerUI (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&); ~PannerUI (); void pan_changed (void *); @@ -72,7 +72,7 @@ class PannerUI : public Gtk::HBox private: friend class MixerStrip; - ARDOUR::IO& _io; + boost::shared_ptr<ARDOUR::IO> _io; ARDOUR::Session& _session; bool ignore_toggle; diff --git a/gtk2_ardour/playlist_selector.cc b/gtk2_ardour/playlist_selector.cc index ca3f4e97ba..8eaac7cb9d 100644 --- a/gtk2_ardour/playlist_selector.cc +++ b/gtk2_ardour/playlist_selector.cc @@ -96,7 +96,7 @@ PlaylistSelector::show_for (RouteUI* ruix) rui = ruix; str = _("ardour: playlist for "); - str += rui->route().name(); + str += rui->route()->name(); set_title (str); @@ -223,7 +223,7 @@ PlaylistSelector::selection_changed () TreeModel::iterator iter = tree.get_selection()->get_selected(); - if (!iter) { + if (!iter || rui == 0) { /* nothing selected */ return; } @@ -233,7 +233,7 @@ PlaylistSelector::selection_changed () AudioTrack* at; AudioPlaylist* apl; - if ((at = dynamic_cast<AudioTrack*> (&rui->route())) == 0) { + if ((at = rui->audio_track()) == 0) { /* eh? */ return; } diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc index 16796df160..a762a0b186 100644 --- a/gtk2_ardour/plugin_selector.cc +++ b/gtk2_ardour/plugin_selector.cc @@ -253,7 +253,7 @@ PluginSelector::use_plugin (PluginInfo* pi) return; } - Plugin *plugin = manager->load (*session, pi); + boost::shared_ptr<Plugin> plugin = manager->load (*session, pi); if (plugin) { PluginCreated (plugin); diff --git a/gtk2_ardour/plugin_selector.h b/gtk2_ardour/plugin_selector.h index 125ce1b80a..220de74871 100644 --- a/gtk2_ardour/plugin_selector.h +++ b/gtk2_ardour/plugin_selector.h @@ -35,7 +35,7 @@ class PluginSelector : public ArdourDialog { public: PluginSelector (ARDOUR::PluginManager *); - sigc::signal<void,ARDOUR::Plugin *> PluginCreated; + sigc::signal<void,boost::shared_ptr<ARDOUR::Plugin> > PluginCreated; int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ? diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index e5c8534df6..beddad4e16 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -61,19 +61,19 @@ using namespace Gtkmm2ext; using namespace Gtk; using namespace sigc; -PluginUIWindow::PluginUIWindow (AudioEngine &engine, PluginInsert& insert, bool scrollable) +PluginUIWindow::PluginUIWindow (AudioEngine &engine, boost::shared_ptr<PluginInsert> insert, bool scrollable) : ArdourDialog ("plugin ui") { - if (insert.plugin().has_editor()) { + if (insert->plugin()->has_editor()) { #ifdef VST_SUPPORT - VSTPlugin* vp; + boost::shared_ptr<VSTPlugin> vp; - if ((vp = dynamic_cast<VSTPlugin*> (&insert.plugin())) != 0) { + if ((vp = boost::dynamic_pointer_cast<VSTPlugin> (insert->plugin())) != 0) { - VSTPluginUI* vpu = new VSTPluginUI (insert, *vp); + VSTPluginUI* vpu = new VSTPluginUI (insert, vp); _pluginui = vpu; get_vbox()->add (*vpu); @@ -104,7 +104,7 @@ PluginUIWindow::PluginUIWindow (AudioEngine &engine, PluginInsert& insert, bool add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window*> (this))); - insert.GoingAway.connect (mem_fun(*this, &PluginUIWindow::plugin_going_away)); + insert->GoingAway.connect (mem_fun(*this, &PluginUIWindow::plugin_going_away)); if (scrollable) { gint h = _pluginui->get_preferred_height (); @@ -117,7 +117,7 @@ PluginUIWindow::~PluginUIWindow () { } -PluginUI::PluginUI (AudioEngine &engine, PluginInsert& pi, bool scrollable) +PluginUI::PluginUI (AudioEngine &engine, boost::shared_ptr<PluginInsert> pi, bool scrollable) : PlugUIBase (pi), engine(engine), button_table (initial_button_rows, initial_button_cols), @@ -165,8 +165,8 @@ PluginUI::PluginUI (AudioEngine &engine, PluginInsert& pi, bool scrollable) pack_start (hpacker, false, false); } - insert.active_changed.connect (mem_fun(*this, &PluginUI::redirect_active_changed)); - bypass_button.set_active (!insert.active()); + insert->active_changed.connect (mem_fun(*this, &PluginUI::redirect_active_changed)); + bypass_button.set_active (!insert->active()); build (engine); } @@ -233,13 +233,13 @@ PluginUI::build (AudioEngine &engine) /* find all ports. build control elements for all appropriate control ports */ - for (i = 0; i < plugin.parameter_count(); ++i) { + for (i = 0; i < plugin->parameter_count(); ++i) { - if (plugin.parameter_is_control (i)) { + if (plugin->parameter_is_control (i)) { /* Don't show latency control ports */ - if (plugin.describe_parameter (i) == X_("latency")) { + if (plugin->describe_parameter (i) == X_("latency")) { continue; } @@ -263,7 +263,7 @@ PluginUI::build (AudioEngine &engine) } } - if ((cui = build_control_ui (engine, i, plugin.get_nth_control (i))) == 0) { + if ((cui = build_control_ui (engine, i, plugin->get_nth_control (i))) == 0) { error << string_compose(_("Plugin Editor: could not build control element for port %1"), i) << endmsg; continue; } @@ -326,8 +326,8 @@ PluginUI::build (AudioEngine &engine) } } - n_ins = plugin.get_info().n_inputs; - n_outs = plugin.get_info().n_outputs; + n_ins = plugin->get_info().n_inputs; + n_outs = plugin->get_info().n_outputs; if (box->children().empty()) { hpacker.remove (*frame); @@ -387,7 +387,7 @@ PluginUI::automation_state_changed (ControlUI* cui) { /* update button label */ - switch (insert.get_port_automation_state (cui->port_index) & (Off|Play|Touch|Write)) { + switch (insert->get_port_automation_state (cui->port_index) & (Off|Play|Touch|Write)) { case Off: cui->automate_button.set_label (_("Off")); break; @@ -415,7 +415,7 @@ static void integer_printer (char buf[32], Adjustment &adj, void *arg) void PluginUI::print_parameter (char *buf, uint32_t len, uint32_t param) { - plugin.print_parameter (param, buf, len); + plugin->print_parameter (param, buf, len); } PluginUI::ControlUI* @@ -425,7 +425,7 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro ControlUI* control_ui; Plugin::ParameterDescriptor desc; - plugin.get_parameter_descriptor (port_index, desc); + plugin->get_parameter_descriptor (port_index, desc); control_ui = manage (new ControlUI ()); control_ui->adjustment = 0; @@ -439,11 +439,11 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro control_ui->set_spacing (5); - if (plugin.parameter_is_input (port_index)) { + if (plugin->parameter_is_input (port_index)) { - LadspaPlugin* lp; + boost::shared_ptr<LadspaPlugin> lp; - if ((lp = dynamic_cast<LadspaPlugin*>(&plugin)) != 0) { + if ((lp = boost::dynamic_pointer_cast<LadspaPlugin>(plugin)) != 0) { lrdf_defaults* defaults = lrdf_get_scale_values(lp->unique_id(), port_index); @@ -453,7 +453,7 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro //control_ui->combo->set_value_in_list(true, false); set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui)); control_ui->combo->signal_changed().connect (bind (mem_fun(*this, &PluginUI::control_combo_changed), control_ui)); - plugin.ParameterChanged.connect (bind (mem_fun (*this, &PluginUI::parameter_changed), control_ui)); + plugin->ParameterChanged.connect (bind (mem_fun (*this, &PluginUI::parameter_changed), control_ui)); control_ui->pack_start(control_ui->label, true, true); control_ui->pack_start(*control_ui->combo, false, true); @@ -478,7 +478,7 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro control_ui->button->signal_clicked().connect (bind (mem_fun(*this, &PluginUI::control_port_toggled), control_ui)); - if(plugin.get_parameter (port_index) == 1){ + if(plugin->get_parameter (port_index) == 1){ control_ui->button->set_active(true); } @@ -529,9 +529,9 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro } if (control_ui->logarithmic) { - control_ui->adjustment->set_value(log(plugin.get_parameter(port_index))); + control_ui->adjustment->set_value(log(plugin->get_parameter(port_index))); } else{ - control_ui->adjustment->set_value(plugin.get_parameter(port_index)); + control_ui->adjustment->set_value(plugin->get_parameter(port_index)); } /* XXX memory leak: SliderController not destroyed by ControlUI @@ -552,11 +552,11 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro automation_state_changed (control_ui); - plugin.ParameterChanged.connect (bind (mem_fun(*this, &PluginUI::parameter_changed), control_ui)); - insert.automation_list (port_index).automation_state_changed.connect + plugin->ParameterChanged.connect (bind (mem_fun(*this, &PluginUI::parameter_changed), control_ui)); + insert->automation_list (port_index).automation_state_changed.connect (bind (mem_fun(*this, &PluginUI::automation_state_changed), control_ui)); - } else if (plugin.parameter_is_output (port_index)) { + } else if (plugin->parameter_is_output (port_index)) { control_ui->display = manage (new EventBox); control_ui->display->set_name ("ParameterValueDisplay"); @@ -603,20 +603,20 @@ PluginUI::build_control_ui (AudioEngine &engine, guint32 port_index, PBD::Contro output_controls.push_back (control_ui); } - plugin.ParameterChanged.connect (bind (mem_fun(*this, &PluginUI::parameter_changed), control_ui)); + plugin->ParameterChanged.connect (bind (mem_fun(*this, &PluginUI::parameter_changed), control_ui)); return control_ui; } void PluginUI::start_touch (PluginUI::ControlUI* cui) { - insert.automation_list (cui->port_index).start_touch (); + insert->automation_list (cui->port_index).start_touch (); } void PluginUI::stop_touch (PluginUI::ControlUI* cui) { - insert.automation_list (cui->port_index).stop_touch (); + insert->automation_list (cui->port_index).stop_touch (); } void @@ -647,7 +647,7 @@ PluginUI::astate_clicked (ControlUI* cui, uint32_t port) void PluginUI::set_automation_state (AutoState state, ControlUI* cui) { - insert.set_port_automation_state (cui->port_index, state); + insert->set_port_automation_state (cui->port_index, state); } void @@ -663,7 +663,7 @@ PluginUI::control_adjustment_changed (ControlUI* cui) value = exp(value); } - insert.set_parameter (cui->port_index, (float) value); + insert->set_parameter (cui->port_index, (float) value); } void @@ -684,7 +684,7 @@ PluginUI::update_control_display (ControlUI* cui) cui->update_pending = false; - float val = plugin.get_parameter (cui->port_index); + float val = plugin->get_parameter (cui->port_index); cui->ignore_change++; if (cui->combo) { @@ -718,7 +718,7 @@ void PluginUI::control_port_toggled (ControlUI* cui) { if (!cui->ignore_change) { - insert.set_parameter (cui->port_index, cui->button->get_active()); + insert->set_parameter (cui->port_index, cui->button->get_active()); } } @@ -728,7 +728,7 @@ PluginUI::control_combo_changed (ControlUI* cui) if (!cui->ignore_change) { string value = cui->combo->get_active_text(); std::map<string,float> mapping = *cui->combo_map; - insert.set_parameter (cui->port_index, mapping[value]); + insert->set_parameter (cui->port_index, mapping[value]); } } @@ -774,7 +774,7 @@ void PluginUI::output_update () { for (vector<ControlUI*>::iterator i = output_controls.begin(); i != output_controls.end(); ++i) { - float val = plugin.get_parameter ((*i)->port_index); + float val = plugin->get_parameter ((*i)->port_index); char buf[32]; snprintf (buf, sizeof(buf), "%.2f", val); (*i)->display_label->set_text (buf); @@ -808,7 +808,7 @@ vector<string> PluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) { vector<string> enums; - LadspaPlugin* lp = dynamic_cast<LadspaPlugin*> (&plugin); + boost::shared_ptr<LadspaPlugin> lp = boost::dynamic_pointer_cast<LadspaPlugin> (plugin); cui->combo_map = new std::map<string, float>; lrdf_defaults* defaults = lrdf_get_scale_values(lp->unique_id(), port_index); @@ -827,14 +827,14 @@ PluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) return enums; } -PlugUIBase::PlugUIBase (PluginInsert& pi) +PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi) : insert (pi), - plugin (insert.plugin()), + plugin (insert->plugin()), save_button(_("Add")), bypass_button (_("Bypass")) { //combo.set_use_arrows_always(true); - set_popdown_strings (combo, plugin.get_presets()); + set_popdown_strings (combo, plugin->get_presets()); combo.set_size_request (100, -1); combo.set_active_text (""); combo.signal_changed().connect(mem_fun(*this, &PlugUIBase::setting_selected)); @@ -850,7 +850,7 @@ void PlugUIBase::setting_selected() { if (combo.get_active_text().length() > 0) { - if (!plugin.load_preset(combo.get_active_text())) { + if (!plugin->load_preset(combo.get_active_text())) { warning << string_compose(_("Plugin preset %1 not found"), combo.get_active_text()) << endmsg; } } @@ -875,8 +875,8 @@ PlugUIBase::save_plugin_setting () prompter.get_result(name); if (name.length()) { - if(plugin.save_preset(name)){ - set_popdown_strings (combo, plugin.get_presets()); + if(plugin->save_preset(name)){ + set_popdown_strings (combo, plugin->get_presets()); combo.set_active_text (name); } } @@ -889,8 +889,8 @@ PlugUIBase::bypass_toggled () { bool x; - if ((x = bypass_button.get_active()) == insert.active()) { - insert.set_active (!x, this); + if ((x = bypass_button.get_active()) == insert->active()) { + insert->set_active (!x, this); } } diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 351ab0dc2b..570a224b66 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -67,7 +67,7 @@ namespace Gtkmm2ext { class PlugUIBase : public virtual sigc::trackable { public: - PlugUIBase (ARDOUR::PluginInsert&); + PlugUIBase (boost::shared_ptr<ARDOUR::PluginInsert>); virtual ~PlugUIBase() {} virtual gint get_preferred_height () = 0; @@ -75,8 +75,8 @@ class PlugUIBase : public virtual sigc::trackable virtual bool stop_updating(GdkEventAny*) = 0; protected: - ARDOUR::PluginInsert& insert; - ARDOUR::Plugin& plugin; + boost::shared_ptr<ARDOUR::PluginInsert> insert; + boost::shared_ptr<ARDOUR::Plugin> plugin; Gtk::ComboBoxText combo; Gtk::Button save_button; Gtk::ToggleButton bypass_button; @@ -89,7 +89,7 @@ class PlugUIBase : public virtual sigc::trackable class PluginUI : public PlugUIBase, public Gtk::VBox { public: - PluginUI (ARDOUR::AudioEngine &, ARDOUR::PluginInsert& plug, bool scrollable=false); + PluginUI (ARDOUR::AudioEngine &, boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false); ~PluginUI (); gint get_preferred_height () { return prefheight; } @@ -196,7 +196,7 @@ class PluginUI : public PlugUIBase, public Gtk::VBox class PluginUIWindow : public ArdourDialog { public: - PluginUIWindow (ARDOUR::AudioEngine &, ARDOUR::PluginInsert& insert, bool scrollable=false); + PluginUIWindow (ARDOUR::AudioEngine &, boost::shared_ptr<ARDOUR::PluginInsert> insert, bool scrollable=false); ~PluginUIWindow (); PlugUIBase& pluginui() { return *_pluginui; } @@ -213,7 +213,7 @@ class PluginUIWindow : public ArdourDialog class VSTPluginUI : public PlugUIBase, public Gtk::VBox { public: - VSTPluginUI (ARDOUR::PluginInsert&, ARDOUR::VSTPlugin&); + VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VSTPlugin>); ~VSTPluginUI (); gint get_preferred_height (); @@ -223,7 +223,7 @@ class VSTPluginUI : public PlugUIBase, public Gtk::VBox int package (Gtk::Window&); private: - ARDOUR::VSTPlugin& vst; + boost::shared_ptr<ARDOUR::VSTPlugin> vst; Gtk::Socket socket; Gtk::HBox preset_box; Gtk::VBox vpacker; diff --git a/gtk2_ardour/redirect_automation_line.cc b/gtk2_ardour/redirect_automation_line.cc index 8971e8ff10..1ea5013295 100644 --- a/gtk2_ardour/redirect_automation_line.cc +++ b/gtk2_ardour/redirect_automation_line.cc @@ -55,7 +55,7 @@ RedirectAutomationLine::RedirectAutomationLine (const string & name, Redirect& r /*NOTREACHED*/ } - pi->plugin().get_parameter_descriptor (_port, desc); + pi->plugin()->get_parameter_descriptor (_port, desc); upper = desc.upper; lower = desc.lower; diff --git a/gtk2_ardour/redirect_automation_time_axis.cc b/gtk2_ardour/redirect_automation_time_axis.cc index e1b71310ac..a53c1a20e4 100644 --- a/gtk2_ardour/redirect_automation_time_axis.cc +++ b/gtk2_ardour/redirect_automation_time_axis.cc @@ -32,7 +32,8 @@ using namespace ARDOUR; using namespace PBD; using namespace Gtk; -RedirectAutomationTimeAxisView::RedirectAutomationTimeAxisView (Session& s, Route& r, PublicEditor& e, TimeAxisView& parent, Canvas& canvas, std::string n, +RedirectAutomationTimeAxisView::RedirectAutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, + PublicEditor& e, TimeAxisView& parent, Canvas& canvas, std::string n, uint32_t prt, Redirect& rd, string state_name) : AxisView (s), diff --git a/gtk2_ardour/redirect_automation_time_axis.h b/gtk2_ardour/redirect_automation_time_axis.h index b8d94b2a3e..6976dc2358 100644 --- a/gtk2_ardour/redirect_automation_time_axis.h +++ b/gtk2_ardour/redirect_automation_time_axis.h @@ -14,7 +14,7 @@ class RedirectAutomationTimeAxisView : public AutomationTimeAxisView { public: RedirectAutomationTimeAxisView (ARDOUR::Session&, - ARDOUR::Route&, + boost::shared_ptr<ARDOUR::Route>, PublicEditor&, TimeAxisView& parent, ArdourCanvas::Canvas& canvas, diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index f5cb9522e0..0455dfdeb4 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -76,7 +76,7 @@ bool RedirectBox::get_colors = true; Gdk::Color* RedirectBox::active_redirect_color; Gdk::Color* RedirectBox::inactive_redirect_color; -RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelector &plugsel, +RedirectBox::RedirectBox (Placement pcmnt, Session& sess, boost::shared_ptr<Route> rt, PluginSelector &plugsel, RouteRedirectSelection & rsel, bool owner_is_mixer) : _route(rt), _session(sess), @@ -132,7 +132,7 @@ RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelec pack_start (redirect_eventbox, true, true); - _route.redirects_changed.connect (mem_fun(*this, &RedirectBox::redisplay_redirects)); + _route->redirects_changed.connect (mem_fun(*this, &RedirectBox::redisplay_redirects)); redirect_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::enter_box), this)); @@ -161,10 +161,10 @@ RedirectBox::object_drop (string type, uint32_t cnt, void** ptr) /* do something with the dropped redirects */ - list<Redirect*> redirects; - + list<boost::shared_ptr<Redirect> > redirects; + for (uint32_t n = 0; n < cnt; ++n) { - redirects.push_back ((Redirect*) ptr[n]); + redirects.push_back (boost::shared_ptr<Redirect> ((Redirect*) ptr[n])); } paste_redirect_list (redirects); @@ -189,21 +189,21 @@ RedirectBox::set_width (Width w) } void -RedirectBox::remove_redirect_gui (Redirect *redirect) +RedirectBox::remove_redirect_gui (boost::shared_ptr<Redirect> redirect) { - Insert *insert = 0; - Send *send = 0; - PortInsert *port_insert = 0; + boost::shared_ptr<Insert> insert; + boost::shared_ptr<Send> send; + boost::shared_ptr<PortInsert> port_insert; - if ((insert = dynamic_cast<Insert *> (redirect)) != 0) { + if ((insert = boost::dynamic_pointer_cast<Insert> (redirect)) != 0) { - if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) { + 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 = dynamic_cast<Send *> (insert)) != 0) { + } else if ((send = boost::dynamic_pointer_cast<Send> (insert)) != 0) { SendUIWindow *sui = reinterpret_cast<SendUIWindow*> (send->get_gui()); send->set_gui (0); delete sui; @@ -268,7 +268,7 @@ RedirectBox::redirect_button_press_event (GdkEventButton *ev) TreeViewColumn* column; int cellx; int celly; - Redirect* redirect = 0; + boost::shared_ptr<Redirect> redirect; int ret = false; bool selected = false; @@ -353,25 +353,25 @@ RedirectBox::choose_plugin () } void -RedirectBox::insert_plugin_chosen (Plugin *plugin) +RedirectBox::insert_plugin_chosen (boost::shared_ptr<Plugin> plugin) { if (plugin) { - Redirect *redirect = new PluginInsert (_session, *plugin, _placement); + boost::shared_ptr<Redirect> redirect (new PluginInsert (_session, plugin, _placement)); redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active)); uint32_t err_streams; - if (_route.add_redirect (redirect, this, &err_streams)) { + if (_route->add_redirect (redirect, this, &err_streams)) { wierd_plugin_dialog (*plugin, err_streams, _route); - delete redirect; + // XXX SHAREDPTR delete plugin here .. do we even need to care? } } } void -RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, IO& io) +RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, boost::shared_ptr<IO> io) { ArdourDialog dialog ("wierd plugin dialog"); Label label; @@ -417,8 +417,8 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, IO& io) p.name(), p.get_info().n_inputs, p.get_info().n_outputs, - io.n_inputs(), - io.n_outputs(), + io->n_inputs(), + io->n_outputs(), streams)); } @@ -436,36 +436,36 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, IO& io) void RedirectBox::choose_insert () { - Redirect *redirect = new PortInsert (_session, _placement); + boost::shared_ptr<Redirect> redirect (new PortInsert (_session, _placement)); redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active)); - _route.add_redirect (redirect, this); + _route->add_redirect (redirect, this); } void RedirectBox::choose_send () { - Send *send = new Send (_session, _placement); + boost::shared_ptr<Send> send (new Send (_session, _placement)); /* XXX need redirect lock on route */ - send->ensure_io (0, _route.max_redirect_outs(), false, this); + send->ensure_io (0, _route->max_redirect_outs(), false, this); - IOSelectorWindow *ios = new IOSelectorWindow (_session, *send, false, true); + IOSelectorWindow *ios = new IOSelectorWindow (_session, send, false, true); ios->show_all (); - ios->selector().Finished.connect (bind (mem_fun(*this, &RedirectBox::send_io_finished), static_cast<Redirect*>(send), ios)); + ios->selector().Finished.connect (bind (mem_fun(*this, &RedirectBox::send_io_finished), boost::static_pointer_cast<Redirect>(send), ios)); } void -RedirectBox::send_io_finished (IOSelector::Result r, Redirect* redirect, IOSelectorWindow* ios) +RedirectBox::send_io_finished (IOSelector::Result r, boost::shared_ptr<Redirect> redirect, IOSelectorWindow* ios) { switch (r) { case IOSelector::Cancelled: - delete redirect; + // delete redirect; XXX SHAREDPTR HOW TO DESTROY THE REDIRECT ? do we even need to think about it? break; case IOSelector::Accepted: - _route.add_redirect (redirect, this); + _route->add_redirect (redirect, this); break; } @@ -488,7 +488,8 @@ RedirectBox::redisplay_redirects (void *src) redirect_active_connections.clear (); redirect_name_connections.clear (); - _route.foreach_redirect (this, &RedirectBox::add_redirect_to_display); + void (RedirectBox::*pmf)(boost::shared_ptr<Redirect>) = &RedirectBox::add_redirect_to_display; + _route->foreach_redirect (this, pmf); switch (_placement) { case PreFader: @@ -501,33 +502,33 @@ RedirectBox::redisplay_redirects (void *src) } void -RedirectBox::add_redirect_to_display (Redirect *redirect) +RedirectBox::add_redirect_to_display (boost::shared_ptr<Redirect> redirect) { if (redirect->placement() != _placement) { return; } Gtk::TreeModel::Row row = *(model->append()); - row[columns.text] = redirect_name (*redirect); + row[columns.text] = redirect_name (redirect); row[columns.redirect] = redirect; - show_redirect_active (redirect, this); + show_redirect_active (redirect.get(), this); redirect_active_connections.push_back (redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active))); redirect_name_connections.push_back (redirect->name_changed.connect (bind (mem_fun(*this, &RedirectBox::show_redirect_name), redirect))); } string -RedirectBox::redirect_name (Redirect& redirect) +RedirectBox::redirect_name (boost::shared_ptr<Redirect> redirect) { - Send *send; + boost::shared_ptr<Send> send; string name_display; - if (!redirect.active()) { + if (!redirect->active()) { name_display = " ("; } - if ((send = dynamic_cast<Send *> (&redirect)) != 0) { + if ((send = boost::dynamic_pointer_cast<Send> (redirect)) != 0) { name_display += '>'; @@ -550,16 +551,16 @@ RedirectBox::redirect_name (Redirect& redirect) switch (_width) { case Wide: - name_display += redirect.name(); + name_display += redirect->name(); break; case Narrow: - name_display += PBD::short_version (redirect.name(), 5); + name_display += PBD::short_version (redirect->name(), 5); break; } } - if (!redirect.active()) { + if (!redirect->active()) { name_display += ')'; } @@ -581,34 +582,36 @@ RedirectBox::build_redirect_tooltip (EventBox& box, string start) } void -RedirectBox::show_redirect_name (void* src, Redirect *redirect) +RedirectBox::show_redirect_name (void* src, boost::shared_ptr<Redirect> redirect) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_redirect_name), src, redirect)); - - show_redirect_active (redirect, src); + show_redirect_active (redirect.get(), src); } void -RedirectBox::show_redirect_active (Redirect *redirect, void *src) +RedirectBox::show_redirect_active (Redirect* redirect, void *src) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_redirect_active), redirect, src)); Gtk::TreeModel::Children children = model->children(); Gtk::TreeModel::Children::iterator iter = children.begin(); - while( iter != children.end()) - { - if ((*iter)[columns.redirect] == redirect) - break; - iter++; - } + while (iter != children.end()) { - (*iter)[columns.text] = redirect_name (*redirect); + boost::shared_ptr<Redirect> r = (*iter)[columns.redirect]; - if (redirect->active()) { - (*iter)[columns.color] = *active_redirect_color; - } else { - (*iter)[columns.color] = *inactive_redirect_color; + if (r.get() == redirect) { + (*iter)[columns.text] = redirect_name (r); + + if (redirect->active()) { + (*iter)[columns.color] = *active_redirect_color; + } else { + (*iter)[columns.color] = *inactive_redirect_color; + } + break; + } + + iter++; } } @@ -627,12 +630,12 @@ RedirectBox::compute_redirect_sort_keys () Gtk::TreeModel::Children children = model->children(); for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { - Redirect *redirect = (*iter)[columns.redirect]; - redirect->set_sort_key (sort_key); + boost::shared_ptr<Redirect> r = (*iter)[columns.redirect]; + r->set_sort_key (sort_key); sort_key++; } - if (_route.sort_redirects ()) { + if (_route->sort_redirects ()) { redisplay_redirects (0); @@ -661,7 +664,7 @@ outputs do not work correctly.")); void RedirectBox::rename_redirects () { - vector<Redirect*> to_be_renamed; + vector<boost::shared_ptr<Redirect> > to_be_renamed; get_selected_redirects (to_be_renamed); @@ -669,7 +672,7 @@ RedirectBox::rename_redirects () return; } - for (vector<Redirect*>::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) { + for (vector<boost::shared_ptr<Redirect> >::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) { rename_redirect (*i); } } @@ -677,7 +680,7 @@ RedirectBox::rename_redirects () void RedirectBox::cut_redirects () { - vector<Redirect*> to_be_removed; + vector<boost::shared_ptr<Redirect> > to_be_removed; get_selected_redirects (to_be_removed); @@ -692,7 +695,7 @@ RedirectBox::cut_redirects () _rr_selection.set (to_be_removed); - for (vector<Redirect*>::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) { + for (vector<boost::shared_ptr<Redirect> >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) { void* gui = (*i)->get_gui (); @@ -700,7 +703,7 @@ RedirectBox::cut_redirects () static_cast<Gtk::Widget*>(gui)->hide (); } - if (_route.remove_redirect (*i, this)) { + if (_route->remove_redirect (*i, this)) { /* removal failed */ _rr_selection.remove (*i); } @@ -711,8 +714,8 @@ RedirectBox::cut_redirects () void RedirectBox::copy_redirects () { - vector<Redirect*> to_be_copied; - vector<Redirect*> copies; + vector<boost::shared_ptr<Redirect> > to_be_copied; + vector<boost::shared_ptr<Redirect> > copies; get_selected_redirects (to_be_copied); @@ -720,29 +723,24 @@ RedirectBox::copy_redirects () return; } - for (vector<Redirect*>::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) { - copies.push_back (Redirect::clone (**i)); + for (vector<boost::shared_ptr<Redirect> >::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) { + copies.push_back (Redirect::clone (*i)); } _rr_selection.set (copies); } gint -RedirectBox::idle_delete_redirect (Redirect *redirect) +RedirectBox::idle_delete_redirect (boost::shared_ptr<Redirect> redirect) { /* NOT copied to _mixer.selection() */ - if (_route.remove_redirect (redirect, this)) { - /* removal failed */ - return FALSE; - } - - delete redirect; + _route->remove_redirect (redirect, this); return FALSE; } void -RedirectBox::rename_redirect (Redirect* redirect) +RedirectBox::rename_redirect (boost::shared_ptr<Redirect> redirect) { ArdourPrompter name_prompter (true); string result; @@ -767,7 +765,7 @@ RedirectBox::rename_redirect (Redirect* redirect) } void -RedirectBox::cut_redirect (Redirect *redirect) +RedirectBox::cut_redirect (boost::shared_ptr<Redirect> redirect) { /* this essentially transfers ownership of the redirect of the redirect from the route to the mixer @@ -782,15 +780,15 @@ RedirectBox::cut_redirect (Redirect *redirect) static_cast<Gtk::Widget*>(gui)->hide (); } - if (_route.remove_redirect (redirect, this)) { + if (_route->remove_redirect (redirect, this)) { _rr_selection.remove (redirect); } } void -RedirectBox::copy_redirect (Redirect *redirect) +RedirectBox::copy_redirect (boost::shared_ptr<Redirect> redirect) { - Redirect* copy = Redirect::clone (*redirect); + boost::shared_ptr<Redirect> copy = Redirect::clone (redirect); _rr_selection.add (copy); } @@ -805,22 +803,19 @@ RedirectBox::paste_redirects () } void -RedirectBox::paste_redirect_list (list<Redirect*>& redirects) +RedirectBox::paste_redirect_list (list<boost::shared_ptr<Redirect> >& redirects) { - list<Redirect*> copies; + list<boost::shared_ptr<Redirect> > copies; - for (list<Redirect*>::iterator i = redirects.begin(); i != redirects.end(); ++i) { + for (list<boost::shared_ptr<Redirect> >::iterator i = redirects.begin(); i != redirects.end(); ++i) { - Redirect* copy = Redirect::clone (**i); + boost::shared_ptr<Redirect> copy = Redirect::clone (*i); copy->set_placement (_placement, this); copies.push_back (copy); } - if (_route.add_redirects (copies, this)) { - for (list<Redirect*>::iterator i = copies.begin(); i != copies.end(); ++i) { - delete *i; - } + if (_route->add_redirects (copies, this)) { string msg = _( "Copying the set of redirects on the clipboard failed,\n\ @@ -832,19 +827,19 @@ could not match the configuration of this track."); } void -RedirectBox::activate_redirect (Redirect *r) +RedirectBox::activate_redirect (boost::shared_ptr<Redirect> r) { r->set_active (true, 0); } void -RedirectBox::deactivate_redirect (Redirect *r) +RedirectBox::deactivate_redirect (boost::shared_ptr<Redirect> r) { r->set_active (false, 0); } void -RedirectBox::get_selected_redirects (vector<Redirect*>& redirects) +RedirectBox::get_selected_redirects (vector<boost::shared_ptr<Redirect> >& redirects) { vector<Gtk::TreeModel::Path> pathlist = redirect_display.get_selection()->get_selected_rows(); @@ -853,12 +848,12 @@ RedirectBox::get_selected_redirects (vector<Redirect*>& redirects) } void -RedirectBox::for_selected_redirects (void (RedirectBox::*pmf)(Redirect*)) +RedirectBox::for_selected_redirects (void (RedirectBox::*pmf)(boost::shared_ptr<Redirect>)) { vector<Gtk::TreeModel::Path> pathlist = redirect_display.get_selection()->get_selected_rows(); for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) { - Redirect* redirect = (*(model->get_iter(*iter)))[columns.redirect]; + boost::shared_ptr<Redirect> redirect = (*(model->get_iter(*iter)))[columns.redirect]; (this->*pmf)(redirect); } } @@ -869,7 +864,7 @@ RedirectBox::clone_redirects () RouteSelection& routes (_rr_selection.routes); if (!routes.empty()) { - if (_route.copy_redirects (*routes.front(), _placement)) { + if (_route->copy_redirects (*routes.front(), _placement)) { string msg = _( "Copying the set of redirects on the clipboard failed,\n\ probably because the I/O configuration of the plugins\n\ @@ -883,7 +878,7 @@ could not match the configuration of this track."); void RedirectBox::all_redirects_active (bool state) { - _route.all_redirects_active (state); + _route->all_redirects_active (state); } void @@ -892,7 +887,7 @@ RedirectBox::clear_redirects() string prompt; vector<string> choices; - if (dynamic_cast<AudioTrack*>(&_route) != 0) { + if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) { prompt = _("Do you really want to remove all redirects from this track?\n" "(this cannot be undone)"); } else { @@ -906,23 +901,23 @@ RedirectBox::clear_redirects() Gtkmm2ext::Choice prompter (prompt, choices); if (prompter.run () == 1) { - _route.clear_redirects (this); + _route->clear_redirects (this); } } void -RedirectBox::edit_redirect (Redirect* redirect) +RedirectBox::edit_redirect (boost::shared_ptr<Redirect> redirect) { - Insert *insert; + boost::shared_ptr<Insert> insert; - if (dynamic_cast<AudioTrack*>(&_route) != 0) { + if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) { - if (dynamic_cast<AudioTrack*> (&_route)->freeze_state() == AudioTrack::Frozen) { + if (boost::dynamic_pointer_cast<AudioTrack> (_route)->freeze_state() == AudioTrack::Frozen) { return; } } - if ((insert = dynamic_cast<Insert *> (redirect)) == 0) { + if ((insert = boost::dynamic_pointer_cast<Insert> (redirect)) == 0) { /* its a send */ @@ -930,7 +925,7 @@ RedirectBox::edit_redirect (Redirect* redirect) return; } - Send *send = dynamic_cast<Send*> (redirect); + boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (redirect); SendUIWindow *send_ui; @@ -939,7 +934,7 @@ RedirectBox::edit_redirect (Redirect* redirect) string title; title = string_compose(_("ardour: %1"), send->name()); - send_ui = new SendUIWindow (*send, _session); + send_ui = new SendUIWindow (send, _session); send_ui->set_title (title); send->set_gui (send_ui); @@ -957,17 +952,17 @@ RedirectBox::edit_redirect (Redirect* redirect) /* its an insert */ - PluginInsert *plugin_insert; - PortInsert *port_insert; + boost::shared_ptr<PluginInsert> plugin_insert; + boost::shared_ptr<PortInsert> port_insert; - if ((plugin_insert = dynamic_cast<PluginInsert *> (insert)) != 0) { + if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) { PluginUIWindow *plugin_ui; if (plugin_insert->get_gui() == 0) { string title; - string maker = plugin_insert->plugin().maker(); + string maker = plugin_insert->plugin()->maker(); string::size_type email_pos; if ((email_pos = maker.find_first_of ('<')) != string::npos) { @@ -979,9 +974,9 @@ RedirectBox::edit_redirect (Redirect* redirect) maker += " ..."; } - title = string_compose(_("ardour: %1: %2 (by %3)"), _route.name(), plugin_insert->name(), maker); + title = string_compose(_("ardour: %1: %2 (by %3)"), _route->name(), plugin_insert->name(), maker); - plugin_ui = new PluginUIWindow (_session.engine(), *plugin_insert); + plugin_ui = new PluginUIWindow (_session.engine(), plugin_insert); if (_owner_is_mixer) { ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui); } else { @@ -1000,7 +995,7 @@ RedirectBox::edit_redirect (Redirect* redirect) plugin_ui->show_all (); } - } else if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) { + } 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")); @@ -1011,7 +1006,7 @@ RedirectBox::edit_redirect (Redirect* redirect) PortInsertWindow *io_selector; if (port_insert->get_gui() == 0) { - io_selector = new PortInsertWindow (_session, *port_insert); + io_selector = new PortInsertWindow (_session, port_insert); port_insert->set_gui (io_selector); } else { diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h index 0a4a6d5dee..51c17cad51 100644 --- a/gtk2_ardour/redirect_box.h +++ b/gtk2_ardour/redirect_box.h @@ -65,7 +65,8 @@ namespace ARDOUR { class RedirectBox : public Gtk::HBox { public: - RedirectBox (ARDOUR::Placement, ARDOUR::Session&, ARDOUR::Route &, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false); + RedirectBox (ARDOUR::Placement, ARDOUR::Session&, + boost::shared_ptr<ARDOUR::Route>, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false); ~RedirectBox (); void set_width (Width); @@ -78,8 +79,8 @@ class RedirectBox : public Gtk::HBox void select_all_inserts (); void select_all_sends (); - sigc::signal<void,ARDOUR::Redirect *> RedirectSelected; - sigc::signal<void,ARDOUR::Redirect *> RedirectUnselected; + sigc::signal<void,boost::shared_ptr<ARDOUR::Redirect> > RedirectSelected; + sigc::signal<void,boost::shared_ptr<ARDOUR::Redirect> > RedirectUnselected; static void register_actions(); @@ -87,7 +88,7 @@ class RedirectBox : public Gtk::HBox void set_stuff_from_route (); private: - ARDOUR::Route & _route; + boost::shared_ptr<ARDOUR::Route> _route; ARDOUR::Session & _session; bool _owner_is_mixer; @@ -103,7 +104,7 @@ class RedirectBox : public Gtk::HBox add (color); } Gtk::TreeModelColumn<std::string> text; - Gtk::TreeModelColumn<ARDOUR::Redirect*> redirect; + Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Redirect> > redirect; Gtk::TreeModelColumn<Gdk::Color> color; }; @@ -138,24 +139,29 @@ class RedirectBox : public Gtk::HBox void show_redirect_menu (gint arg); void choose_send (); - void send_io_finished (IOSelector::Result, ARDOUR::Redirect*, IOSelectorWindow*); + void send_io_finished (IOSelector::Result, boost::shared_ptr<ARDOUR::Redirect>, IOSelectorWindow*); void choose_insert (); void choose_plugin (); - void insert_plugin_chosen (ARDOUR::Plugin *); + void insert_plugin_chosen (boost::shared_ptr<ARDOUR::Plugin>); bool no_redirect_redisplay; bool ignore_delete; bool redirect_button_press_event (GdkEventButton *); void redisplay_redirects (void* src); - void show_redirect_active (ARDOUR::Redirect *, void *); - void show_redirect_name (void*, ARDOUR::Redirect *); - void add_redirect_to_display (ARDOUR::Redirect *); + void add_redirect_to_display (boost::shared_ptr<ARDOUR::Redirect>); void row_deleted (const Gtk::TreeModel::Path& path); + void show_redirect_name (void*, boost::shared_ptr<ARDOUR::Redirect>); - string redirect_name (ARDOUR::Redirect&); + /* these are handlers for Redirect signals, so they take Redirect* + directly, rather than shared_ptr<Redirect> + */ - void remove_redirect_gui (ARDOUR::Redirect *); + void show_redirect_active (ARDOUR::Redirect*, void *); + + string redirect_name (boost::shared_ptr<ARDOUR::Redirect>); + + void remove_redirect_gui (boost::shared_ptr<ARDOUR::Redirect>); void redirects_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); void compute_redirect_sort_keys (); @@ -174,23 +180,23 @@ class RedirectBox : public Gtk::HBox void clone_redirects (); void rename_redirects (); - void for_selected_redirects (void (RedirectBox::*pmf)(ARDOUR::Redirect*)); - void get_selected_redirects (vector<ARDOUR::Redirect*>&); + void for_selected_redirects (void (RedirectBox::*pmf)(boost::shared_ptr<ARDOUR::Redirect>)); + void get_selected_redirects (vector<boost::shared_ptr<ARDOUR::Redirect> >&); static Glib::RefPtr<Gtk::Action> paste_action; - void paste_redirect_list (std::list<ARDOUR::Redirect*>& redirects); + void paste_redirect_list (std::list<boost::shared_ptr<ARDOUR::Redirect> >& redirects); - void activate_redirect (ARDOUR::Redirect*); - void deactivate_redirect (ARDOUR::Redirect*); - void cut_redirect (ARDOUR::Redirect*); - void copy_redirect (ARDOUR::Redirect*); - void edit_redirect (ARDOUR::Redirect*); - void hide_redirect_editor (ARDOUR::Redirect*); - void rename_redirect (ARDOUR::Redirect*); + void activate_redirect (boost::shared_ptr<ARDOUR::Redirect>); + void deactivate_redirect (boost::shared_ptr<ARDOUR::Redirect>); + void cut_redirect (boost::shared_ptr<ARDOUR::Redirect>); + void copy_redirect (boost::shared_ptr<ARDOUR::Redirect>); + void edit_redirect (boost::shared_ptr<ARDOUR::Redirect>); + void hide_redirect_editor (boost::shared_ptr<ARDOUR::Redirect>); + void rename_redirect (boost::shared_ptr<ARDOUR::Redirect>); - gint idle_delete_redirect (ARDOUR::Redirect *); + gint idle_delete_redirect (boost::shared_ptr<ARDOUR::Redirect>); - void wierd_plugin_dialog (ARDOUR::Plugin& p, uint32_t streams, ARDOUR::IO& io); + void wierd_plugin_dialog (ARDOUR::Plugin& p, uint32_t streams, boost::shared_ptr<ARDOUR::IO> io); static RedirectBox* _current_redirect_box; static bool enter_box (GdkEventCrossing*, RedirectBox*); diff --git a/gtk2_ardour/redirect_selection.h b/gtk2_ardour/redirect_selection.h index 3695f85c60..5bcd77cfe4 100644 --- a/gtk2_ardour/redirect_selection.h +++ b/gtk2_ardour/redirect_selection.h @@ -2,11 +2,12 @@ #define __ardour_gtk_redirect_selection_h__ #include <list> +#include <boost/shared_ptr.hpp> namespace ARDOUR { class Redirect; } -struct RedirectSelection : list<ARDOUR::Redirect*> {}; +struct RedirectSelection : list<boost::shared_ptr<ARDOUR::Redirect> > {}; #endif /* __ardour_gtk_redirect_selection_h__ */ diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index d6ec7eab6c..8b47a17511 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -59,14 +59,10 @@ using namespace sigc; RouteParams_UI::RouteParams_UI (AudioEngine& eng) : ArdourDialog ("track/bus inspector"), engine (eng), - _route(0), track_menu(0) { pre_redirect_box = 0; post_redirect_box = 0; - _route = 0; - _pre_redirect = 0; - _post_redirect = 0; _input_iosel = 0; _output_iosel = 0; _active_pre_view = 0; @@ -163,7 +159,7 @@ RouteParams_UI::~RouteParams_UI () } void -RouteParams_UI::add_route (Route* route) +RouteParams_UI::add_route (boost::shared_ptr<Route> route) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::add_route), route)); @@ -183,22 +179,22 @@ RouteParams_UI::add_route (Route* route) void -RouteParams_UI::route_name_changed (void *src, Route *route) +RouteParams_UI::route_name_changed (void *src, boost::shared_ptr<Route> route) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::route_name_changed), src, route)); bool found = false ; TreeModel::Children rows = route_display_model->children(); for(TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter) { - if((*iter)[route_display_columns.route] == route) { + boost::shared_ptr<Route> r =(*iter)[route_display_columns.route]; + if (r == route) { (*iter)[route_display_columns.text] = route->name() ; found = true ; break; } } - if(!found) - { + if(!found) { error << _("route display list item for renamed route not found!") << endmsg; } @@ -217,8 +213,8 @@ RouteParams_UI::setup_redirect_boxes() cleanup_redirect_boxes(); // construct new redirect boxes - pre_redirect_box = new RedirectBox(PreFader, *session, *_route, *_plugin_selector, _rr_selection); - post_redirect_box = new RedirectBox(PostFader, *session, *_route, *_plugin_selector, _rr_selection); + pre_redirect_box = new RedirectBox(PreFader, *session, _route, *_plugin_selector, _rr_selection); + post_redirect_box = new RedirectBox(PostFader, *session, _route, *_plugin_selector, _rr_selection); pre_redir_hpane.pack1 (*pre_redirect_box); post_redir_hpane.pack1 (*post_redirect_box); @@ -256,13 +252,13 @@ RouteParams_UI::setup_io_frames() cleanup_io_frames(); // input - _input_iosel = new IOSelector (*session, *_route, true); + _input_iosel = new IOSelector (*session, _route, true); _input_iosel->redisplay (); input_frame.add (*_input_iosel); input_frame.show_all(); // output - _output_iosel = new IOSelector (*session, *_route, false); + _output_iosel = new IOSelector (*session, _route, false); _output_iosel->redisplay (); output_frame.add (*_output_iosel); output_frame.show_all(); @@ -322,36 +318,31 @@ RouteParams_UI::cleanup_post_view (bool stopupdate) void -RouteParams_UI::route_removed (Route *route) +RouteParams_UI::route_removed (boost::shared_ptr<Route> route) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::route_removed), route)); - /* - route_select_list.freeze (); - route_select_list.clear (); - session->foreach_route (this, &RouteParams_UI::add_route); - route_select_list.thaw (); - */ TreeModel::Children rows = route_display_model->children(); TreeModel::Children::iterator ri; for(TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter) { - if((*iter)[route_display_columns.route] == route) { + boost::shared_ptr<Route> r =(*iter)[route_display_columns.route]; + + if (r == route) { route_display_model->erase(iter); break; } } - if (route == _route) - { + if (route == _route) { cleanup_io_frames(); cleanup_pre_view(); cleanup_post_view(); cleanup_redirect_boxes(); - _route = 0; - _pre_redirect = 0; - _post_redirect = 0; + _route.reset ((Route*) 0); + _pre_redirect.reset ((Redirect*) 0); + _post_redirect.reset ((Redirect*) 0); update_title(); } } @@ -390,9 +381,9 @@ RouteParams_UI::session_gone () cleanup_post_view(); cleanup_redirect_boxes(); - _route = 0; - _pre_redirect = 0; - _post_redirect = 0; + _route.reset ((Route*) 0); + _pre_redirect.reset ((Redirect*) 0); + _post_redirect.reset ((Redirect*) 0); update_title(); ArdourDialog::session_gone(); @@ -406,7 +397,7 @@ RouteParams_UI::route_selected() TreeModel::iterator iter = selection->get_selected(); // only used with Gtk::SELECTION_SINGLE if(iter) { //If anything is selected - Route* route = (*iter)[route_display_columns.route] ; + boost::shared_ptr<Route> route = (*iter)[route_display_columns.route] ; if (_route == route) { // do nothing @@ -447,9 +438,9 @@ RouteParams_UI::route_selected() cleanup_post_view(); cleanup_redirect_boxes(); - _route = 0; - _pre_redirect = 0; - _post_redirect = 0; + _route.reset ((Route*) 0); + _pre_redirect.reset ((Redirect*) 0); + _post_redirect.reset ((Redirect *) 0); track_input_label.set_text(_("NO TRACK")); update_title(); } @@ -468,7 +459,7 @@ RouteParams_UI::route_selected() // cleanup_post_view(); // cleanup_redirect_boxes(); -// _route = 0; +// _route.reset ((Route*)0); // _pre_redirect = 0; // _post_redirect = 0; // track_input_label.set_text(_("NO TRACK")); @@ -495,8 +486,8 @@ RouteParams_UI::redirects_changed (void *src) cleanup_pre_view(); cleanup_post_view(); - _pre_redirect = 0; - _post_redirect = 0; + _pre_redirect.reset ((Redirect*) 0); + _post_redirect.reset ((Redirect*) 0); //update_title(); } @@ -520,24 +511,24 @@ RouteParams_UI::show_track_menu() void -RouteParams_UI::redirect_selected (ARDOUR::Redirect *redirect, ARDOUR::Placement place) +RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Redirect> redirect, ARDOUR::Placement place) { - Insert *insert; + boost::shared_ptr<Insert> insert; if ((place == PreFader && _pre_redirect == redirect) || (place == PostFader && _post_redirect == redirect)){ return; } - if ((insert = dynamic_cast<Insert *> (redirect)) == 0) { - - Send *send; + if ((insert = boost::dynamic_pointer_cast<Insert> (redirect)) == 0) { - if ((send = dynamic_cast<Send *> (redirect)) != 0) { + boost::shared_ptr<Send> send; + + if ((send = boost::dynamic_pointer_cast<Send> (redirect)) != 0) { /* its a send */ - SendUI *send_ui = new SendUI (*send, *session); + SendUI *send_ui = new SendUI (send, *session); if (place == PreFader) { cleanup_pre_view(); @@ -560,16 +551,16 @@ RouteParams_UI::redirect_selected (ARDOUR::Redirect *redirect, ARDOUR::Placement } else { /* its an insert, though we don't know what kind yet. */ - PluginInsert *plugin_insert; - PortInsert *port_insert; + boost::shared_ptr<PluginInsert> plugin_insert; + boost::shared_ptr<PortInsert> port_insert; - if ((plugin_insert = dynamic_cast<PluginInsert *> (insert)) != 0) { + if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) { - PluginUI *plugin_ui = new PluginUI (session->engine(), *plugin_insert, true); + PluginUI *plugin_ui = new PluginUI (session->engine(), plugin_insert, true); if (place == PreFader) { cleanup_pre_view(); - _pre_plugin_conn = plugin_insert->plugin().GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), PreFader)); + _pre_plugin_conn = plugin_insert->plugin()->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), PreFader)); plugin_ui->start_updating (0); _active_pre_view = plugin_ui; pre_redir_hpane.pack2 (*_active_pre_view); @@ -577,16 +568,16 @@ RouteParams_UI::redirect_selected (ARDOUR::Redirect *redirect, ARDOUR::Placement } else { cleanup_post_view(); - _post_plugin_conn = plugin_insert->plugin().GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), PostFader)); + _post_plugin_conn = plugin_insert->plugin()->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), PostFader)); plugin_ui->start_updating (0); _active_post_view = plugin_ui; post_redir_hpane.pack2 (*_active_post_view); post_redir_hpane.show_all(); } - } else if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) { + } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (insert)) != 0) { - PortInsertUI *portinsert_ui = new PortInsertUI (*session, *port_insert); + PortInsertUI *portinsert_ui = new PortInsertUI (*session, port_insert); if (place == PreFader) { cleanup_pre_view(); @@ -610,8 +601,7 @@ RouteParams_UI::redirect_selected (ARDOUR::Redirect *redirect, ARDOUR::Placement if (place == PreFader) { _pre_redirect = redirect; - } - else { + } else { _post_redirect = redirect; } @@ -620,23 +610,6 @@ RouteParams_UI::redirect_selected (ARDOUR::Redirect *redirect, ARDOUR::Placement } void -RouteParams_UI::redirect_unselected (ARDOUR::Redirect *redirect) -{ - // not called anymore - - if (redirect == _pre_redirect) { - cleanup_pre_view(); - _pre_redirect = 0; - } - else if (redirect == _post_redirect) { - cleanup_post_view(); - _post_redirect = 0; - } -} - - - -void RouteParams_UI::plugin_going_away (Plugin *plugin, Placement place) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::plugin_going_away), plugin, place)); @@ -645,11 +618,11 @@ RouteParams_UI::plugin_going_away (Plugin *plugin, Placement place) if (place == PreFader) { cleanup_pre_view (false); - _pre_redirect = 0; + _pre_redirect.reset ((Redirect*) 0); } else { cleanup_post_view (false); - _post_redirect = 0; + _post_redirect.reset ((Redirect*) 0); } } @@ -661,13 +634,13 @@ RouteParams_UI::redirect_going_away (ARDOUR::Redirect *plugin) printf ("redirect going away\n"); // delete the current view without calling finish - if (plugin == _pre_redirect) { + if (plugin == _pre_redirect.get()) { cleanup_pre_view (false); - _pre_redirect = 0; + _pre_redirect.reset ((Redirect*) 0); } - else if (plugin == _post_redirect) { + else if (plugin == _post_redirect.get()) { cleanup_post_view (false); - _post_redirect = 0; + _post_redirect.reset ((Redirect*) 0); } } diff --git a/gtk2_ardour/route_params_ui.h b/gtk2_ardour/route_params_ui.h index 29f5b9112a..5f487d6e5c 100644 --- a/gtk2_ardour/route_params_ui.h +++ b/gtk2_ardour/route_params_ui.h @@ -121,14 +121,14 @@ class RouteParams_UI : public ArdourDialog PluginSelector *_plugin_selector; RouteRedirectSelection _rr_selection; - ARDOUR::Route *_route; + boost::shared_ptr<ARDOUR::Route> _route; sigc::connection _route_conn; sigc::connection _route_ds_conn; - ARDOUR::Redirect * _pre_redirect; + boost::shared_ptr<ARDOUR::Redirect> _pre_redirect; sigc::connection _pre_plugin_conn; - ARDOUR::Redirect * _post_redirect; + boost::shared_ptr<ARDOUR::Redirect> _post_redirect; sigc::connection _post_plugin_conn; @@ -151,7 +151,7 @@ class RouteParams_UI : public ArdourDialog add(route); } Gtk::TreeModelColumn<Glib::ustring> text; - Gtk::TreeModelColumn<ARDOUR::Route*> route; + Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route; }; RouteDisplayModelColumns route_display_columns ; @@ -159,10 +159,10 @@ class RouteParams_UI : public ArdourDialog Glib::RefPtr<Gtk::ListStore> route_display_model; - void add_route (ARDOUR::Route*); + void add_route (boost::shared_ptr<ARDOUR::Route>); - void route_name_changed (void *src, ARDOUR::Route *route); - void route_removed (ARDOUR::Route *route); + void route_name_changed (void *src, boost::shared_ptr<ARDOUR::Route> route); + void route_removed (boost::shared_ptr<ARDOUR::Route> route); void route_selected(); @@ -180,8 +180,7 @@ class RouteParams_UI : public ArdourDialog void setup_redirect_boxes(); void cleanup_redirect_boxes(); - void redirect_selected (ARDOUR::Redirect *, ARDOUR::Placement); - void redirect_unselected (ARDOUR::Redirect *); + void redirect_selected (boost::shared_ptr<ARDOUR::Redirect>, ARDOUR::Placement); void plugin_going_away (ARDOUR::Plugin *foo, ARDOUR::Placement); void redirect_going_away (ARDOUR::Redirect *foo); diff --git a/gtk2_ardour/route_redirect_selection.cc b/gtk2_ardour/route_redirect_selection.cc index 6d315e0aae..76f202dd92 100644 --- a/gtk2_ardour/route_redirect_selection.cc +++ b/gtk2_ardour/route_redirect_selection.cc @@ -61,17 +61,6 @@ RouteRedirectSelection::clear () void RouteRedirectSelection::clear_redirects () { - for (RedirectSelection::iterator i = redirects.begin(); i != redirects.end(); ) { - RedirectSelection::iterator tmp; - - tmp = i; - ++tmp; - - delete *i; - - i = tmp; - } - redirects.clear (); RedirectsChanged (); } @@ -84,29 +73,32 @@ RouteRedirectSelection::clear_routes () } void -RouteRedirectSelection::add (Redirect* r) +RouteRedirectSelection::add (boost::shared_ptr<Redirect> r) { if (find (redirects.begin(), redirects.end(), r) == redirects.end()) { redirects.push_back (r); - - void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; - r->GoingAway.connect (mem_fun(*this, pmf)); + + // XXX SHAREDPTR FIXME + // void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; + // r->GoingAway.connect (mem_fun(*this, pmf)); RedirectsChanged(); } } void -RouteRedirectSelection::add (const vector<Redirect*>& rlist) +RouteRedirectSelection::add (const vector<boost::shared_ptr<Redirect> >& rlist) { bool changed = false; - for (vector<Redirect*>::const_iterator i = rlist.begin(); i != rlist.end(); ++i) { + for (vector<boost::shared_ptr<Redirect> >::const_iterator i = rlist.begin(); i != rlist.end(); ++i) { if (find (redirects.begin(), redirects.end(), *i) == redirects.end()) { redirects.push_back (*i); - void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; - (*i)->GoingAway.connect (mem_fun(*this, pmf)); + // XXX SHAREDPTR FIXME + + //void (RouteRedirectSelection::*pmf)(Redirect*) = &RouteRedirectSelection::remove; + // (*i)->GoingAway.connect (mem_fun(*this, pmf)); changed = true; } } @@ -117,9 +109,9 @@ RouteRedirectSelection::add (const vector<Redirect*>& rlist) } void -RouteRedirectSelection::remove (Redirect* r) +RouteRedirectSelection::remove (boost::shared_ptr<Redirect> r) { - list<Redirect*>::iterator i; + list<boost::shared_ptr<Redirect> >::iterator i; if ((i = find (redirects.begin(), redirects.end(), r)) != redirects.end()) { redirects.erase (i); RedirectsChanged (); @@ -127,36 +119,37 @@ RouteRedirectSelection::remove (Redirect* r) } void -RouteRedirectSelection::set (Redirect *r) +RouteRedirectSelection::set (boost::shared_ptr<Redirect> r) { clear_redirects (); add (r); } void -RouteRedirectSelection::set (const vector<Redirect*>& rlist) +RouteRedirectSelection::set (const vector<boost::shared_ptr<Redirect> >& rlist) { clear_redirects (); add (rlist); } void -RouteRedirectSelection::add (Route* r) +RouteRedirectSelection::add (boost::shared_ptr<Route> r) { if (find (routes.begin(), routes.end(), r) == routes.end()) { routes.push_back (r); - void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove; - r->GoingAway.connect (bind (mem_fun(*this, pmf), r)); + // XXX SHAREDPTR FIXME + // void (RouteRedirectSelection::*pmf)(Route*) = &RouteRedirectSelection::remove; + // r->GoingAway.connect (bind (mem_fun(*this, pmf), r)); RoutesChanged(); } } void -RouteRedirectSelection::remove (Route* r) +RouteRedirectSelection::remove (boost::shared_ptr<Route> r) { - list<Route*>::iterator i; + list<boost::shared_ptr<Route> >::iterator i; if ((i = find (routes.begin(), routes.end(), r)) != routes.end()) { routes.erase (i); RoutesChanged (); @@ -164,16 +157,16 @@ RouteRedirectSelection::remove (Route* r) } void -RouteRedirectSelection::set (Route *r) +RouteRedirectSelection::set (boost::shared_ptr<Route> r) { clear_routes (); add (r); } bool -RouteRedirectSelection::selected (Route* ms) +RouteRedirectSelection::selected (boost::shared_ptr<Route> r) { - return find (routes.begin(), routes.end(), ms) != routes.end(); + return find (routes.begin(), routes.end(), r) != routes.end(); } bool diff --git a/gtk2_ardour/route_redirect_selection.h b/gtk2_ardour/route_redirect_selection.h index 9e2b866171..60d301e762 100644 --- a/gtk2_ardour/route_redirect_selection.h +++ b/gtk2_ardour/route_redirect_selection.h @@ -43,20 +43,20 @@ class RouteRedirectSelection : public sigc::trackable void clear (); bool empty(); - void set (ARDOUR::Redirect*); - void set (const std::vector<ARDOUR::Redirect*>&); - void add (ARDOUR::Redirect*); - void add (const std::vector<ARDOUR::Redirect*>&); - void remove (ARDOUR::Redirect*); + void set (boost::shared_ptr<ARDOUR::Redirect>); + void set (const std::vector<boost::shared_ptr<ARDOUR::Redirect> >&); + void add (boost::shared_ptr<ARDOUR::Redirect>); + void add (const std::vector<boost::shared_ptr<ARDOUR::Redirect> >&); + void remove (boost::shared_ptr<ARDOUR::Redirect>); - void set (ARDOUR::Route*); - void add (ARDOUR::Route*); - void remove (ARDOUR::Route*); + void set (boost::shared_ptr<ARDOUR::Route>); + void add (boost::shared_ptr<ARDOUR::Route>); + void remove (boost::shared_ptr<ARDOUR::Route>); void clear_redirects (); void clear_routes (); - bool selected (ARDOUR::Route*); + bool selected (boost::shared_ptr<ARDOUR::Route>); }; bool operator==(const RouteRedirectSelection& a, const RouteRedirectSelection& b); diff --git a/gtk2_ardour/route_selection.h b/gtk2_ardour/route_selection.h index 50797deed3..8d5673a2ef 100644 --- a/gtk2_ardour/route_selection.h +++ b/gtk2_ardour/route_selection.h @@ -1,12 +1,14 @@ #ifndef __ardour_gtk_route_selection_h__ #define __ardour_gtk_route_selection_h__ + +#include <boost/shared_ptr.hpp> #include <list> namespace ARDOUR { class Route; } -struct RouteSelection : list<ARDOUR::Route*> {}; +struct RouteSelection : std::list<boost::shared_ptr<ARDOUR::Route> > {}; #endif /* __ardour_gtk_route_selection_h__ */ diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index f6a533d965..b4f250b5ef 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -77,7 +77,7 @@ using namespace Gtk; using namespace Editing; -RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Canvas& canvas) +RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas) : AxisView(sess), RouteUI(rt, sess, _("m"), _("s"), _("r")), // mute, solo, and record TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas), @@ -98,8 +98,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, Route& rt timestretch_rect = 0; no_redraw = false; - //view = new AudioStreamView (*this); - ignore_toggle = false; mute_button->set_active (false); @@ -189,11 +187,11 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, Route& rt //reset_redirect_automation_curves (); y_position = -1; - _route.mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)); - _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); - //_route.redirects_changed.connect (mem_fun(*this, &RouteTimeAxisView::redirects_changed)); - _route.name_changed.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed)); - _route.solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); + _route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed)); + _route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); + _route->redirects_changed.connect (mem_fun(*this, &RouteTimeAxisView::redirects_changed)); + _route->name_changed.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed)); + _route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); if (is_track()) { @@ -257,7 +255,7 @@ gint RouteTimeAxisView::edit_click (GdkEventButton *ev) { if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { - _route.set_edit_group (0, this); + _route->set_edit_group (0, this); return FALSE; } @@ -270,7 +268,7 @@ RouteTimeAxisView::edit_click (GdkEventButton *ev) items.push_back (RadioMenuElem (group, _("No group"), bind (mem_fun(*this, &RouteTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0))); - if (_route.edit_group() == 0) { + if (_route->edit_group() == 0) { static_cast<RadioMenuItem*>(&items.back())->set_active (); } @@ -290,7 +288,7 @@ RouteTimeAxisView::add_edit_group_menu_item (RouteGroup *eg, RadioMenuItem::Grou cerr << "adding edit group " << eg->name() << endl; items.push_back (RadioMenuElem (*group, eg->name(), bind (mem_fun(*this, &RouteTimeAxisView::set_edit_group_from_menu), eg))); - if (_route.edit_group() == eg) { + if (_route->edit_group() == eg) { static_cast<RadioMenuItem*>(&items.back())->set_active (); } } @@ -299,7 +297,7 @@ void RouteTimeAxisView::set_edit_group_from_menu (RouteGroup *eg) { - _route.set_edit_group (eg, this); + _route->set_edit_group (eg, this); } void @@ -323,7 +321,7 @@ RouteTimeAxisView::playlist_changed () void RouteTimeAxisView::label_view () { - string x = _route.name(); + string x = _route->name(); if (x != name_entry.get_text()) { name_entry.set_text (x); @@ -396,14 +394,14 @@ RouteTimeAxisView::show_timestretch (jack_nframes_t start, jack_nframes_t end) remember that edit_group() == 0 implies the route is *not* in a edit group. */ - if (!(ts.track == this || (ts.group != 0 && ts.group == _route.edit_group()))) { + if (!(ts.track == this || (ts.group != 0 && ts.group == _route->edit_group()))) { /* this doesn't apply to us */ return; } /* ignore it if our edit group is not active */ - if ((ts.track != this) && _route.edit_group() && !_route.edit_group()->is_active()) { + if ((ts.track != this) && _route->edit_group() && !_route->edit_group()->is_active()) { return; } #endif @@ -451,8 +449,8 @@ RouteTimeAxisView::show_selection (TimeSelection& ts) that the track is not in an edit group). */ - if (((ts.track != this && !is_child (ts.track)) && _route.edit_group() && !_route.edit_group()->is_active()) || - (!(ts.track == this || is_child (ts.track) || (ts.group != 0 && ts.group == _route.edit_group())))) { + if (((ts.track != this && !is_child (ts.track)) && _route->edit_group() && !_route->edit_group()->is_active()) || + (!(ts.track == this || is_child (ts.track) || (ts.group != 0 && ts.group == _route->edit_group())))) { hide_selection (); return; } @@ -515,13 +513,13 @@ RouteTimeAxisView::set_height (TrackHeight h) controls_table.show (); hide_name_entry (); show_name_label (); - name_label.set_text (_route.name()); + name_label.set_text (_route->name()); break; } if (height_changed) { /* only emit the signal if the height really changed */ - _route.gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */ } } @@ -733,7 +731,7 @@ RouteTimeAxisView::update_diskstream_display () void RouteTimeAxisView::selection_click (GdkEventButton* ev) { - PublicEditor::TrackViewList* tracks = editor.get_valid_views (this, _route.edit_group()); + PublicEditor::TrackViewList* tracks = editor.get_valid_views (this, _route->edit_group()); switch (Keyboard::selection_type (ev->state)) { case Selection::Toggle: @@ -805,13 +803,13 @@ RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& RouteGroup* RouteTimeAxisView::edit_group() const { - return _route.edit_group(); + return _route->edit_group(); } string RouteTimeAxisView::name() const { - return _route.name(); + return _route->name(); } Playlist * @@ -833,22 +831,22 @@ RouteTimeAxisView::name_entry_changed () x = name_entry.get_text (); - if (x == _route.name()) { + if (x == _route->name()) { return; } if (x.length() == 0) { - name_entry.set_text (_route.name()); + name_entry.set_text (_route->name()); return; } strip_whitespace_edges(x); if (_session.route_name_unique (x)) { - _route.set_name (x, this); + _route->set_name (x, this); } else { ARDOUR_UI::instance()->popup_error (_("a track already exists with that name")); - name_entry.set_text (_route.name()); + name_entry.set_text (_route->name()); } } diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index e63253af24..a75851b8a8 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -63,7 +63,7 @@ class TimeSelection; class RouteTimeAxisView : public RouteUI, public TimeAxisView { public: - RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, ARDOUR::Route&, ArdourCanvas::Canvas& canvas); + RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas); virtual ~RouteTimeAxisView (); void show_selection (TimeSelection&); @@ -101,7 +101,7 @@ class RouteTimeAxisView : public RouteUI, public TimeAxisView void use_copy_playlist (bool prompt); void clear_playlist (); - //private: + //private: (FIXME) friend class StreamView; StreamView *_view; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 2713a666e4..5ba143ad21 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -46,9 +46,9 @@ using namespace ARDOUR; using namespace PBD; -RouteUI::RouteUI (ARDOUR::Route& rt, ARDOUR::Session& sess, const char* m_name, +RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess, const char* m_name, const char* s_name, const char* r_name) - : AxisView(sess), + : AxisView(sess), _route(rt), mute_button(0), solo_button(0), @@ -66,16 +66,16 @@ RouteUI::RouteUI (ARDOUR::Route& rt, ARDOUR::Session& sess, const char* m_name, set_color (unique_random_color()); } - _route.GoingAway.connect (mem_fun (*this, &RouteUI::route_removed)); - _route.active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed)); + _route->GoingAway.connect (mem_fun (*this, &RouteUI::route_removed)); + _route->active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed)); - mute_button = manage (new BindableToggleButton (_route.mute_control(), m_name )); - solo_button = manage (new BindableToggleButton (_route.solo_control(), s_name )); + mute_button = manage (new BindableToggleButton (_route->mute_control(), m_name )); + solo_button = manage (new BindableToggleButton (_route->solo_control(), s_name )); if (is_track()) { - Track* t = dynamic_cast<Track*>(&_route); + boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route); - get_diskstream()->RecordEnableChanged.connect (mem_fun (*this, &RouteUI::route_rec_enable_changed)); + t->diskstream().RecordEnableChanged.connect (mem_fun (*this, &RouteUI::route_rec_enable_changed)); _session.RecordStateChanged.connect (mem_fun (*this, &RouteUI::session_rec_enable_changed)); @@ -131,7 +131,7 @@ RouteUI::mute_press(GdkEventButton* ev) _session.begin_reversible_command (_("mute change")); _session.add_undo (_session.global_mute_memento(this)); - _session.set_all_mute (!_route.muted()); + _session.set_all_mute (!_route->muted()); _session.add_redo_no_execute (_session.global_mute_memento(this)); _session.commit_reversible_command (); @@ -142,14 +142,14 @@ RouteUI::mute_press(GdkEventButton* ev) */ if (ev->button == 1) { - set_mix_group_mute (_route, !_route.muted()); + set_mix_group_mute (_route, !_route->muted()); } } else { /* plain click applies change to this route */ - reversibly_apply_route_boolean ("mute change", &Route::set_mute, !_route.muted(), this); + reversibly_apply_route_boolean ("mute change", &Route::set_mute, !_route->muted(), this); } } } @@ -206,7 +206,7 @@ RouteUI::solo_press(GdkEventButton* ev) _session.begin_reversible_command (_("solo change")); _session.add_undo (_session.global_solo_memento(this)); - _session.set_all_solo (!_route.soloed()); + _session.set_all_solo (!_route->soloed()); _session.add_redo_no_execute (_session.global_solo_memento(this)); _session.commit_reversible_command (); @@ -217,7 +217,7 @@ RouteUI::solo_press(GdkEventButton* ev) _session.begin_reversible_command (_("solo change")); _session.add_undo (_session.global_solo_memento(this)); _session.set_all_solo (false); - _route.set_solo (true, this); + _route->set_solo (true, this); _session.add_redo_no_execute (_session.global_solo_memento(this)); _session.commit_reversible_command (); @@ -225,7 +225,7 @@ RouteUI::solo_press(GdkEventButton* ev) // shift-click: set this route to solo safe - _route.set_solo_safe (!_route.solo_safe(), this); + _route->set_solo_safe (!_route->solo_safe(), this); wait_for_release = false; } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { @@ -235,14 +235,14 @@ RouteUI::solo_press(GdkEventButton* ev) */ if (ev->button == 1) { - set_mix_group_solo (_route, !_route.soloed()); + set_mix_group_solo (_route, !_route->soloed()); } } else { /* click: solo this route */ - reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route.soloed(), this); + reversibly_apply_route_boolean ("solo change", &Route::set_solo, !_route->soloed(), this); } } } @@ -291,7 +291,7 @@ RouteUI::rec_enable_press(GdkEventButton* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) { - set_mix_group_rec_enable (_route, !_route.record_enabled()); + set_mix_group_rec_enable (_route, !_route->record_enabled()); } else { @@ -319,7 +319,7 @@ RouteUI::update_solo_display () { bool x; - if (solo_button->get_active() != (x = _route.soloed())){ + if (solo_button->get_active() != (x = _route->soloed())){ ignore_toggle = true; solo_button->set_active(x); ignore_toggle = false; @@ -327,7 +327,7 @@ RouteUI::update_solo_display () /* show solo safe */ - if (_route.solo_safe()){ + if (_route->solo_safe()){ solo_button->set_name(safe_solo_button_name()); } else { solo_button->set_name(solo_button_name()); @@ -345,7 +345,7 @@ RouteUI::update_mute_display () { bool x; - if (mute_button->get_active() != (x = _route.muted())){ + if (mute_button->get_active() != (x = _route->muted())){ ignore_toggle = true; mute_button->set_active(x); ignore_toggle = false; @@ -367,7 +367,7 @@ RouteUI::session_rec_enable_changed () void RouteUI::update_rec_display () { - bool model = _route.record_enabled(); + bool model = _route->record_enabled(); bool view = rec_enable_button->get_active(); /* first make sure the button's "depressed" visual @@ -433,7 +433,7 @@ RouteUI::refresh_remote_control_menu () limit += 4; /* leave some breathing room */ rc_items.push_back (RadioMenuElem (rc_group, _("None"))); - if (_route.remote_control_id() == 0) { + if (_route->remote_control_id() == 0) { rc_active = dynamic_cast<CheckMenuItem*> (&rc_items.back()); rc_active->set_active (); } @@ -442,7 +442,7 @@ RouteUI::refresh_remote_control_menu () snprintf (buf, sizeof (buf), "%u", i); rc_items.push_back (RadioMenuElem (rc_group, buf)); rc_active = dynamic_cast<RadioMenuItem*>(&rc_items.back()); - if (_route.remote_control_id() == i) { + if (_route->remote_control_id() == i) { rc_active = dynamic_cast<CheckMenuItem*> (&rc_items.back()); rc_active->set_active (); } @@ -460,7 +460,7 @@ RouteUI::set_remote_control_id (uint32_t id, CheckMenuItem* item) */ if (item->get_active()) { - _route.set_remote_control_id (id); + _route->set_remote_control_id (id); } } @@ -475,9 +475,9 @@ RouteUI::build_solo_menu (void) CheckMenuItem* check; check = new CheckMenuItem(_("Solo-safe")); - check->set_active (_route.solo_safe()); + check->set_active (_route->solo_safe()); check->signal_toggled().connect (bind (mem_fun (*this, &RouteUI::toggle_solo_safe), check)); - _route.solo_safe_changed.connect(bind (mem_fun (*this, &RouteUI::solo_safe_toggle), check)); + _route->solo_safe_changed.connect(bind (mem_fun (*this, &RouteUI::solo_safe_toggle), check)); items.push_back (CheckMenuElem(*check)); check->show_all(); @@ -499,28 +499,28 @@ RouteUI::build_mute_menu(void) check = new CheckMenuItem(_("Pre Fader")); init_mute_menu(PRE_FADER, check); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), PRE_FADER, check)); - _route.pre_fader_changed.connect(bind (mem_fun (*this, &RouteUI::pre_fader_toggle), check)); + _route->pre_fader_changed.connect(bind (mem_fun (*this, &RouteUI::pre_fader_toggle), check)); items.push_back (CheckMenuElem(*check)); check->show_all(); check = new CheckMenuItem(_("Post Fader")); init_mute_menu(POST_FADER, check); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), POST_FADER, check)); - _route.post_fader_changed.connect(bind (mem_fun (*this, &RouteUI::post_fader_toggle), check)); + _route->post_fader_changed.connect(bind (mem_fun (*this, &RouteUI::post_fader_toggle), check)); items.push_back (CheckMenuElem(*check)); check->show_all(); check = new CheckMenuItem(_("Control Outs")); init_mute_menu(CONTROL_OUTS, check); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), CONTROL_OUTS, check)); - _route.control_outs_changed.connect(bind (mem_fun (*this, &RouteUI::control_outs_toggle), check)); + _route->control_outs_changed.connect(bind (mem_fun (*this, &RouteUI::control_outs_toggle), check)); items.push_back (CheckMenuElem(*check)); check->show_all(); check = new CheckMenuItem(_("Main Outs")); init_mute_menu(MAIN_OUTS, check); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), MAIN_OUTS, check)); - _route.main_outs_changed.connect(bind (mem_fun (*this, &RouteUI::main_outs_toggle), check)); + _route->main_outs_changed.connect(bind (mem_fun (*this, &RouteUI::main_outs_toggle), check)); items.push_back (CheckMenuElem(*check)); check->show_all(); @@ -531,7 +531,7 @@ RouteUI::build_mute_menu(void) void RouteUI::init_mute_menu(mute_type type, CheckMenuItem* check) { - if (_route.get_mute_config (type)) { + if (_route->get_mute_config (type)) { check->set_active (true); } } @@ -539,28 +539,28 @@ RouteUI::init_mute_menu(mute_type type, CheckMenuItem* check) void RouteUI::toggle_mute_menu(mute_type type, Gtk::CheckMenuItem* check) { - _route.set_mute_config(type, check->get_active(), this); + _route->set_mute_config(type, check->get_active(), this); } void RouteUI::toggle_solo_safe (Gtk::CheckMenuItem* check) { - _route.set_solo_safe (check->get_active(), this); + _route->set_solo_safe (check->get_active(), this); } void -RouteUI::set_mix_group_solo(Route& route, bool yn) +RouteUI::set_mix_group_solo(boost::shared_ptr<Route> route, bool yn) { RouteGroup* mix_group; - if((mix_group = route.mix_group()) != 0){ + if((mix_group = route->mix_group()) != 0){ _session.begin_reversible_command (_("mix group solo change")); _session.add_undo (_session.global_solo_memento (this)); mix_group->apply(&Route::set_solo, yn, this); _session.add_redo_no_execute (_session.global_solo_memento(this)); _session.commit_reversible_command (); } else { - reversibly_apply_route_boolean ("solo change", &Route::set_solo, !route.soloed(), this); + reversibly_apply_route_boolean ("solo change", &Route::set_solo, !route->soloed(), this); } } @@ -568,8 +568,8 @@ void RouteUI::reversibly_apply_route_boolean (string name, void (Route::*func)(bool, void *), bool yn, void *arg) { _session.begin_reversible_command (name); - _session.add_undo (bind (mem_fun (_route, func), !yn, (void *) arg)); - _session.add_redo (bind (mem_fun (_route, func), yn, (void *) arg)); + _session.add_undo (bind (mem_fun (*_route, func), !yn, (void *) arg)); + _session.add_redo (bind (mem_fun (*_route, func), yn, (void *) arg)); _session.commit_reversible_command (); } @@ -583,34 +583,34 @@ RouteUI::reversibly_apply_audio_track_boolean (string name, void (AudioTrack::*f } void -RouteUI::set_mix_group_mute(Route& route, bool yn) +RouteUI::set_mix_group_mute(boost::shared_ptr<Route> route, bool yn) { RouteGroup* mix_group; - if((mix_group = route.mix_group()) != 0){ + if((mix_group = route->mix_group()) != 0){ _session.begin_reversible_command (_("mix group mute change")); _session.add_undo (_session.global_mute_memento (this)); mix_group->apply(&Route::set_mute, yn, this); _session.add_redo_no_execute (_session.global_mute_memento(this)); _session.commit_reversible_command (); } else { - reversibly_apply_route_boolean ("mute change", &Route::set_mute, !route.muted(), this); + reversibly_apply_route_boolean ("mute change", &Route::set_mute, !route->muted(), this); } } void -RouteUI::set_mix_group_rec_enable(Route& route, bool yn) +RouteUI::set_mix_group_rec_enable(boost::shared_ptr<Route> route, bool yn) { RouteGroup* mix_group; - if((mix_group = route.mix_group()) != 0){ + if((mix_group = route->mix_group()) != 0){ _session.begin_reversible_command (_("mix group rec-enable change")); _session.add_undo (_session.global_record_enable_memento (this)); mix_group->apply (&Route::set_record_enable, yn, this); _session.add_redo_no_execute (_session.global_record_enable_memento(this)); _session.commit_reversible_command (); } else { - reversibly_apply_route_boolean ("rec-enable change", &Route::set_record_enable, !_route.record_enabled(), this); + reversibly_apply_route_boolean ("rec-enable change", &Route::set_record_enable, !_route->record_enabled(), this); } } @@ -641,7 +641,7 @@ RouteUI::set_color (const Gdk::Color & c) snprintf (buf, sizeof (buf), "%d:%d:%d", c.get_red(), c.get_green(), c.get_blue()); xml_node->add_property ("color", buf); - _route.gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */ + _route->gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */ } @@ -649,9 +649,9 @@ void RouteUI::ensure_xml_node () { if (xml_node == 0) { - if ((xml_node = _route.extra_xml ("GUI")) == 0) { + if ((xml_node = _route->extra_xml ("GUI")) == 0) { xml_node = new XMLNode ("GUI"); - _route.add_extra_xml (*xml_node); + _route->add_extra_xml (*xml_node); } } } @@ -697,9 +697,9 @@ RouteUI::remove_this_route () string prompt; if (is_track()) { - prompt = string_compose (_("Do you really want to remove track \"%1\" ?\n\nYou may also lose the playlist used by this track.\n(cannot be undone)"), _route.name()); + prompt = string_compose (_("Do you really want to remove track \"%1\" ?\n\nYou may also lose the playlist used by this track.\n(cannot be undone)"), _route->name()); } else { - prompt = string_compose (_("Do you really want to remove bus \"%1\" ?\n(cannot be undone)"), _route.name()); + prompt = string_compose (_("Do you really want to remove bus \"%1\" ?\n(cannot be undone)"), _route->name()); } choices.push_back (_("No, do nothing.")); @@ -733,7 +733,7 @@ RouteUI::route_rename () ArdourPrompter name_prompter (true); string result; name_prompter.set_prompt (_("New Name: ")); - name_prompter.set_initial_text (_route.name()); + name_prompter.set_initial_text (_route->name()); name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT); name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); name_prompter.show_all (); @@ -743,7 +743,7 @@ RouteUI::route_rename () case Gtk::RESPONSE_ACCEPT: name_prompter.get_result (result); if (result.length()) { - _route.set_name (result, this); + _route->set_name (result, this); } break; } @@ -757,7 +757,7 @@ RouteUI::name_changed (void *src) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::name_changed), src)); - name_label.set_text (_route.name()); + name_label.set_text (_route->name()); } void @@ -766,8 +766,8 @@ RouteUI::toggle_route_active () bool yn; if (route_active_menu_item) { - if (route_active_menu_item->get_active() != (yn = _route.active())) { - _route.set_active (!yn); + if (route_active_menu_item->get_active() != (yn = _route->active())) { + _route->set_active (!yn); } } } @@ -776,7 +776,7 @@ void RouteUI::route_active_changed () { if (route_active_menu_item) { - Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun (*route_active_menu_item, &CheckMenuItem::set_active), _route.active())); + Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun (*route_active_menu_item, &CheckMenuItem::set_active), _route->active())); } } @@ -789,12 +789,12 @@ RouteUI::toggle_polarity () ENSURE_GUI_THREAD(mem_fun (*this, &RouteUI::toggle_polarity)); - if ((x = polarity_menu_item->get_active()) != _route.phase_invert()) { - _route.set_phase_invert (x, this); + if ((x = polarity_menu_item->get_active()) != _route->phase_invert()) { + _route->set_phase_invert (x, this); if (x) { name_label.set_text (X_("Ø ") + name_label.get_text()); } else { - name_label.set_text (_route.name()); + name_label.set_text (_route->name()); } } } @@ -809,7 +809,7 @@ RouteUI::polarity_changed () void RouteUI::solo_safe_toggle(void* src, Gtk::CheckMenuItem* check) { - bool yn = _route.solo_safe (); + bool yn = _route->solo_safe (); if (check->get_active() != yn) { check->set_active (yn); @@ -820,7 +820,7 @@ RouteUI::pre_fader_toggle(void* src, Gtk::CheckMenuItem* check) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::pre_fader_toggle), src, check)); - bool yn = _route.get_mute_config(PRE_FADER); + bool yn = _route->get_mute_config(PRE_FADER); if (check->get_active() != yn) { check->set_active (yn); } @@ -831,7 +831,7 @@ RouteUI::post_fader_toggle(void* src, Gtk::CheckMenuItem* check) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::post_fader_toggle), src, check)); - bool yn = _route.get_mute_config(POST_FADER); + bool yn = _route->get_mute_config(POST_FADER); if (check->get_active() != yn) { check->set_active (yn); } @@ -842,7 +842,7 @@ RouteUI::control_outs_toggle(void* src, Gtk::CheckMenuItem* check) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::control_outs_toggle), src, check)); - bool yn = _route.get_mute_config(CONTROL_OUTS); + bool yn = _route->get_mute_config(CONTROL_OUTS); if (check->get_active() != yn) { check->set_active (yn); } @@ -853,7 +853,7 @@ RouteUI::main_outs_toggle(void* src, Gtk::CheckMenuItem* check) { ENSURE_GUI_THREAD(bind (mem_fun (*this, &RouteUI::main_outs_toggle), src, check)); - bool yn = _route.get_mute_config(MAIN_OUTS); + bool yn = _route->get_mute_config(MAIN_OUTS); if (check->get_active() != yn) { check->set_active (yn); } @@ -862,68 +862,67 @@ RouteUI::main_outs_toggle(void* src, Gtk::CheckMenuItem* check) void RouteUI::disconnect_input () { - _route.disconnect_inputs (this); + _route->disconnect_inputs (this); } void RouteUI::disconnect_output () { - _route.disconnect_outputs (this); + _route->disconnect_outputs (this); } bool RouteUI::is_track () const { - return dynamic_cast<Track*>(&_route) != 0; + return dynamic_cast<Track*>(_route.get()) != 0; } -bool -RouteUI::is_audio_track () const +Track* +RouteUI::track() const { - return dynamic_cast<AudioTrack*>(&_route) != 0; + return dynamic_cast<Track*>(_route.get()); } bool -RouteUI::is_midi_track () const +RouteUI::is_audio_track () const { - return dynamic_cast<MidiTrack*>(&_route) != 0; + return dynamic_cast<AudioTrack*>(_route.get()) != 0; } -Track* -RouteUI::track() const +AudioTrack* +RouteUI::audio_track() const { - return dynamic_cast<Track*>(&_route); + return dynamic_cast<AudioTrack*>(_route.get()); } -AudioTrack* -RouteUI::audio_track() const +bool +RouteUI::is_midi_track () const { - return dynamic_cast<AudioTrack*>(&_route); + return dynamic_cast<MidiTrack*>(_route.get()) != 0; } MidiTrack* RouteUI::midi_track() const { - return dynamic_cast<MidiTrack*>(&_route); + return dynamic_cast<MidiTrack*>(_route.get()); } Diskstream* RouteUI::get_diskstream () const { - Track *t; + boost::shared_ptr<Track> t; - if ((t = dynamic_cast<Track*>(&_route)) != 0) { + if ((t = boost::dynamic_pointer_cast<Track>(_route)) != 0) { return &t->diskstream(); } else { return 0; } } - string RouteUI::name() const { - return _route.name(); + return _route->name(); } void @@ -931,7 +930,7 @@ RouteUI::map_frozen () { ENSURE_GUI_THREAD (mem_fun (*this, &RouteUI::map_frozen)); - AudioTrack* at = dynamic_cast<AudioTrack*>(&_route); + AudioTrack* at = dynamic_cast<AudioTrack*>(_route.get()); if (at) { switch (at->freeze_state()) { @@ -944,3 +943,4 @@ RouteUI::map_frozen () } } } + diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 5236e204f8..2cb46eb16d 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -46,15 +46,16 @@ class BindableToggleButton; class RouteUI : public virtual AxisView { public: - RouteUI(ARDOUR::Route&, ARDOUR::Session&, const char*, const char*, const char*); + RouteUI(boost::shared_ptr<ARDOUR::Route>, ARDOUR::Session&, const char*, const char*, const char*); virtual ~RouteUI(); - ARDOUR::Route& route() const { return _route; } - bool is_track() const; bool is_audio_track() const; bool is_midi_track() const; + boost::shared_ptr<ARDOUR::Route> route() const { return _route; } + + // FIXME: make these return shared_ptr ARDOUR::Track* track() const; ARDOUR::AudioTrack* audio_track() const; ARDOUR::MidiTrack* midi_track() const; @@ -62,8 +63,10 @@ class RouteUI : public virtual AxisView ARDOUR::Diskstream* get_diskstream() const; string name() const; - - ARDOUR::Route& _route; + + // protected: XXX sigh this should be here + + boost::shared_ptr<ARDOUR::Route> _route; void set_color (const Gdk::Color & c); bool choose_color (); @@ -95,6 +98,7 @@ class RouteUI : public virtual AxisView void solo_changed(void*); void mute_changed(void*); + virtual void redirects_changed (void *) {} void route_rec_enable_changed(void*); void session_rec_enable_changed(); @@ -114,9 +118,9 @@ class RouteUI : public virtual AxisView void build_mute_menu(void); void init_mute_menu(ARDOUR::mute_type, Gtk::CheckMenuItem*); - void set_mix_group_solo(ARDOUR::Route&, bool); - void set_mix_group_mute(ARDOUR::Route&, bool); - void set_mix_group_rec_enable(ARDOUR::Route&, bool); + void set_mix_group_solo(boost::shared_ptr<ARDOUR::Route>, bool); + void set_mix_group_mute(boost::shared_ptr<ARDOUR::Route>, bool); + void set_mix_group_rec_enable(boost::shared_ptr<ARDOUR::Route>, bool); int set_color_from_route (); diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index fe7d754d13..dce8d9e1c6 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -151,7 +151,7 @@ Selection::clear_lines () } void -Selection::toggle (Redirect* r) +Selection::toggle (boost::shared_ptr<Redirect> r) { RedirectSelection::iterator i; @@ -243,7 +243,7 @@ Selection::toggle (jack_nframes_t start, jack_nframes_t end) void -Selection::add (Redirect* r) +Selection::add (boost::shared_ptr<Redirect> r) { if (find (redirects.begin(), redirects.end(), r) == redirects.end()) { redirects.push_back (r); @@ -381,9 +381,9 @@ Selection::add (AutomationList* ac) } void -Selection::remove (Redirect* r) +Selection::remove (boost::shared_ptr<Redirect> r) { - list<Redirect*>::iterator i; + RedirectSelection::iterator i; if ((i = find (redirects.begin(), redirects.end(), r)) != redirects.end()) { redirects.erase (i); RedirectsChanged (); @@ -491,7 +491,7 @@ Selection::remove (AutomationList *ac) } void -Selection::set (Redirect *r) +Selection::set (boost::shared_ptr<Redirect> r) { clear_redirects (); add (r); diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h index 1aab414453..7b503a5e63 100644 --- a/gtk2_ardour/selection.h +++ b/gtk2_ardour/selection.h @@ -22,6 +22,7 @@ #define __ardour_gtk_selection_h__ #include <vector> +#include <boost/shared_ptr.hpp> #include <sigc++/signal.h> @@ -101,7 +102,7 @@ class Selection : public sigc::trackable void set (ARDOUR::AutomationList*); void set (ARDOUR::Playlist*); void set (const list<ARDOUR::Playlist*>&); - void set (ARDOUR::Redirect*); + void set (boost::shared_ptr<ARDOUR::Redirect>); void set (AutomationSelectable*); void toggle (TimeAxisView*); @@ -112,7 +113,7 @@ class Selection : public sigc::trackable void toggle (ARDOUR::AutomationList*); void toggle (ARDOUR::Playlist*); void toggle (const list<ARDOUR::Playlist*>&); - void toggle (ARDOUR::Redirect*); + void toggle (boost::shared_ptr<ARDOUR::Redirect>); void add (TimeAxisView*); void add (const list<TimeAxisView*>&); @@ -122,7 +123,7 @@ class Selection : public sigc::trackable void add (ARDOUR::AutomationList*); void add (ARDOUR::Playlist*); void add (const list<ARDOUR::Playlist*>&); - void add (ARDOUR::Redirect*); + void add (boost::shared_ptr<ARDOUR::Redirect>); void remove (TimeAxisView*); void remove (const list<TimeAxisView*>&); @@ -132,7 +133,7 @@ class Selection : public sigc::trackable void remove (ARDOUR::AutomationList*); void remove (ARDOUR::Playlist*); void remove (const list<ARDOUR::Playlist*>&); - void remove (ARDOUR::Redirect*); + void remove (boost::shared_ptr<ARDOUR::Redirect>); void replace (uint32_t time_index, jack_nframes_t start, jack_nframes_t end); diff --git a/gtk2_ardour/send_ui.cc b/gtk2_ardour/send_ui.cc index be95f753e7..9925ff51d4 100644 --- a/gtk2_ardour/send_ui.cc +++ b/gtk2_ardour/send_ui.cc @@ -30,7 +30,7 @@ using namespace ARDOUR; using namespace PBD; -SendUI::SendUI (Send& s, Session& se) +SendUI::SendUI (boost::shared_ptr<Send> s, Session& se) : _send (s), _session (se), gpm (s, se), @@ -53,10 +53,10 @@ SendUI::SendUI (Send& s, Session& se) show_all (); - _send.set_metering (true); + _send->set_metering (true); - _send.output_changed.connect (mem_fun (*this, &SendUI::ins_changed)); - _send.output_changed.connect (mem_fun (*this, &SendUI::outs_changed)); + _send->output_changed.connect (mem_fun (*this, &SendUI::ins_changed)); + _send->output_changed.connect (mem_fun (*this, &SendUI::outs_changed)); panners.set_width (Wide); panners.setup_pan (); @@ -70,7 +70,7 @@ SendUI::SendUI (Send& s, Session& se) SendUI::~SendUI () { - _send.set_metering (false); + _send->set_metering (false); /* XXX not clear that we need to do this */ @@ -118,7 +118,7 @@ SendUI::fast_update () } } -SendUIWindow::SendUIWindow (Send& s, Session& ss) +SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss) { ui = new SendUI (s, ss); @@ -131,7 +131,7 @@ SendUIWindow::SendUIWindow (Send& s, Session& ss) add (vpacker); set_name ("SendUIWindow"); - s.GoingAway.connect (mem_fun (*this, &SendUIWindow::send_going_away)); + s->GoingAway.connect (mem_fun (*this, &SendUIWindow::send_going_away)); signal_delete_event().connect (bind (ptr_fun (just_hide_it), reinterpret_cast<Window *> (this))); diff --git a/gtk2_ardour/send_ui.h b/gtk2_ardour/send_ui.h index d1a49930ea..1d5a74e102 100644 --- a/gtk2_ardour/send_ui.h +++ b/gtk2_ardour/send_ui.h @@ -35,7 +35,7 @@ class IOSelector; class SendUI : public Gtk::HBox { public: - SendUI (ARDOUR::Send&, ARDOUR::Session&); + SendUI (boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session&); ~SendUI(); void update (); @@ -44,7 +44,7 @@ class SendUI : public Gtk::HBox IOSelector* io; private: - ARDOUR::Send& _send; + boost::shared_ptr<ARDOUR::Send> _send; ARDOUR::Session& _session; GainMeter gpm; PannerUI panners; @@ -62,7 +62,7 @@ class SendUI : public Gtk::HBox class SendUIWindow : public Gtk::Window { public: - SendUIWindow(ARDOUR::Send&, ARDOUR::Session&); + SendUIWindow(boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session&); ~SendUIWindow(); SendUI* ui; diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 79546880de..4948525b15 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -97,6 +97,9 @@ SoundFileBox::SoundFileBox () (mem_fun (*this, &SoundFileBox::add_field_clicked)); remove_field_btn.signal_clicked().connect (mem_fun (*this, &SoundFileBox::remove_field_clicked)); + + Gtk::CellRendererText* cell(static_cast<Gtk::CellRendererText*>(field_view.get_column_cell_renderer(1))); + cell->signal_edited().connect (mem_fun (*this, &SoundFileBox::field_edited)); field_view.get_selection()->signal_changed().connect (mem_fun (*this, &SoundFileBox::field_selected)); Library->fields_changed.connect (mem_fun (*this, &SoundFileBox::setup_fields)); @@ -260,6 +263,13 @@ SoundFileBox::remove_field_clicked () } void +SoundFileBox::field_edited (const Glib::ustring& str1, const Glib::ustring& str2) +{ + cout << "field_edited" << endl; + Library->save_changes (); +} + +void SoundFileBox::delete_row (const Gtk::TreeModel::iterator& iter) { Gtk::TreeModel::Row row = *iter; @@ -394,6 +404,9 @@ SoundFileOmega::set_mode (Editing::ImportMode mode) case Editing::ImportToTrack: split_check.set_sensitive (false); break; + case Editing::ImportAsTapeTrack: + split_check.set_sensitive (true); + break; } } @@ -433,5 +446,8 @@ SoundFileOmega::mode_changed () case Editing::ImportToTrack: split_check.set_sensitive (false); break; + case Editing::ImportAsTapeTrack: + split_check.set_sensitive (true); + break; } } diff --git a/gtk2_ardour/sfdb_ui.h b/gtk2_ardour/sfdb_ui.h index 79c73b97ac..8ef57d7b9f 100644 --- a/gtk2_ardour/sfdb_ui.h +++ b/gtk2_ardour/sfdb_ui.h @@ -100,6 +100,7 @@ class SoundFileBox : public Gtk::VBox void stop_btn_clicked (); void add_field_clicked (); void remove_field_clicked (); + void field_edited (const Glib::ustring&, const Glib::ustring&); void delete_row (const Gtk::TreeModel::iterator& iter); void field_selected (); diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index dba588702f..ba92416339 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -74,7 +74,7 @@ namespace ARDOUR { const char* old; }; -}; +} /* how do we make these be within the Ardour namespace? */ diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 247939b378..c4a942a5d7 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -305,6 +305,6 @@ class AudioDiskstream : public Diskstream void disengage_record_enable (void* src); }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_audio_diskstream_h__ */ diff --git a/libs/ardour/ardour/audio_library.h b/libs/ardour/ardour/audio_library.h index 3d4585fbd8..f5ac6da654 100644 --- a/libs/ardour/ardour/audio_library.h +++ b/libs/ardour/ardour/audio_library.h @@ -42,6 +42,8 @@ class AudioLibrary : public Stateful AudioLibrary (); ~AudioLibrary (); + static string state_node_name; + XMLNode& get_state (void); int set_state (const XMLNode&); diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index b03205dfaf..2616705918 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -81,13 +81,12 @@ class AudioTrack : public Track uint32_t n_process_buffers (); private: - int set_diskstream (AudioDiskstream&, void *); - + int set_diskstream (AudioDiskstream&, void *); int deprecated_use_diskstream_connections (); void set_state_part_two (); void set_state_part_three (); }; -} /* namespace ARDOUR*/ +} // namespace ARDOUR #endif /* __ardour_audio_track_h__ */ diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 6f3de18473..bac1e3720a 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -244,6 +244,6 @@ class AudioEngine : public sigc::trackable mutable gint m_meter_exit; }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_audioengine_h__ */ diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index b793ed14f0..3e0d4c45ae 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -42,7 +42,8 @@ class AudioFileSource : public AudioSource { Removable = 0x8, RemovableIfEmpty = 0x10, RemoveAtDestroy = 0x20, - NoPeakFile = 0x40 + NoPeakFile = 0x40, + Destructive = 0x80 }; virtual ~AudioFileSource (); @@ -150,7 +151,7 @@ class AudioFileSource : public AudioSource { bool writable() const { return _flags & Writable; } }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_audiofilesource_h__ */ diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index f3d34eb262..54e2d73af0 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -123,8 +123,7 @@ class AudioRegion : public Region Fast, Slow, LogA, - LogB, - + LogB }; void set_fade_in_active (bool yn); diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index cc4376f781..dd689e9a2d 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -99,6 +99,6 @@ class Configuration : public Stateful extern Configuration *Config; extern gain_t speed_quietning; /* see comment in configuration.cc */ -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_configuration_h__ */ diff --git a/libs/ardour/ardour/curve.h b/libs/ardour/ardour/curve.h index ede060e1cb..7f8a43cfe1 100644 --- a/libs/ardour/ardour/curve.h +++ b/libs/ardour/ardour/curve.h @@ -76,7 +76,7 @@ class Curve : public AutomationList }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR extern "C" { void curve_get_vector_from_c (void *arg, double, double, float*, int32_t); diff --git a/libs/ardour/ardour/destructive_filesource.h b/libs/ardour/ardour/destructive_filesource.h index 947367f754..5b773898c3 100644 --- a/libs/ardour/ardour/destructive_filesource.h +++ b/libs/ardour/ardour/destructive_filesource.h @@ -34,6 +34,8 @@ class DestructiveFileSource : public SndFileSource { DestructiveFileSource (std::string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, Flag flags = AudioFileSource::Flag (AudioFileSource::Writable)); + DestructiveFileSource (std::string path, Flag flags); + DestructiveFileSource (const XMLNode&); ~DestructiveFileSource (); @@ -62,6 +64,7 @@ class DestructiveFileSource : public SndFileSource { jack_nframes_t file_pos; // unit is frames Sample* xfade_buf; + void init (); jack_nframes_t crossfade (Sample* data, jack_nframes_t cnt, int dir, char * workbuf); void set_timeline_position (jack_nframes_t); }; diff --git a/libs/ardour/ardour/export.h b/libs/ardour/ardour/export.h index 9a6da1592b..075464767e 100644 --- a/libs/ardour/ardour/export.h +++ b/libs/ardour/ardour/export.h @@ -83,6 +83,6 @@ namespace ARDOUR int status; }; -}; +} // namespace ARDOUR #endif /* __ardour_export_h__ */ diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h index 2d6b672064..a4c4439942 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/insert.h @@ -98,7 +98,7 @@ struct PluginInsertState : public RedirectState class PluginInsert : public Insert { public: - PluginInsert (Session&, Plugin&, Placement); + PluginInsert (Session&, boost::shared_ptr<Plugin>, Placement); PluginInsert (Session&, const XMLNode&); PluginInsert (const PluginInsert&); ~PluginInsert (); @@ -141,11 +141,11 @@ class PluginInsert : public Insert float default_parameter_value (uint32_t which); - Plugin& plugin(uint32_t num=0) const { + boost::shared_ptr<Plugin> plugin(uint32_t num=0) const { if (num < _plugins.size()) { - return *_plugins[num]; + return _plugins[num]; } else { - return *_plugins[0]; // we always have one + return _plugins[0]; // we always have one } } @@ -163,7 +163,7 @@ class PluginInsert : public Insert void parameter_changed (uint32_t, float); - vector<Plugin*> _plugins; + vector<boost::shared_ptr<Plugin> > _plugins; void automation_run (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset); void connect_and_run (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset, bool with_auto, jack_nframes_t now = 0); @@ -172,9 +172,9 @@ class PluginInsert : public Insert void auto_state_changed (uint32_t which); void automation_list_creation_callback (uint32_t, AutomationList&); - Plugin* plugin_factory (Plugin&); + boost::shared_ptr<Plugin> plugin_factory (boost::shared_ptr<Plugin>); }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_insert_h__ */ diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 6cff58eef8..94e1483ad6 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -393,6 +393,6 @@ public: int32_t find_output_port_hole (); }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /*__ardour_io_h__ */ diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 2c9f947541..30c02a80a1 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -199,6 +199,6 @@ class Locations : public Stateful, public StateManager StateManager::State* state_factory (std::string why) const; }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_location_h__ */ diff --git a/libs/ardour/ardour/logcurve.h b/libs/ardour/ardour/logcurve.h index e65be55772..ac60a10fd7 100644 --- a/libs/ardour/ardour/logcurve.h +++ b/libs/ardour/ardour/logcurve.h @@ -126,7 +126,7 @@ class LogCurveOut : public LogCurve }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_logcurve_h__ */ diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 37c985a2ef..75c59eb924 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -312,6 +312,6 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: static float current_automation_version_number; }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /*__ardour_panner_h__ */ diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index e7d05aa352..97708065e4 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -21,6 +21,7 @@ #ifndef __ardour_ladspa_h__ #define __ardour_ladspa_h__ +#include <boost/shared_ptr.hpp> #include <sigc++/signal.h> #include <pbd/stateful.h> @@ -179,7 +180,7 @@ class Plugin : public Stateful, public sigc::trackable /* this is actually defined in plugin_manager.cc */ -Plugin * find_plugin(ARDOUR::Session&, string name, long unique_id, PluginInfo::Type); +boost::shared_ptr<Plugin> find_plugin(ARDOUR::Session&, string name, long unique_id, PluginInfo::Type); } // namespace ARDOUR diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 1a07c67c8d..cc9a04738e 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -5,6 +5,8 @@ #include <map> #include <string> +#include <boost/shared_ptr.hpp> + #include <ardour/types.h> namespace ARDOUR { @@ -26,7 +28,7 @@ class PluginManager { int add_ladspa_directory (std::string dirpath); int add_vst_directory (std::string dirpath); - Plugin *load (ARDOUR::Session& s, PluginInfo* info); + boost::shared_ptr<Plugin> load (ARDOUR::Session& s, PluginInfo* info); static PluginManager* the_manager() { return _manager; } diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 0b7d79cbd6..86c99cb7e3 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -207,6 +207,6 @@ class Port : public sigc::trackable { static jack_nframes_t _short_over_length; }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_port_h__ */ diff --git a/libs/ardour/ardour/redirect.h b/libs/ardour/ardour/redirect.h index ede55a1d80..658cab5d3b 100644 --- a/libs/ardour/ardour/redirect.h +++ b/libs/ardour/ardour/redirect.h @@ -25,6 +25,7 @@ #include <vector> #include <set> #include <map> +#include <boost/shared_ptr.hpp> #include <sigc++/signal.h> #include <glibmm/thread.h> @@ -64,7 +65,7 @@ class Redirect : public IO Redirect (const Redirect&); virtual ~Redirect (); - static Redirect *clone (const Redirect&); + static boost::shared_ptr<Redirect> clone (boost::shared_ptr<const Redirect>); bool active () const { return _active; } void set_active (bool yn, void *src); @@ -148,6 +149,6 @@ class Redirect : public IO void* _gui; /* generic, we don't know or care what this is */ }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_redirect_h__ */ diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index d30138640a..c85f34f1fa 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -27,6 +27,8 @@ #include <map> #include <string> +#include <boost/shared_ptr.hpp> + #include <pbd/fastlog.h> #include <glibmm/thread.h> #include <pbd/xml++.h> @@ -57,13 +59,13 @@ class Route : public IO { protected: - typedef list<Redirect *> RedirectList; + typedef list<boost::shared_ptr<Redirect> > RedirectList; public: enum Flag { Hidden = 0x1, MasterOut = 0x2, - ControlOut = 0x4, + ControlOut = 0x4 }; @@ -141,19 +143,19 @@ class Route : public IO void flush_redirects (); - template<class T> void foreach_redirect (T *obj, void (T::*func)(Redirect *)) { + template<class T> void foreach_redirect (T *obj, void (T::*func)(boost::shared_ptr<Redirect>)) { Glib::RWLock::ReaderLock lm (redirect_lock); for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { (obj->*func) (*i); } } - Redirect *nth_redirect (uint32_t n) { + boost::shared_ptr<Redirect> nth_redirect (uint32_t n) { Glib::RWLock::ReaderLock lm (redirect_lock); RedirectList::iterator i; for (i = _redirects.begin(); i != _redirects.end() && n; ++i, --n); if (i == _redirects.end()) { - return 0; + return boost::shared_ptr<Redirect> (); } else { return *i; } @@ -161,9 +163,9 @@ class Route : public IO uint32_t max_redirect_outs () const { return redirect_max_outs; } - int add_redirect (Redirect *, void *src, uint32_t* err_streams = 0); + int add_redirect (boost::shared_ptr<Redirect>, void *src, uint32_t* err_streams = 0); int add_redirects (const RedirectList&, void *src, uint32_t* err_streams = 0); - int remove_redirect (Redirect *, void *src, uint32_t* err_streams = 0); + int remove_redirect (boost::shared_ptr<Redirect>, void *src, uint32_t* err_streams = 0); int copy_redirects (const Route&, Placement, uint32_t* err_streams = 0); int sort_redirects (uint32_t* err_streams = 0); @@ -212,8 +214,8 @@ class Route : public IO int set_control_outs (const vector<std::string>& ports); IO* control_outs() { return _control_outs; } - bool feeds (Route *); - set<Route *> fed_by; + bool feeds (boost::shared_ptr<Route>); + set<boost::shared_ptr<Route> > fed_by; struct ToggleControllable : public PBD::Controllable { enum ToggleType { @@ -339,12 +341,12 @@ class Route : public IO /* plugin count handling */ struct InsertCount { - ARDOUR::Insert& insert; + boost::shared_ptr<ARDOUR::Insert> insert; int32_t cnt; int32_t in; int32_t out; - InsertCount (ARDOUR::Insert& ins) : insert (ins), cnt (-1) {} + InsertCount (boost::shared_ptr<ARDOUR::Insert> ins) : insert (ins), cnt (-1) {} }; int32_t apply_some_plugin_counts (std::list<InsertCount>& iclist); @@ -355,6 +357,6 @@ class Route : public IO void redirect_active_proxy (Redirect*, void*); }; -}; /* namespace ARDOUR*/ +} // namespace ARDOUR #endif /* __ardour_route_h__ */ diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index 19374b4f65..11253eda5b 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -43,7 +43,7 @@ class RouteGroup : public Stateful, public sigc::trackable { enum Flag { Relative = 0x1, Active = 0x2, - Hidden = 0x4, + Hidden = 0x4 }; RouteGroup (Session& s, const string &n, Flag f = Flag(0)); diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 54d4cbd7a9..0a068e8af0 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -58,6 +58,6 @@ class Send : public Redirect { uint32_t expected_inputs; }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_send_h__ */ diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 10cb554842..7bd24b96cc 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -36,6 +36,7 @@ #include <pbd/error.h> #include <pbd/undo.h> #include <pbd/pool.h> +#include <pbd/rcu.h> #include <midi++/types.h> #include <midi++/mmc.h> @@ -112,9 +113,9 @@ class Session : public sigc::trackable, public Stateful { private: - typedef std::pair<Route*,bool> RouteBooleanState; + typedef std::pair<boost::shared_ptr<Route>,bool> RouteBooleanState; typedef vector<RouteBooleanState> GlobalRouteBooleanState; - typedef std::pair<Route*,MeterPoint> RouteMeterState; + typedef std::pair<boost::shared_ptr<Route>,MeterPoint> RouteMeterState; typedef vector<RouteMeterState> GlobalRouteMeterState; public: @@ -127,7 +128,7 @@ class Session : public sigc::trackable, public Stateful enum SlaveSource { None = 0, MTC, - JACK, + JACK }; enum AutoConnectOption { @@ -158,7 +159,7 @@ class Session : public sigc::trackable, public Stateful */ StopOnce, - AutoLoop, + AutoLoop }; enum Action { @@ -178,6 +179,7 @@ class Session : public sigc::trackable, public Stateful void* ptr; bool yes_or_no; Session::SlaveSource slave; + Route* route; }; list<AudioRange> audio_range; @@ -292,27 +294,26 @@ class Session : public sigc::trackable, public Stateful typedef list<Diskstream *> DiskstreamList; - typedef list<Route *> RouteList; + typedef std::list<boost::shared_ptr<Route> > RouteList; - RouteList get_routes() const { - Glib::RWLock::ReaderLock rlock (route_lock); - return routes; /* XXX yes, force a copy */ + boost::shared_ptr<RouteList> get_routes() const { + return routes.reader (); } - uint32_t nroutes() const { return routes.size(); } + uint32_t nroutes() const { return routes.reader()->size(); } uint32_t ntracks () const; uint32_t nbusses () const; struct RoutePublicOrderSorter { - bool operator() (Route *, Route *b); + bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b); }; template<class T> void foreach_route (T *obj, void (T::*func)(Route&)); - template<class T> void foreach_route (T *obj, void (T::*func)(Route*)); + template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>)); template<class T, class A> void foreach_route (T *obj, void (T::*func)(Route&, A), A arg); - Route *route_by_name (string); - Route *route_by_remote_id (uint32_t id); + boost::shared_ptr<Route> route_by_name (string); + boost::shared_ptr<Route> route_by_remote_id (uint32_t id); bool route_name_unique (string) const; @@ -354,7 +355,7 @@ class Session : public sigc::trackable, public Stateful sigc::signal<void> DurationChanged; sigc::signal<void> HaltOnXrun; - sigc::signal<void,Route*> RouteAdded; + sigc::signal<void,boost::shared_ptr<Route> > RouteAdded; sigc::signal<void,Diskstream*> DiskstreamAdded; void request_roll (); @@ -505,9 +506,6 @@ class Session : public sigc::trackable, public Stateful void add_instant_xml (XMLNode&, const std::string& dir); - void swap_configuration(Configuration** new_config); - void copy_configuration(Configuration* new_config); - enum StateOfTheState { Clean = 0x0, Dirty = 0x1, @@ -548,15 +546,19 @@ class Session : public sigc::trackable, public Stateful /* fundamental operations. duh. */ - AudioTrack *new_audio_track (int input_channels, int output_channels, TrackMode mode = Normal); - Route *new_audio_route (int input_channels, int output_channels); + boost::shared_ptr<AudioTrack> new_audio_track (int input_channels, int output_channels, TrackMode mode = Normal); + boost::shared_ptr<Route> new_audio_route (int input_channels, int output_channels); + + boost::shared_ptr<MidiTrack> new_midi_track (TrackMode mode = Normal); + boost::shared_ptr<Route> new_midi_route (); + + void remove_route (boost::shared_ptr<Route>); + void resort_routes (); + void resort_routes_using (boost::shared_ptr<RouteList>); + void resort_routes_proxy (void* src) { + resort_routes (); + } - MidiTrack *new_midi_track (TrackMode mode = Normal); - Route *new_midi_route (); - - void remove_route (Route&); - void resort_routes (void *src); - AudioEngine &engine() { return _engine; }; /* configuration. there should really be accessors/mutators @@ -735,7 +737,7 @@ class Session : public sigc::trackable, public Stateful /* auditioning */ - Auditioner& the_auditioner() { return *auditioner; } + boost::shared_ptr<Auditioner> the_auditioner() { return auditioner; } void audition_playlist (); void audition_region (AudioRegion&); void cancel_audition (); @@ -774,8 +776,8 @@ class Session : public sigc::trackable, public Stateful /* control/master out */ - IO* control_out() const { return _control_out; } - IO* master_out() const { return _master_out; } + boost::shared_ptr<IO> control_out() const { return _control_out; } + boost::shared_ptr<IO> master_out() const { return _master_out; } /* insert/send management */ @@ -870,7 +872,7 @@ class Session : public sigc::trackable, public Stateful /* clicking */ - IO& click_io() { return *_click_io; } + boost::shared_ptr<IO> click_io() { return _click_io; } void set_clicking (bool yn); bool get_clicking() const; @@ -1040,9 +1042,9 @@ class Session : public sigc::trackable, public Stateful float _meter_falloff; bool _end_location_is_free; - void set_worst_io_latencies (bool take_lock); + void set_worst_io_latencies (); void set_worst_io_latencies_x (IOChange asifwecare, void *ignored) { - set_worst_io_latencies (true); + set_worst_io_latencies (); } void update_latency_compensation_proxy (void* ignored); @@ -1481,13 +1483,13 @@ class Session : public sigc::trackable, public Stateful /* routes stuff */ - RouteList routes; - mutable Glib::RWLock route_lock; - void add_route (Route*); + SerializedRCUManager<RouteList> routes; + + void add_route (boost::shared_ptr<Route>); uint32_t destructive_index; int load_routes (const XMLNode&); - Route* XMLRouteFactory (const XMLNode&); + boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&); /* mixer stuff */ @@ -1497,7 +1499,7 @@ class Session : public sigc::trackable, public Stateful bool currently_soloing; void route_mute_changed (void *src); - void route_solo_changed (void *src, Route *); + void route_solo_changed (void *src, boost::shared_ptr<Route>); void catch_up_on_solo (); void update_route_solo_state (); void modify_solo_mute (bool, bool); @@ -1564,7 +1566,7 @@ class Session : public sigc::trackable, public Stateful /* AUDITIONING */ - Auditioner *auditioner; + boost::shared_ptr<Auditioner> auditioner; void set_audition (AudioRegion*); void non_realtime_set_audition (); AudioRegion *pending_audition_region; @@ -1681,7 +1683,7 @@ class Session : public sigc::trackable, public Stateful Clicks clicks; bool _clicking; - IO* _click_io; + boost::shared_ptr<IO> _click_io; Sample* click_data; Sample* click_emphasis_data; jack_nframes_t click_length; @@ -1713,8 +1715,8 @@ class Session : public sigc::trackable, public Stateful /* main outs */ uint32_t main_outs; - IO* _master_out; - IO* _control_out; + boost::shared_ptr<IO> _master_out; + boost::shared_ptr<IO> _control_out; AutoConnectOption input_auto_connect; AutoConnectOption output_auto_connect; @@ -1756,6 +1758,6 @@ class Session : public sigc::trackable, public Stateful void remove_controllable (PBD::Controllable*); }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __ardour_session_h__ */ diff --git a/libs/ardour/ardour/session_route.h b/libs/ardour/ardour/session_route.h index afe78b394e..feacc14775 100644 --- a/libs/ardour/ardour/session_route.h +++ b/libs/ardour/ardour/session_route.h @@ -33,14 +33,10 @@ namespace ARDOUR { template<class T> void Session::foreach_route (T *obj, void (T::*func)(Route&)) { - RouteList public_order; - - { - Glib::RWLock::ReaderLock lm (route_lock); - public_order = routes; - } - + boost::shared_ptr<RouteList> r = routes.reader(); + RouteList public_order (*r); RoutePublicOrderSorter cmp; + public_order.sort (cmp); for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) { @@ -49,16 +45,12 @@ Session::foreach_route (T *obj, void (T::*func)(Route&)) } template<class T> void -Session::foreach_route (T *obj, void (T::*func)(Route*)) +Session::foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>)) { - RouteList public_order; - - { - Glib::RWLock::ReaderLock lm (route_lock); - public_order = routes; - } - + boost::shared_ptr<RouteList> r = routes.reader(); + RouteList public_order (*r); RoutePublicOrderSorter cmp; + public_order.sort (cmp); for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) { @@ -66,18 +58,13 @@ Session::foreach_route (T *obj, void (T::*func)(Route*)) } } - template<class T, class A> void Session::foreach_route (T *obj, void (T::*func)(Route&, A), A arg1) { - RouteList public_order; - - { - Glib::RWLock::ReaderLock lm (route_lock); - public_order = routes; - } - + boost::shared_ptr<RouteList> r = routes.reader(); + RouteList public_order (*r); RoutePublicOrderSorter cmp; + public_order.sort (cmp); for (RouteList::iterator i = public_order.begin(); i != public_order.end(); i++) { diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 55a0e990a0..4764339451 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -75,7 +75,7 @@ class SndFileSource : public AudioFileSource { int setup_broadcast_info (jack_nframes_t when, struct tm&, time_t); }; -}; /* namespace ARDOUR */ +} // namespace ARDOUR #endif /* __sndfile_source_h__ */ diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 7389e174b0..86bfeb0c9b 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -103,15 +103,15 @@ class Track : public Route MeterPoint _saved_meter_point; TrackMode _mode; - //private: + //private: (FIXME) struct FreezeRecordInsertInfo { - FreezeRecordInsertInfo(XMLNode& st) - : state (st), insert (0) {} + FreezeRecordInsertInfo(XMLNode& st, boost::shared_ptr<Insert> ins) + : state (st), insert (ins) {} - XMLNode state; - Insert* insert; - PBD::ID id; - UndoAction memento; + XMLNode state; + boost::shared_ptr<Insert> insert; + PBD::ID id; + UndoAction memento; }; struct FreezeRecord { diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 1ae58039d9..c5b79a950c 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -73,7 +73,7 @@ namespace ARDOUR { PanAutomation = 0x2, PluginAutomation = 0x4, SoloAutomation = 0x8, - MuteAutomation = 0x10, + MuteAutomation = 0x10 }; enum AutoState { @@ -192,7 +192,7 @@ namespace ARDOUR { enum EditMode { Slide, - Splice, + Splice }; enum RegionPoint { @@ -245,7 +245,7 @@ namespace ARDOUR { PeakDatum min; PeakDatum max; }; -}; +} std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf); std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf); diff --git a/libs/ardour/audio_library.cc b/libs/ardour/audio_library.cc index 168a1dcf5d..ad008f6312 100644 --- a/libs/ardour/audio_library.cc +++ b/libs/ardour/audio_library.cc @@ -46,6 +46,8 @@ using namespace PBD; static char* SOUNDFILE = "http://ardour.org/ontology/Soundfile"; +string AudioLibrary::state_node_name = "AudioLibrary"; + AudioLibrary::AudioLibrary () { // sfdb_paths.push_back("/Users/taybin/sounds"); @@ -74,17 +76,10 @@ AudioLibrary::AudioLibrary () } lrdf_free_statements(matches); - - XMLNode* state = instant_xml(X_("AudioLibrary"), get_user_ardour_path()); - if (state) { - set_state(*state); - } - scan_paths(); } AudioLibrary::~AudioLibrary () { - add_instant_xml(get_state(), get_user_ardour_path()); } void @@ -361,6 +356,8 @@ void AudioLibrary::set_paths (vector<string> paths) { sfdb_paths = paths; + + scan_paths (); } vector<string> @@ -477,7 +474,7 @@ AudioLibrary::set_state (const XMLNode& node) } } - sfdb_paths = paths; + set_paths (paths); return 0; } diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index f2a63193b3..eae9076105 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -424,8 +424,8 @@ AudioTrack::set_state_part_two () continue; } - FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo (*((*citer)->children().front())); - frii->insert = 0; + FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo (*((*citer)->children().front()), + boost::shared_ptr<Insert>()); frii->id = prop->value (); _freeze_record.insert_info.push_back (frii); } @@ -740,9 +740,9 @@ AudioTrack::export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbu */ for (i = _redirects.begin(); i != _redirects.end(); ++i) { - Insert *insert; + boost::shared_ptr<Insert> insert; - if ((insert = dynamic_cast<Insert*>(*i)) != 0) { + if ((insert = boost::dynamic_pointer_cast<Insert>(*i)) != 0) { switch (insert->placement()) { case PreFader: insert->run (buffers, nbufs, nframes, 0); @@ -778,9 +778,9 @@ AudioTrack::export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbu if (post_fader_work) { for (i = _redirects.begin(); i != _redirects.end(); ++i) { - PluginInsert *insert; + boost::shared_ptr<PluginInsert> insert; - if ((insert = dynamic_cast<PluginInsert*>(*i)) != 0) { + if ((insert = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { switch ((*i)->placement()) { case PreFader: break; @@ -820,7 +820,6 @@ AudioTrack::bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadI void AudioTrack::freeze (InterThreadInfo& itt) { - Insert* insert; vector<AudioSource*> srcs; string new_playlist_name; Playlist* new_playlist; @@ -851,7 +850,7 @@ AudioTrack::freeze (InterThreadInfo& itt) } if (n == (UINT_MAX-1)) { - error << string_compose (X_("There Are too many frozen versions of playlist \"%1\"" + error << string_compose (X_("There are too many frozen versions of playlist \"%1\"" " to create another one"), _freeze_record.playlist->name()) << endmsg; return; @@ -869,11 +868,12 @@ AudioTrack::freeze (InterThreadInfo& itt) for (RedirectList::iterator r = _redirects.begin(); r != _redirects.end(); ++r) { - if ((insert = dynamic_cast<Insert*>(*r)) != 0) { + boost::shared_ptr<Insert> insert; + + if ((insert = boost::dynamic_pointer_cast<Insert>(*r)) != 0) { - FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo ((*r)->get_state()); + FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo ((*r)->get_state(), insert); - frii->insert = insert; frii->id = insert->id(); frii->memento = (*r)->get_memento(); diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 87700cedb3..e7264b9cf3 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -213,6 +213,10 @@ AudioFileSource::create (const string& idstr, Flag flags) { AudioFileSource* es = 0; + if (flags & Destructive) { + return new DestructiveFileSource (idstr, flags); + } + try { es = new CoreAudioSource (idstr, flags); } diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index add9364cad..bf7a32c885 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -640,7 +640,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t to_read = min (chunksize, (_length - current_frame)); - if ((frames_read = read_unlocked (raw_staging, current_frame, to_read, workbuf)) < 0) { + if ((frames_read = read_unlocked (raw_staging, current_frame, to_read, workbuf)) == 0) { error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3") , _name, to_read, current_frame) << endmsg; diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc index fc708f805d..58da77f933 100644 --- a/libs/ardour/configuration.cc +++ b/libs/ardour/configuration.cc @@ -25,6 +25,7 @@ #include <pbd/xml++.h> #include <ardour/ardour.h> +#include <ardour/audio_library.h> #include <ardour/configuration.h> #include <ardour/audio_diskstream.h> #include <ardour/destructive_filesource.h> @@ -178,6 +179,7 @@ Configuration::state (bool user_only) } root->add_child_nocopy (ControlProtocolManager::instance().get_state()); + root->add_child_nocopy (Library->get_state()); return *root; } @@ -229,6 +231,8 @@ Configuration::set_state (const XMLNode& root) } else if (node->name() == ControlProtocolManager::state_node_name) { _control_protocol_state = new XMLNode (*node); + } else if (node->name() == AudioLibrary::state_node_name) { + Library->set_state (*node); } } diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc index 68eeded9b2..43fafff30a 100644 --- a/libs/ardour/destructive_filesource.cc +++ b/libs/ardour/destructive_filesource.cc @@ -70,19 +70,25 @@ jack_nframes_t DestructiveFileSource::xfade_frames = 64; DestructiveFileSource::DestructiveFileSource (string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, Flag flags) : SndFileSource (path, samp_format, hdr_format, rate, flags) { - xfade_buf = new Sample[xfade_frames]; + init (); +} - _capture_start = false; - _capture_end = false; - file_pos = 0; - timeline_position = header_position_offset; - AudioFileSource::HeaderPositionOffsetChanged.connect (mem_fun (*this, &DestructiveFileSource::handle_header_position_change)); +DestructiveFileSource::DestructiveFileSource (string path, Flag flags) + : SndFileSource (path, flags) +{ + init (); } DestructiveFileSource::DestructiveFileSource (const XMLNode& node) : SndFileSource (node) { + init (); +} + +void +DestructiveFileSource::init () +{ xfade_buf = new Sample[xfade_frames]; _capture_start = false; diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 951d155d9e..4eafbbe9a1 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -201,6 +201,9 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization) PBD::ID::init (); + lrdf_init(); + Library = new AudioLibrary; + Config = new Configuration; if (Config->load_state ()) { @@ -299,9 +302,6 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization) info << "No H/W specific optimizations in use" << endmsg; } - lrdf_init(); - Library = new AudioLibrary; - /* singleton - first object is "it" */ new PluginManager (engine); diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index a2b03ad38d..11b1e25a74 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -62,12 +62,12 @@ Insert::Insert(Session& s, string name, Placement p) const string PluginInsert::port_automation_node_name = "PortAutomation"; -PluginInsert::PluginInsert (Session& s, Plugin& plug, Placement placement) - : Insert (s, plug.name(), placement) +PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug, Placement placement) + : Insert (s, plug->name(), placement) { /* the first is the master */ - _plugins.push_back(&plug); + _plugins.push_back (plug); _plugins[0]->ParameterChanged.connect (mem_fun (*this, &PluginInsert::parameter_changed)); @@ -103,13 +103,13 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node) } PluginInsert::PluginInsert (const PluginInsert& other) - : Insert (other._session, other.plugin().name(), other.placement()) + : Insert (other._session, other.plugin()->name(), other.placement()) { uint32_t count = other._plugins.size(); /* make as many copies as requested */ for (uint32_t n = 0; n < count; ++n) { - _plugins.push_back (plugin_factory (other.plugin())); + _plugins.push_back (plugin_factory (other.plugin (n))); } @@ -137,7 +137,7 @@ PluginInsert::set_count (uint32_t num) uint32_t diff = num - _plugins.size(); for (uint32_t n = 0; n < diff; ++n) { - _plugins.push_back (plugin_factory (*_plugins[0])); + _plugins.push_back (plugin_factory (_plugins[0])); if (require_state) { /* XXX do something */ @@ -147,9 +147,7 @@ PluginInsert::set_count (uint32_t num) } else if (num < _plugins.size()) { uint32_t diff = _plugins.size() - num; for (uint32_t n= 0; n < diff; ++n) { - Plugin * plug = _plugins.back(); _plugins.pop_back(); - delete plug; } } @@ -167,12 +165,6 @@ PluginInsert::init () PluginInsert::~PluginInsert () { GoingAway (this); /* EMIT SIGNAL */ - - while (!_plugins.empty()) { - Plugin* p = _plugins.back(); - _plugins.pop_back(); - delete p; - } } void @@ -240,7 +232,7 @@ PluginInsert::set_automatable () void PluginInsert::parameter_changed (uint32_t which, float val) { - vector<Plugin*>::iterator i = _plugins.begin(); + vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); /* don't set the first plugin, just all the slaves */ @@ -255,7 +247,7 @@ PluginInsert::parameter_changed (uint32_t which, float val) void PluginInsert::set_block_size (jack_nframes_t nframes) { - for (vector<Plugin*>::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->set_block_size (nframes); } } @@ -263,7 +255,7 @@ PluginInsert::set_block_size (jack_nframes_t nframes) void PluginInsert::activate () { - for (vector<Plugin*>::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->activate (); } } @@ -271,7 +263,7 @@ PluginInsert::activate () void PluginInsert::deactivate () { - for (vector<Plugin*>::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->deactivate (); } } @@ -309,7 +301,7 @@ PluginInsert::connect_and_run (vector<Sample*>& bufs, uint32_t nbufs, jack_nfram } } - for (vector<Plugin*>::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->connect_and_run (bufs, nbufs, in_index, out_index, nframes, offset); } @@ -357,7 +349,7 @@ PluginInsert::silence (jack_nframes_t nframes, jack_nframes_t offset) uint32_t n; if (active()) { - for (vector<Plugin*>::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { n = (*i) -> get_info().n_inputs; (*i)->connect_and_run (_session.get_silent_buffers (n), n, in_index, out_index, nframes, offset); } @@ -506,19 +498,19 @@ PluginInsert::protect_automation () } } -Plugin* -PluginInsert::plugin_factory (Plugin& other) +boost::shared_ptr<Plugin> +PluginInsert::plugin_factory (boost::shared_ptr<Plugin> other) { - LadspaPlugin* lp; + boost::shared_ptr<LadspaPlugin> lp; #ifdef VST_SUPPORT - VSTPlugin* vp; + boost::shared_ptr<VSTPlugin> vp; #endif - if ((lp = dynamic_cast<LadspaPlugin*> (&other)) != 0) { - return new LadspaPlugin (*lp); + if ((lp = boost::dynamic_pointer_cast<LadspaPlugin> (other)) != 0) { + return boost::shared_ptr<Plugin> (new LadspaPlugin (*lp)); #ifdef VST_SUPPORT - } else if ((vp = dynamic_cast<VSTPlugin*> (&other)) != 0) { - return new VSTPlugin (*vp); + } else if ((vp = boost::dynamic_pointer_cast<VSTPlugin> (other)) != 0) { + return boost::shared_ptr<Plugin> (new VSTPlugin (*vp)); #endif } @@ -526,7 +518,7 @@ PluginInsert::plugin_factory (Plugin& other) X_("unknown plugin type in PluginInsert::plugin_factory")) << endmsg; /*NOTREACHED*/ - return 0; + return boost::shared_ptr<Plugin> ((Plugin*) 0); } int32_t @@ -666,7 +658,7 @@ PluginInsert::set_state(const XMLNode& node) return -1; } - Plugin* plugin; + boost::shared_ptr<Plugin> plugin; if (unique != 0) { plugin = find_plugin (_session, "", unique, type); @@ -692,13 +684,13 @@ PluginInsert::set_state(const XMLNode& node) _plugins.push_back (plugin); for (uint32_t n=1; n < count; ++n) { - _plugins.push_back (plugin_factory (*plugin)); + _plugins.push_back (plugin_factory (plugin)); } } for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() == plugin->state_node_name()) { - for (vector<Plugin*>::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { + for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->set_state (**niter); } break; diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index d7d1dae965..1e00879d53 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -80,14 +80,6 @@ MidiTrack::~MidiTrack () } } -#if 0 -void -MidiTrack::handle_smpte_offset_change () -{ - diskstream -} -#endif - int MidiTrack::set_diskstream (MidiDiskstream& ds, void *src) @@ -372,8 +364,8 @@ MidiTrack::set_state_part_two () continue; } - FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo (*((*citer)->children().front())); - frii->insert = 0; + FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo (*((*citer)->children().front()), + boost::shared_ptr<Insert>()); frii->id = prop->value (); _freeze_record.insert_info.push_back (frii); } @@ -491,111 +483,6 @@ int MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input) { -#if 0 - int dret; - Sample* b; - Sample* tmpb; - jack_nframes_t transport_frame; - - { - Glib::RWLock::ReaderLock lm (redirect_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 - automation_snapshot (start_frame); - } - } - - if (n_outputs() == 0 && _redirects.empty()) { - return 0; - } - - if (!_active) { - silence (nframes, offset); - return 0; - } - - transport_frame = _session.transport_frame(); - - if ((nframes = check_initial_delay (nframes, offset, transport_frame)) == 0) { - /* need to do this so that the diskstream sets its - playback distance to zero, thus causing diskstream::commit - to do nothing. - */ - return diskstream->process (transport_frame, 0, 0, can_record, rec_monitors_input); - } - - _silent = false; - apply_gain_automation = false; - - if ((dret = diskstream->process (transport_frame, nframes, offset, can_record, rec_monitors_input)) != 0) { - - silence (nframes, offset); - - return dret; - } - - /* special condition applies */ - - if (_meter_point == MeterInput) { - just_meter_input (start_frame, end_frame, nframes, offset); - } - - if (diskstream->record_enabled() && !can_record && !_session.get_auto_input()) { - - /* not actually recording, but we want to hear the input material anyway, - at least potentially (depending on monitoring options) - */ - - passthru (start_frame, end_frame, nframes, offset, 0, true); - - } else if ((b = diskstream->playback_buffer(0)) != 0) { - - /* - XXX is it true that the earlier test on n_outputs() - means that we can avoid checking it again here? i think - so, because changing the i/o configuration of an IO - requires holding the AudioEngine lock, which we hold - while in the process() tree. - */ - - - /* copy the diskstream data to all output buffers */ - - vector<Sample*>& bufs = _session.get_passthru_buffers (); - uint32_t limit = n_process_buffers (); - - uint32_t n; - uint32_t i; - - - for (i = 0, n = 1; i < limit; ++i, ++n) { - memcpy (bufs[i], b, sizeof (Sample) * nframes); - if (n < diskstream->n_channels()) { - tmpb = diskstream->playback_buffer(n); - if (tmpb!=0) { - b = tmpb; - } - } - } - - /* don't waste time with automation if we're recording or we've just stopped (yes it can happen) */ - - if (!diskstream->record_enabled() && _session.transport_rolling()) { - Glib::Mutex::Lock am (automation_lock, Glib::TRY_LOCK); - - if (am.locked() && gain_automation_playback()) { - apply_gain_automation = _gain_automation_curve.rt_safe_get_vector (start_frame, end_frame, _session.gain_automation_buffer(), nframes); - } - } - - process_output_buffers (bufs, limit, start_frame, end_frame, nframes, offset, (!_session.get_record_enabled() || !_session.get_do_not_record_plugins()), declick, (_meter_point != MeterInput)); - - } else { - /* problem with the diskstream; just be quiet for a bit */ - silence (nframes, offset); - } -#endif return 0; } @@ -645,97 +532,6 @@ MidiTrack::set_name (string str, void *src) int MidiTrack::export_stuff (vector<unsigned char*>& buffers, char * workbuf, uint32_t nbufs, jack_nframes_t start, jack_nframes_t nframes) { -#if 0 - gain_t gain_automation[nframes]; - gain_t gain_buffer[nframes]; - float mix_buffer[nframes]; - RedirectList::iterator i; - bool post_fader_work = false; - gain_t this_gain = _gain; - vector<Sample*>::iterator bi; - Sample * b; - - Glib::RWLock::ReaderLock rlock (redirect_lock); - - if (diskstream->playlist()->read (buffers[0], mix_buffer, gain_buffer, workbuf, start, nframes) != nframes) { - return -1; - } - - uint32_t n=1; - bi = buffers.begin(); - b = buffers[0]; - ++bi; - for (; bi != buffers.end(); ++bi, ++n) { - if (n < diskstream->n_channels()) { - if (diskstream->playlist()->read ((*bi), mix_buffer, gain_buffer, workbuf, start, nframes, n) != nframes) { - return -1; - } - b = (*bi); - } - else { - /* duplicate last across remaining buffers */ - memcpy ((*bi), b, sizeof (Sample) * nframes); - } - } - - - /* note: only run inserts during export. other layers in the machinery - will already have checked that there are no external port inserts. - */ - - for (i = _redirects.begin(); i != _redirects.end(); ++i) { - Insert *insert; - - if ((insert = dynamic_cast<Insert*>(*i)) != 0) { - switch (insert->placement()) { - case PreFader: - insert->run (buffers, nbufs, nframes, 0); - break; - case PostFader: - post_fader_work = true; - break; - } - } - } - - if (_gain_automation_curve.automation_state() == Play) { - - _gain_automation_curve.get_vector (start, start + nframes, gain_automation, nframes); - - for (bi = buffers.begin(); bi != buffers.end(); ++bi) { - Sample *b = *bi; - for (jack_nframes_t n = 0; n < nframes; ++n) { - b[n] *= gain_automation[n]; - } - } - - } else { - - for (bi = buffers.begin(); bi != buffers.end(); ++bi) { - Sample *b = *bi; - for (jack_nframes_t n = 0; n < nframes; ++n) { - b[n] *= this_gain; - } - } - } - - if (post_fader_work) { - - for (i = _redirects.begin(); i != _redirects.end(); ++i) { - PluginInsert *insert; - - if ((insert = dynamic_cast<PluginInsert*>(*i)) != 0) { - switch ((*i)->placement()) { - case PreFader: - break; - case PostFader: - insert->run (buffers, nbufs, nframes, 0); - break; - } - } - } - } -#endif return 0; } @@ -764,124 +560,11 @@ MidiTrack::bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadIn void MidiTrack::freeze (InterThreadInfo& itt) { -#if 0 - Insert* insert; - vector<MidiSource*> srcs; - string new_playlist_name; - Playlist* new_playlist; - string dir; - AudioRegion* region; - string region_name; - - if ((_freeze_record.playlist = diskstream->playlist()) == 0) { - return; - } - - uint32_t n = 1; - - while (n < (UINT_MAX-1)) { - - string candidate; - - candidate = string_compose ("<F%2>%1", _freeze_record.playlist->name(), n); - - if (_session.playlist_by_name (candidate) == 0) { - new_playlist_name = candidate; - break; - } - - ++n; - - } - - if (n == (UINT_MAX-1)) { - PBD::error << string_compose (X_("There Are too many frozen versions of playlist \"%1\"" - " to create another one"), _freeze_record.playlist->name()) - << endmsg; - return; - } - - if (_session.write_one_midi_track (*this, 0, _session.current_end_frame(), true, srcs, itt)) { - return; - } - - _freeze_record.insert_info.clear (); - _freeze_record.have_mementos = true; - - { - Glib::RWLock::ReaderLock lm (redirect_lock); - - for (RedirectList::iterator r = _redirects.begin(); r != _redirects.end(); ++r) { - - if ((insert = dynamic_cast<Insert*>(*r)) != 0) { - - FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo ((*r)->get_state()); - - frii->insert = insert; - frii->id = insert->id(); - frii->memento = (*r)->get_memento(); - - _freeze_record.insert_info.push_back (frii); - - /* now deactivate the insert */ - - insert->set_active (false, this); - } - } - } - - new_playlist = new MidiPlaylist (_session, new_playlist_name, false); - region_name = new_playlist_name; - - /* create a new region from all filesources, keep it private */ - - region = new AudioRegion (srcs, 0, srcs[0]->length(), - region_name, 0, - (AudioRegion::Flag) (AudioRegion::WholeFile|AudioRegion::DefaultFlags), - false); - - new_playlist->set_orig_diskstream_id (diskstream->id()); - new_playlist->add_region (*region, 0); - new_playlist->set_frozen (true); - region->set_locked (true); - - diskstream->use_playlist (dynamic_cast<MidiPlaylist*>(new_playlist)); - diskstream->set_record_enabled (false, this); - - _freeze_record.state = Frozen; - FreezeChange(); /* EMIT SIGNAL */ -#endif } void MidiTrack::unfreeze () { -#if 0 - if (_freeze_record.playlist) { - diskstream->use_playlist (_freeze_record.playlist); - - if (_freeze_record.have_mementos) { - - for (vector<FreezeRecordInsertInfo*>::iterator i = _freeze_record.insert_info.begin(); i != _freeze_record.insert_info.end(); ++i) { - (*i)->memento (); - } - - } else { - - Glib::RWLock::ReaderLock lm (redirect_lock); // should this be a write lock? jlc - for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { - for (vector<FreezeRecordInsertInfo*>::iterator ii = _freeze_record.insert_info.begin(); ii != _freeze_record.insert_info.end(); ++ii) { - if ((*ii)->id == (*i)->id()) { - (*i)->set_state (((*ii)->state)); - break; - } - } - } - } - - _freeze_record.playlist = 0; - } -#endif _freeze_record.state = UnFrozen; FreezeChange (); /* EMIT SIGNAL */ } diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index a56424cfea..4984e13fa9 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -1179,7 +1179,7 @@ struct PanPlugins { PanPlugins pan_plugins[] = { { EqualPowerStereoPanner::name, 2, EqualPowerStereoPanner::factory }, { Multi2dPanner::name, 3, Multi2dPanner::factory }, - { string (""), 0 } + { string (""), 0, 0 } }; XMLNode& diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index b096e81785..c8787a7d34 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -280,13 +280,14 @@ PluginManager::ladspa_discover (string path) return 0; } -Plugin * +boost::shared_ptr<Plugin> PluginManager::load (Session& session, PluginInfo *info) { void *module; - Plugin *plugin = 0; try { + boost::shared_ptr<Plugin> plugin; + if (info->type == PluginInfo::VST) { #ifdef VST_SUPPORT @@ -296,14 +297,14 @@ PluginManager::load (Session& session, PluginInfo *info) if ((handle = fst_load (info->path.c_str())) == 0) { error << string_compose(_("VST: cannot load module from \"%1\""), info->path) << endmsg; } else { - plugin = new VSTPlugin (_engine, session, handle); + plugin.reset (new VSTPlugin (_engine, session, handle)); } } else { error << _("You asked ardour to not use any VST plugins") << endmsg; } #else error << _("This version of ardour has no support for VST plugins") << endmsg; - return 0; + return boost::shared_ptr<Plugin> ((Plugin*) 0); #endif } else { @@ -312,21 +313,20 @@ PluginManager::load (Session& session, PluginInfo *info) error << string_compose(_("LADSPA: cannot load module from \"%1\""), info->path) << endmsg; error << dlerror() << endmsg; } else { - plugin = new LadspaPlugin (module, _engine, session, info->index, session.frame_rate()); + plugin.reset (new LadspaPlugin (module, _engine, session, info->index, session.frame_rate())); } } plugin->set_info(*info); + return plugin; } catch (failed_constructor &err) { - plugin = 0; + return boost::shared_ptr<Plugin> ((Plugin*) 0); } - - return plugin; } -Plugin * +boost::shared_ptr<Plugin> ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::Type type) { PluginManager *mgr = PluginManager::the_manager(); @@ -343,7 +343,7 @@ ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::T break; case PluginInfo::AudioUnit: default: - return 0; + return boost::shared_ptr<Plugin> ((Plugin *) 0); } for (i = plugs->begin(); i != plugs->end(); ++i) { @@ -353,7 +353,7 @@ ARDOUR::find_plugin(Session& session, string name, long unique_id, PluginInfo::T } } - return 0; + return boost::shared_ptr<Plugin> ((Plugin*) 0); } string diff --git a/libs/ardour/redirect.cc b/libs/ardour/redirect.cc index 9800c5b1a2..1ab2f91cf0 100644 --- a/libs/ardour/redirect.cc +++ b/libs/ardour/redirect.cc @@ -60,25 +60,25 @@ Redirect::~Redirect () { } -Redirect* -Redirect::clone (const Redirect& other) +boost::shared_ptr<Redirect> +Redirect::clone (boost::shared_ptr<const Redirect> other) { - const Send *send; - const PortInsert *port_insert; - const PluginInsert *plugin_insert; - - if ((send = dynamic_cast<const Send*>(&other)) != 0) { - return new Send (*send); - } else if ((port_insert = dynamic_cast<const PortInsert*>(&other)) != 0) { - return new PortInsert (*port_insert); - } else if ((plugin_insert = dynamic_cast<const PluginInsert*>(&other)) != 0) { - return new PluginInsert (*plugin_insert); + 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<Redirect> (new Send (*send)); + } else if ((port_insert = boost::dynamic_pointer_cast<const PortInsert>(other)) != 0) { + return boost::shared_ptr<Redirect> (new PortInsert (*port_insert)); + } else if ((plugin_insert = boost::dynamic_pointer_cast<const PluginInsert>(other)) != 0) { + return boost::shared_ptr<Redirect> (new PluginInsert (*plugin_insert)); } else { fatal << _("programming error: unknown Redirect type in Redirect::Clone!\n") << endmsg; /*NOTREACHED*/ } - return 0; + return boost::shared_ptr<Redirect>(); } void diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index fb5c175bba..95b5d0ddaf 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -757,7 +757,7 @@ Route::set_mute (bool yn, void *src) } int -Route::add_redirect (Redirect *redirect, void *src, uint32_t* err_streams) +Route::add_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_t* err_streams) { uint32_t old_rmo = redirect_max_outs; @@ -768,12 +768,12 @@ Route::add_redirect (Redirect *redirect, void *src, uint32_t* err_streams) { Glib::RWLock::WriterLock lm (redirect_lock); - PluginInsert* pi; - PortInsert* porti; + boost::shared_ptr<PluginInsert> pi; + boost::shared_ptr<PortInsert> porti; uint32_t potential_max_streams = 0; - if ((pi = dynamic_cast<PluginInsert*>(redirect)) != 0) { + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(redirect)) != 0) { pi->set_count (1); if (pi->input_streams() == 0) { @@ -782,8 +782,8 @@ Route::add_redirect (Redirect *redirect, void *src, uint32_t* err_streams) } potential_max_streams = max(pi->input_streams(), pi->output_streams()); - - } else if ((porti = dynamic_cast<PortInsert*>(redirect)) != 0) { + + } else if ((porti = boost::dynamic_pointer_cast<PortInsert>(redirect)) != 0) { /* force new port inserts to start out with an i/o configuration that matches this route's i/o configuration. @@ -848,9 +848,9 @@ Route::add_redirects (const RedirectList& others, void *src, uint32_t* err_strea for (RedirectList::const_iterator i = others.begin(); i != others.end(); ++i) { - PluginInsert* pi; + boost::shared_ptr<PluginInsert> pi; - if ((pi = dynamic_cast<PluginInsert*>(*i)) != 0) { + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { pi->set_count (1); uint32_t m = max(pi->input_streams(), pi->output_streams()); @@ -899,11 +899,6 @@ Route::clear_redirects (void *src) { Glib::RWLock::WriterLock lm (redirect_lock); - - for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { - delete *i; - } - _redirects.clear (); } @@ -917,7 +912,7 @@ Route::clear_redirects (void *src) } int -Route::remove_redirect (Redirect *redirect, void *src, uint32_t* err_streams) +Route::remove_redirect (boost::shared_ptr<Redirect> redirect, void *src, uint32_t* err_streams) { uint32_t old_rmo = redirect_max_outs; @@ -949,13 +944,13 @@ Route::remove_redirect (Redirect *redirect, void *src, uint32_t* err_streams) run. */ - Send* send; - PortInsert* port_insert; + boost::shared_ptr<Send> send; + boost::shared_ptr<PortInsert> port_insert; - if ((send = dynamic_cast<Send*> (*i)) != 0) { + if ((send = boost::dynamic_pointer_cast<Send> (*i)) != 0) { send->disconnect_inputs (this); send->disconnect_outputs (this); - } else if ((port_insert = dynamic_cast<PortInsert*> (*i)) != 0) { + } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (*i)) != 0) { port_insert->disconnect_inputs (this); port_insert->disconnect_outputs (this); } @@ -984,9 +979,9 @@ Route::remove_redirect (Redirect *redirect, void *src, uint32_t* err_streams) bool foo = false; for (i = _redirects.begin(); i != _redirects.end(); ++i) { - PluginInsert* pi; - - if ((pi = dynamic_cast<PluginInsert*>(*i)) != 0) { + boost::shared_ptr<PluginInsert> pi; + + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) { if (pi->is_generator()) { foo = true; } @@ -1033,7 +1028,7 @@ Route::_reset_plugin_counts (uint32_t* err_streams) for (r = _redirects.begin(); r != _redirects.end(); ++r) { - Insert *insert; + boost::shared_ptr<Insert> insert; /* do this here in case we bomb out before we get to the end of this function. @@ -1041,22 +1036,22 @@ Route::_reset_plugin_counts (uint32_t* err_streams) redirect_max_outs = max ((*r)->output_streams (), redirect_max_outs); - if ((insert = dynamic_cast<Insert*>(*r)) != 0) { + if ((insert = boost::dynamic_pointer_cast<Insert>(*r)) != 0) { ++i_cnt; - insert_map[insert->placement()].push_back (InsertCount (*insert)); + insert_map[insert->placement()].push_back (InsertCount (insert)); /* reset plugin counts back to one for now so that we have a predictable, controlled state to try to configure. */ - PluginInsert* pi; + boost::shared_ptr<PluginInsert> pi; - if ((pi = dynamic_cast<PluginInsert*>(insert)) != 0) { + if ((pi = boost::dynamic_pointer_cast<PluginInsert>(insert)) != 0) { pi->set_count (1); } - } else if (dynamic_cast<Send*> (*r) != 0) { + } else if (boost::dynamic_pointer_cast<Send> (*r) != 0) { ++s_cnt; } } @@ -1083,7 +1078,7 @@ Route::_reset_plugin_counts (uint32_t* err_streams) if (!insert_map[PreFader].empty()) { InsertCount& ic (insert_map[PreFader].back()); - initial_streams = ic.insert.compute_output_streams (ic.cnt); + initial_streams = ic.insert->compute_output_streams (ic.cnt); } else { initial_streams = n_inputs (); } @@ -1107,9 +1102,9 @@ Route::_reset_plugin_counts (uint32_t* err_streams) RedirectList::iterator prev = _redirects.end(); for (r = _redirects.begin(); r != _redirects.end(); prev = r, ++r) { - Send* s; + boost::shared_ptr<Send> s; - if ((s = dynamic_cast<Send*> (*r)) != 0) { + if ((s = boost::dynamic_pointer_cast<Send> (*r)) != 0) { if (r == _redirects.begin()) { s->expect_inputs (n_inputs()); } else { @@ -1132,11 +1127,11 @@ Route::apply_some_plugin_counts (list<InsertCount>& iclist) for (i = iclist.begin(); i != iclist.end(); ++i) { - if ((*i).insert.configure_io ((*i).cnt, (*i).in, (*i).out)) { + if ((*i).insert->configure_io ((*i).cnt, (*i).in, (*i).out)) { return -1; } /* make sure that however many we have, they are all active */ - (*i).insert.activate (); + (*i).insert->activate (); } return 0; @@ -1149,7 +1144,7 @@ Route::check_some_plugin_counts (list<InsertCount>& iclist, int32_t required_inp for (i = iclist.begin(); i != iclist.end(); ++i) { - if (((*i).cnt = (*i).insert.can_support_input_configuration (required_inputs)) < 0) { + if (((*i).cnt = (*i).insert->can_support_input_configuration (required_inputs)) < 0) { if (err_streams) { *err_streams = required_inputs; } @@ -1157,7 +1152,7 @@ Route::check_some_plugin_counts (list<InsertCount>& iclist, int32_t required_inp } (*i).in = required_inputs; - (*i).out = (*i).insert.compute_output_streams ((*i).cnt); + (*i).out = (*i).insert->compute_output_streams ((*i).cnt); required_inputs = (*i).out; } @@ -1201,7 +1196,7 @@ Route::copy_redirects (const Route& other, Placement placement, uint32_t* err_st for (RedirectList::const_iterator i = other._redirects.begin(); i != other._redirects.end(); ++i) { if ((*i)->placement() == placement) { - _redirects.push_back (Redirect::clone (**i)); + _redirects.push_back (Redirect::clone (*i)); } } @@ -1219,7 +1214,6 @@ Route::copy_redirects (const Route& other, Placement placement, uint32_t* err_st ++tmp; if ((*i)->placement() == placement) { - delete *i; _redirects.erase (i); } @@ -1238,10 +1232,7 @@ Route::copy_redirects (const Route& other, Placement placement, uint32_t* err_st } else { /* SUCCESSFUL COPY ATTEMPT: delete the redirects we removed pre-copy */ - - for (RedirectList::iterator i = to_be_deleted.begin(); i != to_be_deleted.end(); ++i) { - delete *i; - } + to_be_deleted.clear (); } } @@ -1284,7 +1275,7 @@ Route::all_redirects_active (bool state) } struct RedirectSorter { - bool operator() (const Redirect *a, const Redirect *b) { + bool operator() (boost::shared_ptr<const Redirect> a, boost::shared_ptr<const Redirect> b) { return a->sort_key() < b->sort_key(); } }; @@ -1447,13 +1438,13 @@ void Route::add_redirect_from_xml (const XMLNode& node) { const XMLProperty *prop; - Insert *insert = 0; - Send *send = 0; if (node.name() == "Send") { + try { - send = new Send (_session, node); + boost::shared_ptr<Send> send (new Send (_session, node)); + add_redirect (send, this); } catch (failed_constructor &err) { @@ -1461,21 +1452,21 @@ Route::add_redirect_from_xml (const XMLNode& node) return; } - add_redirect (send, this); - } else if (node.name() == "Insert") { try { if ((prop = node.property ("type")) != 0) { + boost::shared_ptr<Insert> insert; + if (prop->value() == "ladspa" || prop->value() == "Ladspa" || prop->value() == "vst") { - insert = new PluginInsert(_session, node); + insert.reset (new PluginInsert(_session, node)); } else if (prop->value() == "port") { - insert = new PortInsert (_session, node); + insert.reset (new PortInsert (_session, node)); } else { @@ -1725,8 +1716,8 @@ Route::silence (jack_nframes_t nframes, jack_nframes_t offset) if (lm.locked()) { for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { - PluginInsert* pi; - if (!_active && (pi = dynamic_cast<PluginInsert*> (*i)) != 0) { + 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 continue; } @@ -1837,18 +1828,17 @@ Route::set_comment (string cmt, void *src) } bool -Route::feeds (Route *o) +Route::feeds (boost::shared_ptr<Route> other) { uint32_t i, j; - IO& other = *o; IO& self = *this; uint32_t no = self.n_outputs(); - uint32_t ni = other.n_inputs (); + uint32_t ni = other->n_inputs (); for (i = 0; i < no; ++i) { for (j = 0; j < ni; ++j) { - if (self.output(i)->connected_to (other.input(j)->name())) { + if (self.output(i)->connected_to (other->input(j)->name())) { return true; } } @@ -1862,7 +1852,7 @@ Route::feeds (Route *o) for (i = 0; i < no; ++i) { for (j = 0; j < ni; ++j) { - if ((*r)->output(i)->connected_to (other.input (j)->name())) { + if ((*r)->output(i)->connected_to (other->input (j)->name())) { return true; } } @@ -1877,7 +1867,7 @@ Route::feeds (Route *o) for (i = 0; i < no; ++i) { for (j = 0; j < ni; ++j) { - if (_control_outs->output(i)->connected_to (other.input (j)->name())) { + if (_control_outs->output(i)->connected_to (other->input (j)->name())) { return true; } } @@ -2128,10 +2118,10 @@ Route::toggle_monitor_input () bool Route::has_external_redirects () const { - const PortInsert* pi; + boost::shared_ptr<const PortInsert> pi; for (RedirectList::const_iterator i = _redirects.begin(); i != _redirects.end(); ++i) { - if ((pi = dynamic_cast<const PortInsert*>(*i)) != 0) { + if ((pi = boost::dynamic_pointer_cast<const PortInsert>(*i)) != 0) { uint32_t no = pi->n_outputs(); @@ -2300,8 +2290,8 @@ Route::protect_automation () } for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { - PluginInsert* pi; - if ((pi = dynamic_cast<PluginInsert*> (*i)) != 0) { + boost::shared_ptr<PluginInsert> pi; + if ((pi = boost::dynamic_pointer_cast<PluginInsert> (*i)) != 0) { pi->protect_automation (); } } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 0bdff5bd5c..fec674b671 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -79,6 +79,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; +using boost::shared_ptr; const char* Session::_template_suffix = X_(".template"); const char* Session::_statefile_suffix = X_(".ardour"); @@ -260,6 +261,9 @@ Session::Session (AudioEngine &eng, pending_events (2048), //midi_requests (128), // the size of this should match the midi request pool size _send_smpte_update (false), + routes (new RouteList), + auditioner ((Auditioner*) 0), + _click_io ((IO*) 0), main_outs (0) { bool new_session; @@ -308,6 +312,7 @@ Session::Session (AudioEngine &eng, pending_events (2048), //midi_requests (16), _send_smpte_update (false), + routes (new RouteList), main_outs (0) { @@ -325,15 +330,13 @@ Session::Session (AudioEngine &eng, } if (control_out_channels) { - Route* r; - r = new Route (*this, _("monitor"), -1, control_out_channels, -1, control_out_channels, Route::ControlOut); + shared_ptr<Route> r (new Route (*this, _("monitor"), -1, control_out_channels, -1, control_out_channels, Route::ControlOut)); add_route (r); _control_out = r; } if (master_out_channels) { - Route* r; - r = new Route (*this, _("master"), -1, master_out_channels, -1, master_out_channels, Route::MasterOut); + shared_ptr<Route> r (new Route (*this, _("master"), -1, master_out_channels, -1, master_out_channels, Route::MasterOut)); add_route (r); _master_out = r; } else { @@ -385,15 +388,6 @@ Session::~Session () clear_clicks (); - if (_click_io) { - delete _click_io; - } - - - if (auditioner) { - delete auditioner; - } - for (vector<Sample*>::iterator i = _passthru_buffers.begin(); i != _passthru_buffers.end(); ++i) { free(*i); } @@ -453,17 +447,6 @@ Session::~Session () } #ifdef TRACK_DESTRUCTION - cerr << "delete routes\n"; -#endif /* TRACK_DESTRUCTION */ - for (RouteList::iterator i = routes.begin(); i != routes.end(); ) { - RouteList::iterator tmp; - tmp = i; - ++tmp; - delete *i; - i = tmp; - } - -#ifdef TRACK_DESTRUCTION cerr << "delete diskstreams\n"; #endif /* TRACK_DESTRUCTION */ for (DiskstreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ) { @@ -553,7 +536,7 @@ Session::~Session () } void -Session::set_worst_io_latencies (bool take_lock) +Session::set_worst_io_latencies () { _worst_output_latency = 0; _worst_input_latency = 0; @@ -562,18 +545,12 @@ Session::set_worst_io_latencies (bool take_lock) return; } - if (take_lock) { - route_lock.reader_lock (); - } + boost::shared_ptr<RouteList> r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { _worst_output_latency = max (_worst_output_latency, (*i)->output_latency()); _worst_input_latency = max (_worst_input_latency, (*i)->input_latency()); } - - if (take_lock) { - route_lock.reader_unlock (); - } } void @@ -590,7 +567,7 @@ Session::when_engine_running () /* every time we reconnect, recompute worst case output latencies */ - _engine.Running.connect (sigc::bind (mem_fun (*this, &Session::set_worst_io_latencies), true)); + _engine.Running.connect (mem_fun (*this, &Session::set_worst_io_latencies)); if (synced_to_jack()) { _engine.transport_stop (); @@ -605,7 +582,7 @@ Session::when_engine_running () try { XMLNode* child = 0; - _click_io = new ClickIO (*this, "click", 0, 0, -1, -1); + _click_io.reset (new ClickIO (*this, "click", 0, 0, -1, -1)); if (state_tree && (child = find_named_node (*state_tree->root(), "Click")) != 0) { @@ -646,7 +623,7 @@ Session::when_engine_running () error << _("cannot setup Click I/O") << endmsg; } - set_worst_io_latencies (true); + set_worst_io_latencies (); if (_clicking) { ControlChanged (Clicking); /* EMIT SIGNAL */ @@ -661,7 +638,7 @@ Session::when_engine_running () */ try { - auditioner = new Auditioner (*this); + auditioner.reset (new Auditioner (*this)); } catch (failed_constructor& err) { @@ -1468,7 +1445,6 @@ Session::set_block_size (jack_nframes_t nframes) */ { - Glib::RWLock::ReaderLock lm (route_lock); Glib::RWLock::ReaderLock dsm (diskstream_lock); vector<Sample*>::iterator i; uint32_t np; @@ -1510,7 +1486,9 @@ Session::set_block_size (jack_nframes_t nframes) allocate_pan_automation_buffers (nframes, _npan_buffers, true); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + boost::shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->set_block_size (nframes); } @@ -1518,7 +1496,7 @@ Session::set_block_size (jack_nframes_t nframes) (*i)->set_block_size (nframes); } - set_worst_io_latencies (false); + set_worst_io_latencies (); } } @@ -1560,7 +1538,7 @@ Session::set_default_fade (float steepness, float fade_msecs) } struct RouteSorter { - bool operator() (Route* r1, Route* r2) { + bool operator() (boost::shared_ptr<Route> r1, boost::shared_ptr<Route> r2) { if (r1->fed_by.find (r2) != r1->fed_by.end()) { return false; } else if (r2->fed_by.find (r1) != r2->fed_by.end()) { @@ -1582,9 +1560,9 @@ struct RouteSorter { }; static void -trace_terminal (Route* r1, Route* rbase) +trace_terminal (shared_ptr<Route> r1, shared_ptr<Route> rbase) { - Route* r2; + shared_ptr<Route> r2; if ((r1->fed_by.find (rbase) != r1->fed_by.end()) && (rbase->fed_by.find (r1) != rbase->fed_by.end())) { info << string_compose(_("feedback loop setup between %1 and %2"), r1->name(), rbase->name()) << endmsg; @@ -1593,13 +1571,13 @@ trace_terminal (Route* r1, Route* rbase) /* make a copy of the existing list of routes that feed r1 */ - set<Route *> existing = r1->fed_by; + set<shared_ptr<Route> > existing = r1->fed_by; /* for each route that feeds r1, recurse, marking it as feeding rbase as well. */ - for (set<Route *>::iterator i = existing.begin(); i != existing.end(); ++i) { + for (set<shared_ptr<Route> >::iterator i = existing.begin(); i != existing.end(); ++i) { r2 =* i; /* r2 is a route that feeds r1 which somehow feeds base. mark @@ -1629,7 +1607,7 @@ trace_terminal (Route* r1, Route* rbase) } void -Session::resort_routes (void* src) +Session::resort_routes () { /* don't do anything here with signals emitted by Routes while we are being destroyed. @@ -1639,54 +1617,64 @@ Session::resort_routes (void* src) return; } - /* Caller MUST hold the route_lock */ - RouteList::iterator i, j; + { - for (i = routes.begin(); i != routes.end(); ++i) { + RCUWriter<RouteList> writer (routes); + shared_ptr<RouteList> r = writer.get_copy (); + resort_routes_using (r); + /* writer goes out of scope and forces update */ + } +} +void +Session::resort_routes_using (shared_ptr<RouteList> r) +{ + RouteList::iterator i, j; + + for (i = r->begin(); i != r->end(); ++i) { + (*i)->fed_by.clear (); - for (j = routes.begin(); j != routes.end(); ++j) { - + for (j = r->begin(); j != r->end(); ++j) { + /* although routes can feed themselves, it will cause an endless recursive descent if we detect it. so don't bother checking for self-feeding. */ - + if (*j == *i) { continue; } - + if ((*j)->feeds (*i)) { (*i)->fed_by.insert (*j); } } } - for (i = routes.begin(); i != routes.end(); ++i) { + for (i = r->begin(); i != r->end(); ++i) { trace_terminal (*i, *i); } - + RouteSorter cmp; - routes.sort (cmp); - + r->sort (cmp); + #if 0 cerr << "finished route resort\n"; - for (i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { cerr << " " << (*i)->name() << " signal order = " << (*i)->order_key ("signal") << endl; } cerr << endl; #endif - + } -MidiTrack* +boost::shared_ptr<MidiTrack> Session::new_midi_track (TrackMode mode) { - MidiTrack *track; char track_name[32]; uint32_t n = 0; uint32_t channels_used = 0; @@ -1695,9 +1683,10 @@ Session::new_midi_track (TrackMode mode) /* count existing midi tracks */ { - Glib::RWLock::ReaderLock lm (route_lock); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { - if (dynamic_cast<MidiTrack*>(*i) != 0) { + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if (dynamic_cast<MidiTrack*>((*i).get()) != 0) { if (!(*i)->hidden()) { n++; channels_used += (*i)->n_inputs(); @@ -1722,7 +1711,7 @@ Session::new_midi_track (TrackMode mode) } while (n < (UINT_MAX-1)); try { - track = new MidiTrack (*this, track_name, Route::Flag (0), mode); + shared_ptr<MidiTrack> track (new MidiTrack (*this, track_name, Route::Flag (0), mode)); if (track->ensure_io (1, 1, false, this)) { error << string_compose (_("cannot configure %1 in/%2 out configuration for new midi track"), track_name) @@ -1772,36 +1761,34 @@ Session::new_midi_track (TrackMode mode) track->set_control_outs (cports); } #endif - track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes)); + track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes_proxy)); add_route (track); track->set_remote_control_id (ntracks()); + return track; } catch (failed_constructor &err) { error << _("Session: could not create new midi track.") << endmsg; - return 0; + return shared_ptr<MidiTrack> ((MidiTrack*) 0); } - - return track; } -Route* +boost::shared_ptr<Route> Session::new_midi_route () { - Route *bus; char bus_name[32]; uint32_t n = 0; string port; /* count existing midi busses */ - { - Glib::RWLock::ReaderLock lm (route_lock); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { - if (dynamic_cast<MidiTrack*>(*i) == 0) { + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if (dynamic_cast<MidiTrack*>((*i).get()) == 0) { if (!(*i)->hidden()) { n++; } @@ -1819,7 +1806,7 @@ Session::new_midi_route () } while (n < (UINT_MAX-1)); try { - bus = new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), Buffer::MIDI); + shared_ptr<Route> bus (new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), Buffer::MIDI)); if (bus->ensure_io (1, 1, false, this)) { error << (_("cannot configure 1 in/1 out configuration for new midi track")) @@ -1868,21 +1855,19 @@ Session::new_midi_route () } */ add_route (bus); + return bus; } catch (failed_constructor &err) { error << _("Session: could not create new MIDI route.") << endmsg; - return 0; + return shared_ptr<Route> ((Route*) 0); } - - return bus; } -AudioTrack* +shared_ptr<AudioTrack> Session::new_audio_track (int input_channels, int output_channels, TrackMode mode) { - AudioTrack *track; char track_name[32]; uint32_t n = 0; uint32_t channels_used = 0; @@ -1893,9 +1878,10 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod /* count existing audio tracks */ { - Glib::RWLock::ReaderLock lm (route_lock); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { - if (dynamic_cast<AudioTrack*>(*i) != 0) { + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if (dynamic_cast<AudioTrack*>((*i).get()) != 0) { if (!(*i)->hidden()) { n++; channels_used += (*i)->n_inputs(); @@ -1932,7 +1918,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod } try { - track = new AudioTrack (*this, track_name, Route::Flag (0), mode); + shared_ptr<AudioTrack> track (new AudioTrack (*this, track_name, Route::Flag (0), mode)); if (track->ensure_io (input_channels, output_channels, false, this)) { error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"), @@ -1983,25 +1969,23 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod track->set_control_outs (cports); } - track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes)); + track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes_proxy)); add_route (track); track->set_remote_control_id (ntracks()); + return track; } catch (failed_constructor &err) { error << _("Session: could not create new audio track.") << endmsg; - return 0; + return shared_ptr<AudioTrack> ((AudioTrack*) 0); } - - return track; } -Route* +shared_ptr<Route> Session::new_audio_route (int input_channels, int output_channels) { - Route *bus; char bus_name[32]; uint32_t n = 0; string port; @@ -2009,9 +1993,10 @@ Session::new_audio_route (int input_channels, int output_channels) /* count existing audio busses */ { - Glib::RWLock::ReaderLock lm (route_lock); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { - if (dynamic_cast<AudioTrack*>(*i) == 0) { + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if (dynamic_cast<AudioTrack*>((*i).get()) == 0) { if (!(*i)->hidden()) { n++; } @@ -2029,7 +2014,7 @@ Session::new_audio_route (int input_channels, int output_channels) } while (n < (UINT_MAX-1)); try { - bus = new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), Buffer::AUDIO); + shared_ptr<Route> bus (new Route (*this, bus_name, -1, -1, -1, -1, Route::Flag(0), Buffer::AUDIO)); if (bus->ensure_io (input_channels, output_channels, false, this)) { error << string_compose (_("cannot configure %1 in/%2 out configuration for new audio track"), @@ -2078,23 +2063,23 @@ Session::new_audio_route (int input_channels, int output_channels) } add_route (bus); + return bus; } catch (failed_constructor &err) { error << _("Session: could not create new audio route.") << endmsg; - return 0; + return shared_ptr<Route> ((Route*) 0); } - - return bus; } void -Session::add_route (Route* route) +Session::add_route (shared_ptr<Route> route) { { - Glib::RWLock::WriterLock lm (route_lock); - routes.push_front (route); - resort_routes(0); + RCUWriter<RouteList> writer (routes); + shared_ptr<RouteList> r = writer.get_copy (); + r->push_front (route); + resort_routes_using (r); } route->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), route)); @@ -2148,40 +2133,43 @@ Session::add_diskstream (Diskstream* dstream) } void -Session::remove_route (Route& route) +Session::remove_route (shared_ptr<Route> route) { { - Glib::RWLock::WriterLock lm (route_lock); - routes.remove (&route); + RCUWriter<RouteList> writer (routes); + shared_ptr<RouteList> rs = writer.get_copy (); + rs->remove (route); /* deleting the master out seems like a dumb idea, but its more of a UI policy issue than our concern. */ - if (&route == _master_out) { - _master_out = 0; + if (route == _master_out) { + _master_out = shared_ptr<Route> ((Route*) 0); } - if (&route == _control_out) { - _control_out = 0; + if (route == _control_out) { + _control_out = shared_ptr<Route> ((Route*) 0); /* cancel control outs for all routes */ vector<string> empty; - for (RouteList::iterator r = routes.begin(); r != routes.end(); ++r) { + for (RouteList::iterator r = rs->begin(); r != rs->end(); ++r) { (*r)->set_control_outs (empty); } } update_route_solo_state (); + + /* writer goes out of scope, forces route list update */ } AudioTrack* at; AudioDiskstream* ds = 0; - if ((at = dynamic_cast<AudioTrack*>(&route)) != 0) { + if ((at = dynamic_cast<AudioTrack*>(route.get())) != 0) { ds = &at->audio_diskstream(); } @@ -2204,7 +2192,7 @@ Session::remove_route (Route& route) save_state (_current_snapshot_name); - delete &route; + /* all shared ptrs to route should go out of scope here */ } void @@ -2214,19 +2202,20 @@ Session::route_mute_changed (void* src) } void -Session::route_solo_changed (void* src, Route* route) +Session::route_solo_changed (void* src, shared_ptr<Route> route) { if (solo_update_disabled) { // We know already return; } - Glib::RWLock::ReaderLock lm (route_lock); bool is_track; - is_track = (dynamic_cast<AudioTrack*>(route) != 0); + is_track = (dynamic_cast<AudioTrack*>(route.get()) != 0); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { /* soloing a track mutes all other tracks, soloing a bus mutes all other busses */ @@ -2234,7 +2223,7 @@ Session::route_solo_changed (void* src, Route* route) /* don't mess with busses */ - if (dynamic_cast<AudioTrack*>(*i) == 0) { + if (dynamic_cast<AudioTrack*>((*i).get()) == 0) { continue; } @@ -2242,7 +2231,7 @@ Session::route_solo_changed (void* src, Route* route) /* don't mess with tracks */ - if (dynamic_cast<AudioTrack*>(*i) != 0) { + if (dynamic_cast<AudioTrack*>((*i).get()) != 0) { continue; } } @@ -2275,10 +2264,10 @@ Session::route_solo_changed (void* src, Route* route) bool same_thing_soloed = false; bool signal = false; - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if ((*i)->soloed()) { something_soloed = true; - if (dynamic_cast<AudioTrack*>(*i)) { + if (dynamic_cast<AudioTrack*>((*i).get())) { if (is_track) { same_thing_soloed = true; break; @@ -2329,11 +2318,13 @@ Session::update_route_solo_state () /* this is where we actually implement solo by changing the solo mute setting of each track. */ - - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if ((*i)->soloed()) { mute = true; - if (dynamic_cast<AudioTrack*>(*i)) { + if (dynamic_cast<AudioTrack*>((*i).get())) { is_track = true; } break; @@ -2349,7 +2340,7 @@ Session::update_route_solo_state () /* nothing is soloed */ - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->set_solo_mute (false); } @@ -2370,13 +2361,15 @@ Session::update_route_solo_state () void Session::modify_solo_mute (bool is_track, bool mute) { - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (is_track) { /* only alter track solo mute */ - if (dynamic_cast<AudioTrack*>(*i)) { + if (dynamic_cast<AudioTrack*>((*i).get())) { if ((*i)->soloed()) { (*i)->set_solo_mute (!mute); } else { @@ -2388,7 +2381,7 @@ Session::modify_solo_mute (bool is_track, bool mute) /* only alter bus solo mute */ - if (!dynamic_cast<AudioTrack*>(*i)) { + if (!dynamic_cast<AudioTrack*>((*i).get())) { if ((*i)->soloed()) { @@ -2420,36 +2413,35 @@ Session::catch_up_on_solo () basis, but needs the global overview that only the session has. */ - Glib::RWLock::ReaderLock lm (route_lock); update_route_solo_state(); } -Route * +shared_ptr<Route> Session::route_by_name (string name) { - Glib::RWLock::ReaderLock lm (route_lock); + shared_ptr<RouteList> r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if ((*i)->name() == name) { - return* i; + return *i; } } - return 0; + return shared_ptr<Route> ((Route*) 0); } -Route * +shared_ptr<Route> Session::route_by_remote_id (uint32_t id) { - Glib::RWLock::ReaderLock lm (route_lock); + shared_ptr<RouteList> r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if ((*i)->remote_control_id() == id) { - return* i; + return *i; } } - return 0; + return shared_ptr<Route> ((Route*) 0); } void @@ -3282,7 +3274,7 @@ Session::cancel_audition () } bool -Session::RoutePublicOrderSorter::operator() (Route* a, Route* b) +Session::RoutePublicOrderSorter::operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) { return a->order_key(N_("signal")) < b->order_key(N_("signal")); } @@ -3328,13 +3320,11 @@ Session::is_auditioning () const void Session::set_all_solo (bool yn) { - { - Glib::RWLock::ReaderLock lm (route_lock); - - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { - if (!(*i)->hidden()) { - (*i)->set_solo (yn, this); - } + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if (!(*i)->hidden()) { + (*i)->set_solo (yn, this); } } @@ -3344,13 +3334,11 @@ Session::set_all_solo (bool yn) void Session::set_all_mute (bool yn) { - { - Glib::RWLock::ReaderLock lm (route_lock); - - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { - if (!(*i)->hidden()) { - (*i)->set_mute (yn, this); - } + shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if (!(*i)->hidden()) { + (*i)->set_mute (yn, this); } } @@ -3394,10 +3382,9 @@ Session::graph_reordered () return; } - Glib::RWLock::WriterLock lm1 (route_lock); Glib::RWLock::ReaderLock lm2 (diskstream_lock); - resort_routes (0); + resort_routes (); /* force all diskstreams to update their capture offset values to reflect any changes in latencies within the graph. @@ -3423,12 +3410,12 @@ Session::record_enable_all () void Session::record_enable_change_all (bool yn) { - Glib::RWLock::ReaderLock lm1 (route_lock); + shared_ptr<RouteList> r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { AudioTrack* at; - if ((at = dynamic_cast<AudioTrack*>(*i)) != 0) { + if ((at = dynamic_cast<AudioTrack*>((*i).get())) != 0) { at->set_record_enable (yn, this); } } @@ -3694,9 +3681,9 @@ Session::reset_native_file_format () bool Session::route_name_unique (string n) const { - Glib::RWLock::ReaderLock lm (route_lock); + shared_ptr<RouteList> r = routes.reader (); - for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) { if ((*i)->name() == n) { return false; } @@ -3753,23 +3740,16 @@ Session::allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howma _npan_buffers = howmany; } -void -Session::add_instant_xml (XMLNode& node, const std::string& dir) -{ - Stateful::add_instant_xml (node, dir); - Config->add_instant_xml (node, get_user_ardour_path()); -} - int Session::freeze (InterThreadInfo& itt) { - Glib::RWLock::ReaderLock lm (route_lock); + shared_ptr<RouteList> r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { AudioTrack *at; - if ((at = dynamic_cast<AudioTrack*>(*i)) != 0) { + if ((at = dynamic_cast<AudioTrack*>((*i).get())) != 0) { /* XXX this is wrong because itt.progress will keep returning to zero at the start of every track. */ @@ -3958,10 +3938,10 @@ uint32_t Session::ntracks () const { uint32_t n = 0; - Glib::RWLock::ReaderLock lm (route_lock); + shared_ptr<RouteList> r = routes.reader (); - for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) { - if (dynamic_cast<AudioTrack*> (*i)) { + for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) { + if (dynamic_cast<AudioTrack*> ((*i).get())) { ++n; } } @@ -3973,10 +3953,10 @@ uint32_t Session::nbusses () const { uint32_t n = 0; - Glib::RWLock::ReaderLock lm (route_lock); + shared_ptr<RouteList> r = routes.reader (); - for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) { - if (dynamic_cast<AudioTrack*> (*i) == 0) { + for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) { + if (dynamic_cast<AudioTrack*> ((*i).get()) == 0) { ++n; } } diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 37365c8403..b39c4f2218 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -485,8 +485,9 @@ Session::prepare_to_export (AudioExportSpecification& spec) /* take everyone out of awrite to avoid disasters */ { - Glib::RWLock::ReaderLock lm (route_lock); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + boost::shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->protect_automation (); } } diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index f7f1d79bbe..d7cdd94b2b 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -786,12 +786,12 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled) if (mmc_control) { RouteList::iterator i; - Glib::RWLock::ReaderLock guard (route_lock); + boost::shared_ptr<RouteList> r = routes.reader(); - for (i = routes.begin(); i != routes.end(); ++i) { + for (i = r->begin(); i != r->end(); ++i) { AudioTrack *at; - if ((at = dynamic_cast<AudioTrack*>(*i)) != 0) { + if ((at = dynamic_cast<AudioTrack*>((*i).get())) != 0) { if (trk == at->remote_control_id()) { at->set_record_enable (enabled, &mmc); break; diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index b8929d3eca..a45397b03a 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -83,23 +83,20 @@ Session::no_roll (jack_nframes_t nframes, jack_nframes_t offset) jack_nframes_t end_frame = _transport_frame + nframes; int ret = 0; bool declick = get_transport_declick_required(); + boost::shared_ptr<RouteList> r = routes.reader (); if (_click_io) { _click_io->silence (nframes, offset); } - /* XXX we're supposed to have the route_lock while doing this. - this is really bad ... - */ - if (g_atomic_int_get (&processing_prohibited)) { - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->silence (nframes, offset); } return 0; } - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if ((*i)->hidden()) { continue; @@ -124,6 +121,7 @@ Session::process_routes (jack_nframes_t nframes, jack_nframes_t offset) bool record_active; int declick = get_transport_declick_required(); bool rec_monitors = get_rec_monitors_input(); + boost::shared_ptr<RouteList> r = routes.reader (); if (transport_sub_state & StopPendingCapture) { /* force a declick out */ @@ -132,7 +130,7 @@ Session::process_routes (jack_nframes_t nframes, jack_nframes_t offset) record_active = actively_recording(); // || (get_record_enabled() && get_punch_in()); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { int ret; @@ -167,13 +165,14 @@ Session::silent_process_routes (jack_nframes_t nframes, jack_nframes_t offset) bool record_active = actively_recording(); int declick = get_transport_declick_required(); bool rec_monitors = get_rec_monitors_input(); + boost::shared_ptr<RouteList> r = routes.reader (); if (transport_sub_state & StopPendingCapture) { /* force a declick out */ declick = -1; } - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { int ret; @@ -256,10 +255,14 @@ Session::process_with_events (jack_nframes_t nframes) long frames_moved; bool session_needs_butler = false; + /* make sure the auditioner is silent */ + if (auditioner) { auditioner->silence (nframes, 0); } + /* handle any pending events */ + while (pending_events.read (&ev, 1) == 1) { merge_event (ev); } @@ -296,13 +299,12 @@ Session::process_with_events (jack_nframes_t nframes) end_frame = _transport_frame + nframes; { - Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK); Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK); Event* this_event; Events::iterator the_next_one; - - if (!rm.locked() || !dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) { + + if (!dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) { no_roll (nframes, 0); return; } @@ -703,7 +705,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) summon_butler (); } - jack_nframes_t frames_moved = (long) floor (_transport_speed * nframes); + int32_t frames_moved = (int32_t) floor (_transport_speed * nframes); if (frames_moved < 0) { decrement_transport_position (-frames_moved); @@ -740,10 +742,9 @@ Session::process_without_events (jack_nframes_t nframes) long frames_moved; { - Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK); Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK); - if (!rm.locked() || !dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) { + if (!dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) { no_roll (nframes, 0); return; } @@ -807,21 +808,23 @@ Session::process_without_events (jack_nframes_t nframes) void Session::process_audition (jack_nframes_t nframes) { - Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK); Event* ev; + boost::shared_ptr<RouteList> r = routes.reader (); - if (rm.locked()) { - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { - if (!(*i)->hidden()) { - (*i)->silence (nframes, 0); - } + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { + if (!(*i)->hidden()) { + (*i)->silence (nframes, 0); } } + + /* run the auditioner, and if it says we need butler service, ask for it */ if (auditioner->play_audition (nframes) > 0) { summon_butler (); } + /* handle pending events */ + while (pending_events.read (&ev, 1) == 1) { merge_event (ev); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 78d8aa6ac7..73ba391873 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -167,7 +167,6 @@ Session::first_stage_init (string fullpath, string snapshot_name) _slave_type = None; butler_mixdown_buffer = 0; butler_gain_buffer = 0; - auditioner = 0; mmc_control = false; midi_control = true; mmc = 0; @@ -182,8 +181,6 @@ Session::first_stage_init (string fullpath, string snapshot_name) _edit_mode = Slide; pending_edit_mode = _edit_mode; _play_range = false; - _control_out = 0; - _master_out = 0; input_auto_connect = AutoConnectOption (0); output_auto_connect = AutoConnectOption (0); waiting_to_start = false; @@ -218,7 +215,6 @@ Session::first_stage_init (string fullpath, string snapshot_name) waveforms for clicks. */ - _click_io = 0; _clicking = false; click_requested = false; click_data = 0; @@ -1417,10 +1413,10 @@ Session::state(bool full_state) child = node->add_child ("Routes"); { - Glib::RWLock::ReaderLock lm (route_lock); + boost::shared_ptr<RouteList> r = routes.reader (); RoutePublicOrderSorter cmp; - RouteList public_order(routes); + RouteList public_order (*r); public_order.sort (cmp); for (RouteList::iterator i = public_order.begin(); i != public_order.end(); ++i) { @@ -1716,7 +1712,6 @@ Session::load_routes (const XMLNode& node) { XMLNodeList nlist; XMLNodeConstIterator niter; - Route *route; nlist = node.children(); @@ -1724,7 +1719,9 @@ Session::load_routes (const XMLNode& node) for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((route = XMLRouteFactory (**niter)) == 0) { + boost::shared_ptr<Route> route (XMLRouteFactory (**niter)); + + if (route == 0) { error << _("Session: cannot create Route from XML description.") << endmsg; return -1; } @@ -1735,11 +1732,11 @@ Session::load_routes (const XMLNode& node) return 0; } -Route * +boost::shared_ptr<Route> Session::XMLRouteFactory (const XMLNode& node) { if (node.name() != "Route") { - return 0; + return boost::shared_ptr<Route> ((Route*) 0); } bool has_diskstream = (node.property ("diskstream") != 0 || node.property ("diskstream-id") != 0); @@ -1752,12 +1749,16 @@ Session::XMLRouteFactory (const XMLNode& node) assert(type != Buffer::NIL); if (has_diskstream) { - if (type == Buffer::AUDIO) - return new AudioTrack (*this, node); - else - return new MidiTrack (*this, node); + if (type == Buffer::AUDIO) { + boost::shared_ptr<Route> ret (new AudioTrack (*this, node)); + return ret; + } else { + boost::shared_ptr<Route> ret (new MidiTrack (*this, node)); + return ret; + } } else { - return new Route (*this, node); + boost::shared_ptr<Route> ret (new Route (*this, node)); + return ret; } } @@ -2441,23 +2442,6 @@ Session::load_route_groups (const XMLNode& node, bool edit) return 0; } -void -Session::swap_configuration(Configuration** new_config) -{ - Glib::RWLock::WriterLock lm (route_lock); // jlc - WHY? - Configuration* tmp = *new_config; - *new_config = Config; - Config = tmp; - set_dirty(); -} - -void -Session::copy_configuration(Configuration* new_config) -{ - Glib::RWLock::WriterLock lm (route_lock); - new_config = new Configuration(*Config); -} - static bool state_file_filter (const string &str, void *arg) { @@ -2481,7 +2465,7 @@ remove_end(string* state) statename = statename.substr (start+1); } - if ((end = statename.rfind(".ardour")) < 0) { + if ((end = statename.rfind(".ardour")) == string::npos) { end = statename.length(); } @@ -2633,14 +2617,15 @@ Session::GlobalRouteBooleanState Session::get_global_route_boolean (bool (Route::*method)(void) const) { GlobalRouteBooleanState s; - Glib::RWLock::ReaderLock lm (route_lock); + boost::shared_ptr<RouteList> r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->hidden()) { RouteBooleanState v; v.first =* i; - v.second = ((*i)->*method)(); + Route* r = (*i).get(); + v.second = (r->*method)(); s.push_back (v); } @@ -2653,9 +2638,9 @@ Session::GlobalRouteMeterState Session::get_global_route_metering () { GlobalRouteMeterState s; - Glib::RWLock::ReaderLock lm (route_lock); + boost::shared_ptr<RouteList> r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->hidden()) { RouteMeterState v; @@ -2681,7 +2666,8 @@ void Session::set_global_route_boolean (GlobalRouteBooleanState s, void (Route::*method)(bool, void*), void* arg) { for (GlobalRouteBooleanState::iterator i = s.begin(); i != s.end(); ++i) { - (i->first->*method) (i->second, arg); + Route* r = i->first.get(); + (r->*method) (i->second, arg); } } @@ -3285,6 +3271,10 @@ Session::add_controllable (Controllable* c) void Session::remove_controllable (Controllable* c) { + if (_state_of_the_state | Deletion) { + return; + } + Glib::Mutex::Lock lm (controllables_lock); controllables.remove (c); } @@ -3302,3 +3292,10 @@ Session::controllable_by_id (const PBD::ID& id) return 0; } + +void +Session::add_instant_xml (XMLNode& node, const std::string& dir) +{ + Stateful::add_instant_xml (node, dir); + Config->add_instant_xml (node, get_user_ardour_path()); +} diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 6a92d71d1c..bff8ae5955 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -196,11 +196,11 @@ Session::realtime_stop (bool abort) void Session::butler_transport_work () { - Glib::RWLock::ReaderLock rm (route_lock); Glib::RWLock::ReaderLock dsm (diskstream_lock); - + boost::shared_ptr<RouteList> r = routes.reader (); + if (post_transport_work & PostTransportCurveRealloc) { - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->curve_reallocate(); } } @@ -337,7 +337,9 @@ Session::non_realtime_stop (bool abort) (*i)->transport_stopped (*now, xnow, abort); } - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + boost::shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->hidden()) { (*i)->set_pending_declick (0); } @@ -546,7 +548,9 @@ Session::set_auto_loop (bool yn) void Session::flush_all_redirects () { - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + boost::shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->flush_redirects (); } } @@ -1205,11 +1209,12 @@ Session::update_latency_compensation (bool with_stop, bool abort) return; } - Glib::RWLock::ReaderLock lm (route_lock); Glib::RWLock::ReaderLock lm2 (diskstream_lock); _worst_track_latency = 0; - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + boost::shared_ptr<RouteList> r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (with_stop) { (*i)->handle_transport_stopped (abort, (post_transport_work & PostTransportLocate), (!(post_transport_work & PostTransportLocate) || pending_locate_flush)); @@ -1227,7 +1232,7 @@ Session::update_latency_compensation (bool with_stop, bool abort) } } - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->set_latency_delay (_worst_track_latency); } @@ -1237,7 +1242,7 @@ Session::update_latency_compensation (bool with_stop, bool abort) _engine.update_total_latencies (); } - set_worst_io_latencies (false); + set_worst_io_latencies (); /* reflect any changes in latencies into capture offsets */ diff --git a/libs/gtkmm2ext/SConscript b/libs/gtkmm2ext/SConscript index bb28945641..cf513eb5a1 100644 --- a/libs/gtkmm2ext/SConscript +++ b/libs/gtkmm2ext/SConscript @@ -24,10 +24,10 @@ gtkmm2ext.Merge ([ domain = 'libgtkmm2ext' -gtkmm2ext.Append(DOMAIN=domain,MAJOR=0,MINOR=8,MICRO=2) +gtkmm2ext.Append(DOMAIN=domain,MAJOR=0,MINOR=8,MICRO=3) gtkmm2ext.Append(CXXFLAGS="-DPACKAGE=\\\"" + domain + "\\\"") gtkmm2ext.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED") -gtkmm2ext.Append(CPPPATH='#libs/surfaces/control_protocol') +#gtkmm2ext.Append(CPPPATH='#libs/surfaces/control_protocol') gtkmm2ext.Append(PACKAGE=domain) gtkmm2ext.Append(POTFILE=domain + '.pot') @@ -42,6 +42,7 @@ fastmeter.cc gtk_ui.cc hexentry.cc idle_adjustment.cc +pathlist.cc pixscroller.cc popup.cc prompter.cc diff --git a/libs/gtkmm2ext/gtkmm2ext/pathlist.h b/libs/gtkmm2ext/gtkmm2ext/pathlist.h new file mode 100644 index 0000000000..f4a5973d5a --- /dev/null +++ b/libs/gtkmm2ext/gtkmm2ext/pathlist.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2006 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + 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 __gtkmm2ext_pathlist_h__ +#define __gtkmm2ext_pathlist_h__ + +#include <vector> +#include <string> + +#include <gtkmm.h> + +namespace Gtkmm2ext { + +class PathList : public Gtk::VBox +{ + public: + PathList (); + ~PathList () {}; + + std::vector<std::string> get_paths (); + void set_paths (std::vector<std::string> paths); + + sigc::signal<void> PathsUpdated; + + protected: + Gtk::Button add_btn; + Gtk::Button subtract_btn; + + void add_btn_clicked (); + void subtract_btn_clicked (); + + private: + struct PathColumns : public Gtk::TreeModel::ColumnRecord { + PathColumns() { add (paths); } + Gtk::TreeModelColumn<std::string> paths; + }; + PathColumns path_columns; + + Glib::RefPtr<Gtk::ListStore> _store; + Gtk::TreeView _view; + + void selection_changed (); +}; + +} // namespace Gtkmm2ext + +#endif // __gtkmm2ext_pathlist_h__ diff --git a/libs/gtkmm2ext/pathlist.cc b/libs/gtkmm2ext/pathlist.cc new file mode 100644 index 0000000000..7b3448ed5f --- /dev/null +++ b/libs/gtkmm2ext/pathlist.cc @@ -0,0 +1,124 @@ +/* + Copyright (C) 2006 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + 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 <gtkmm2ext/pathlist.h> + +#include "i18n.h" + +using namespace std; +using namespace Gtkmm2ext; + +PathList::PathList () + : + add_btn(_("+")), + subtract_btn(_("-")), + path_columns(), + _store(Gtk::ListStore::create(path_columns)), + _view(_store) +{ + _view.append_column(_("Paths"), path_columns.paths); + _view.set_size_request(-1, 100); + _view.set_headers_visible (false); + + Gtk::ScrolledWindow* scroll = manage(new Gtk::ScrolledWindow); + scroll->set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scroll->add(_view); + + add (*scroll); + + Gtk::HBox* btn_box = manage(new Gtk::HBox); + btn_box->add(add_btn); + btn_box->add(subtract_btn); + + add (*btn_box); + + add_btn.signal_clicked().connect (mem_fun(*this, &PathList::add_btn_clicked)); + subtract_btn.signal_clicked().connect (mem_fun(*this, &PathList::subtract_btn_clicked)); + _view.get_selection()->signal_changed().connect (mem_fun(*this, &PathList::selection_changed)); +} + +vector<string> +PathList::get_paths () +{ + vector<string> paths; + + Gtk::TreeModel::Children children(_store->children()); + + for (Gtk::TreeIter iter = children.begin(); iter != children.end(); ++iter) { + Gtk::ListStore::Row row = *iter; + + paths.push_back(row[path_columns.paths]); + } + + return paths; +} + +void +PathList::set_paths (vector<string> paths) +{ + _store->clear(); + + for (vector<string>::iterator i = paths.begin(); i != paths.end(); ++i) { + Gtk::ListStore::iterator iter = _store->append(); + Gtk::ListStore::Row row = *iter; + row[path_columns.paths] = *i; + } +} + +void +PathList::add_btn_clicked () +{ + Gtk::FileChooserDialog path_chooser (_("Path Chooser"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); + + path_chooser.add_button (Gtk::Stock::ADD, Gtk::RESPONSE_OK); + path_chooser.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + + int result = path_chooser.run (); + + if (result == Gtk::RESPONSE_OK) { + string pathname = path_chooser.get_filename(); + + if (pathname.length ()) { + Gtk::ListStore::iterator iter = _store->append (); + Gtk::ListStore::Row row = *iter; + row[path_columns.paths] = pathname; + + PathsUpdated (); // EMIT_SIGNAL + } + } +} + +void +PathList::subtract_btn_clicked () +{ + Gtk::ListStore::iterator iter = _view.get_selection()->get_selected(); + _store->erase (iter); + + PathsUpdated (); // EMIT_SIGNAL +} + +void +PathList::selection_changed () +{ + if (_view.get_selection()->count_selected_rows ()) { + subtract_btn.set_sensitive (true); + } else { + subtract_btn.set_sensitive (false); + } +} diff --git a/libs/midi++2/SConscript b/libs/midi++2/SConscript index e0df59c7da..65d0882dce 100644 --- a/libs/midi++2/SConscript +++ b/libs/midi++2/SConscript @@ -18,7 +18,6 @@ fd_midiport.cc fifomidi.cc midi.cc midichannel.cc -midicontrollable.cc midifactory.cc midimanager.cc midiparser.cc diff --git a/libs/midi++2/midi++/channel.h b/libs/midi++2/midi++/channel.h index 0d24bf8bbe..e1ffb954a5 100644 --- a/libs/midi++2/midi++/channel.h +++ b/libs/midi++2/midi++/channel.h @@ -155,7 +155,7 @@ class Channel : public sigc::trackable { void process_reset (Parser &); }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __midichannel_h__ diff --git a/libs/midi++2/midi++/controllable.h b/libs/midi++2/midi++/controllable.h deleted file mode 100644 index 44249cfa4f..0000000000 --- a/libs/midi++2/midi++/controllable.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 1998-99 Paul Barton-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. - - $Id$ -*/ - -#ifndef __qm_midicontrollable_h__ -#define __qm_midicontrollable_h__ - -#include <string> - -#include <sigc++/sigc++.h> - -#include <midi++/types.h> - -namespace MIDI { - -class Channel; -class Port; -class Parser; - -class Controllable : public sigc::trackable -{ - public: - Controllable (Port *, bool bistate = false); - virtual ~Controllable (); - - void midi_rebind (Port *, channel_t channel=-1); - void midi_forget (); - void learn_about_external_control (); - void stop_learning (); - void drop_external_control (); - - virtual void set_value (float) = 0; - - sigc::signal<void> learning_started; - sigc::signal<void> learning_stopped; - - bool get_control_info (channel_t&, eventType&, byte&); - void set_control_type (channel_t, eventType, byte); - - bool get_midi_feedback () { return feedback; } - void set_midi_feedback (bool val) { feedback = val; } - - Port * get_port() { return port; } - - std::string control_description() const { return _control_description; } - - void send_midi_feedback (float val, timestamp_t timestamp); - - private: - bool bistate; - int midi_msg_id; /* controller ID or note number */ - sigc::connection midi_sense_connection[2]; - sigc::connection midi_learn_connection; - size_t connections; - Port* port; - eventType control_type; - byte control_additional; - channel_t control_channel; - std::string _control_description; - bool feedback; - - void midi_receiver (Parser &p, byte *, size_t); - void midi_sense_note (Parser &, EventTwoBytes *, bool is_on); - void midi_sense_note_on (Parser &p, EventTwoBytes *tb); - void midi_sense_note_off (Parser &p, EventTwoBytes *tb); - void midi_sense_controller (Parser &, EventTwoBytes *); - void midi_sense_program_change (Parser &, byte); - void midi_sense_pitchbend (Parser &, pitchbend_t); - - void bind_midi (channel_t, eventType, byte); -}; - -}; /* namespace MIDI */ - -#endif // __qm_midicontrollable_h__ - diff --git a/libs/midi++2/midi++/coremidi_midiport.h b/libs/midi++2/midi++/coremidi_midiport.h index 046b170bce..30e07e01a5 100644 --- a/libs/midi++2/midi++/coremidi_midiport.h +++ b/libs/midi++2/midi++/coremidi_midiport.h @@ -62,6 +62,6 @@ class CoreMidi_MidiPort:public Port { bool firstrecv; }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __coremidi_midiport_h__ diff --git a/libs/midi++2/midi++/factory.h b/libs/midi++2/midi++/factory.h index 3fa57b6676..e29d7543f8 100644 --- a/libs/midi++2/midi++/factory.h +++ b/libs/midi++2/midi++/factory.h @@ -35,6 +35,6 @@ class PortFactory { const std::string &reqstr); }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __midi_factory_h__ diff --git a/libs/midi++2/midi++/fd_midiport.h b/libs/midi++2/midi++/fd_midiport.h index e84dc47794..3ff05b21c8 100644 --- a/libs/midi++2/midi++/fd_midiport.h +++ b/libs/midi++2/midi++/fd_midiport.h @@ -93,6 +93,6 @@ class FD_MidiPort : public Port int do_slow_write (byte *msg, unsigned int msglen); }; -}; /*namespace MIDI */ +} // namespace MIDI #endif // __fd_midiport_h__ diff --git a/libs/midi++2/midi++/fifomidi.h b/libs/midi++2/midi++/fifomidi.h index eb8778d4d5..200d90eda8 100644 --- a/libs/midi++2/midi++/fifomidi.h +++ b/libs/midi++2/midi++/fifomidi.h @@ -42,6 +42,6 @@ class FIFO_MidiPort : public MIDI::FD_MidiPort void open (PortRequest &req); }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __fifomidi_h__ diff --git a/libs/midi++2/midi++/manager.h b/libs/midi++2/midi++/manager.h index ddf5c0f8cd..d5a49eb0a3 100644 --- a/libs/midi++2/midi++/manager.h +++ b/libs/midi++2/midi++/manager.h @@ -88,6 +88,6 @@ class Manager { void close_ports (); }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __midi_manager_h__ diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h index 7b51b33a72..2d569f122c 100644 --- a/libs/midi++2/midi++/mmc.h +++ b/libs/midi++2/midi++/mmc.h @@ -82,7 +82,7 @@ class MachineControl : public sigc::trackable cmdRecordStrobeVariable = 0x55, cmdWait = 0x7C, - cmdResume = 0x7F, + cmdResume = 0x7F }; MachineControl (Port &port, @@ -256,6 +256,6 @@ class MachineControl : public sigc::trackable void write_track_record_ready (byte *, size_t len); }; -}; /* namespace MIDI */ +} // namespace MIDI #endif /* __midipp_mmc_h_h__ */ diff --git a/libs/midi++2/midi++/nullmidi.h b/libs/midi++2/midi++/nullmidi.h index 04c7d438bf..75445facb7 100644 --- a/libs/midi++2/midi++/nullmidi.h +++ b/libs/midi++2/midi++/nullmidi.h @@ -58,6 +58,6 @@ class Null_MidiPort : public Port virtual int selectable() const { return -1; } }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __nullmidi_h__ diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h index 4ac07cc15d..36d19f3da9 100644 --- a/libs/midi++2/midi++/parser.h +++ b/libs/midi++2/midi++/parser.h @@ -183,7 +183,7 @@ class Parser : public sigc::trackable { void process_mtc_quarter_frame (byte *msg); }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __midi_parse_h__ diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index 919afb3755..a706127eff 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -42,7 +42,7 @@ class Port : public sigc::trackable { ALSA_Sequencer, CoreMidi_MidiPort, Null, - FIFO, + FIFO }; Port (PortRequest &); @@ -152,7 +152,6 @@ class Port : public sigc::trackable { static size_t nports; }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __libmidi_port_h__ - diff --git a/libs/midi++2/midi++/port_request.h b/libs/midi++2/midi++/port_request.h index 28a0d1d70b..86838dd04d 100644 --- a/libs/midi++2/midi++/port_request.h +++ b/libs/midi++2/midi++/port_request.h @@ -54,7 +54,7 @@ struct PortRequest { const std::string &xtype); }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __midi_port_request_h__ diff --git a/libs/midi++2/midi++/types.h b/libs/midi++2/midi++/types.h index dc70381d5b..797c50a31b 100644 --- a/libs/midi++2/midi++/types.h +++ b/libs/midi++2/midi++/types.h @@ -59,10 +59,10 @@ namespace MIDI { enum MTC_Status { MTC_Stopped = 0, MTC_Forward, - MTC_Backward, + MTC_Backward }; -}; /* namespace MIDI */ +} // namespace MIDI #endif // __midi_types_h__ diff --git a/libs/midi++2/midicontrollable.cc b/libs/midi++2/midicontrollable.cc deleted file mode 100644 index bb98678854..0000000000 --- a/libs/midi++2/midicontrollable.cc +++ /dev/null @@ -1,326 +0,0 @@ -/* - Copyright (C) 1998-99 Paul Barton-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. - - $Id$ -*/ - -#include <cstdio> /* for sprintf, sigh */ -#include <pbd/error.h> -#include <midi++/port.h> -#include <midi++/channel.h> -#include <midi++/controllable.h> - -using namespace sigc; -using namespace MIDI; -using namespace PBD; - -Controllable::Controllable (Port *p, bool is_bistate) -{ - control_type = none; - _control_description = "MIDI Control: none"; - control_additional = (byte) -1; - bistate = is_bistate; - connections = 0; - feedback = true; // for now - - /* use channel 0 ("1") as the initial channel */ - - midi_rebind (p, 0); -} - -Controllable::~Controllable () -{ - drop_external_control (); -} - -void -Controllable::midi_forget () -{ - /* stop listening for incoming messages, but retain - our existing event + type information. - */ - - if (connections > 0) { - midi_sense_connection[0].disconnect (); - } - - if (connections > 1) { - midi_sense_connection[1].disconnect (); - } - - connections = 0; - midi_learn_connection.disconnect (); - -} - -void -Controllable::midi_rebind (Port *p, channel_t c) -{ - if ((port = p) == 0) { - midi_forget (); - } else { - if (c >= 0) { - bind_midi (c, control_type, control_additional); - } else { - midi_forget (); - } - } -} - -void -Controllable::learn_about_external_control () -{ - drop_external_control (); - - if (port) { - midi_learn_connection = port->input()->any.connect (mem_fun (*this, &Controllable::midi_receiver)); - learning_started (); - - } else { - info << "No MIDI port specified - external control disabled" << endmsg; - } -} - -void -Controllable::stop_learning () -{ - midi_learn_connection.disconnect (); -} - -void -Controllable::drop_external_control () -{ - if (connections > 0) { - midi_sense_connection[0].disconnect (); - } - if (connections > 1) { - midi_sense_connection[1].disconnect (); - } - - connections = 0; - midi_learn_connection.disconnect (); - - control_type = none; - control_additional = (byte) -1; -} - -void -Controllable::midi_sense_note_on (Parser &p, EventTwoBytes *tb) -{ - midi_sense_note (p, tb, true); -} - -void -Controllable::midi_sense_note_off (Parser &p, EventTwoBytes *tb) -{ - midi_sense_note (p, tb, false); -} - -void -Controllable::midi_sense_note (Parser &p, EventTwoBytes *msg, bool is_on) -{ - if (!bistate) { - set_value (msg->note_number/127.0); - } else { - - /* Note: parser handles the use of zero velocity to - mean note off. if we get called with is_on=true, then we - got a *real* note on. - */ - - if (msg->note_number == control_additional) { - set_value (is_on ? 1 : 0); - } - } -} - -void -Controllable::midi_sense_controller (Parser &, EventTwoBytes *msg) -{ - if (control_additional == msg->controller_number) { - if (!bistate) { - set_value (msg->value/127.0); - } else { - if (msg->value > 64.0) { - set_value (1); - } else { - set_value (0); - } - } - } -} - -void -Controllable::midi_sense_program_change (Parser &p, byte msg) -{ - /* XXX program change messages make no sense for bistates */ - - if (!bistate) { - set_value (msg/127.0); - } -} - -void -Controllable::midi_sense_pitchbend (Parser &p, pitchbend_t pb) -{ - /* pitchbend messages make no sense for bistates */ - - /* XXX gack - get rid of assumption about typeof pitchbend_t */ - - set_value ((pb/(float) SHRT_MAX)); -} - -void -Controllable::midi_receiver (Parser &p, byte *msg, size_t len) -{ - /* we only respond to channel messages */ - - if ((msg[0] & 0xF0) < 0x80 || (msg[0] & 0xF0) > 0xE0) { - return; - } - - /* if the our port doesn't do input anymore, forget it ... */ - - if (!port->input()) { - return; - } - - bind_midi ((channel_t) (msg[0] & 0xf), eventType (msg[0] & 0xF0), msg[1]); - - learning_stopped (); -} - -void -Controllable::bind_midi (channel_t chn, eventType ev, MIDI::byte additional) -{ - char buf[64]; - - drop_external_control (); - - control_type = ev; - control_channel = chn; - control_additional = additional; - - if (port == 0 || port->input() == 0) { - return; - } - - Parser& p = *port->input(); - - int chn_i = chn; - switch (ev) { - case MIDI::off: - midi_sense_connection[0] = p.channel_note_off[chn_i].connect - (mem_fun (*this, &Controllable::midi_sense_note_off)); - - /* if this is a bistate, connect to noteOn as well, - and we'll toggle back and forth between the two. - */ - - if (bistate) { - midi_sense_connection[1] = p.channel_note_on[chn_i].connect - (mem_fun (*this, &Controllable::midi_sense_note_on)); - connections = 2; - } else { - connections = 1; - } - _control_description = "MIDI control: NoteOff"; - break; - - case MIDI::on: - midi_sense_connection[0] = p.channel_note_on[chn_i].connect - (mem_fun (*this, &Controllable::midi_sense_note_on)); - if (bistate) { - midi_sense_connection[1] = p.channel_note_off[chn_i].connect - (mem_fun (*this, &Controllable::midi_sense_note_off)); - connections = 2; - } else { - connections = 1; - } - _control_description = "MIDI control: NoteOn"; - break; - - case MIDI::controller: - midi_sense_connection[0] = p.channel_controller[chn_i].connect - (mem_fun (*this, &Controllable::midi_sense_controller)); - connections = 1; - snprintf (buf, sizeof (buf), "MIDI control: Controller %d", control_additional); - _control_description = buf; - break; - - case MIDI::program: - if (!bistate) { - midi_sense_connection[0] = p.channel_program_change[chn_i].connect - (mem_fun (*this, - &Controllable::midi_sense_program_change)); - connections = 1; - _control_description = "MIDI control: ProgramChange"; - } - break; - - case MIDI::pitchbend: - if (!bistate) { - midi_sense_connection[0] = p.channel_pitchbend[chn_i].connect - (mem_fun (*this, &Controllable::midi_sense_pitchbend)); - connections = 1; - _control_description = "MIDI control: Pitchbend"; - } - break; - - default: - break; - } -} - -void -Controllable::set_control_type (channel_t chn, eventType ev, MIDI::byte additional) -{ - bind_midi (chn, ev, additional); -} - -bool -Controllable::get_control_info (channel_t& chn, eventType& ev, byte& additional) -{ - if (control_type == none) { - chn = -1; - return false; - } - - ev = control_type; - chn = control_channel; - additional = control_additional; - - return true; -} - - -void -Controllable::send_midi_feedback (float val, timestamp_t timestamp) -{ - byte msg[3]; - - if (port == 0 || control_type == none) { - return; - } - - msg[0] = (control_type & 0xF0) | (control_channel & 0xF); - msg[1] = control_additional; - msg[2] = (byte) (val * 127.0f); - - port->write (msg, 3, timestamp); -} - diff --git a/libs/midi++2/midiparser.cc b/libs/midi++2/midiparser.cc index 975a77a2c5..7c29478413 100644 --- a/libs/midi++2/midiparser.cc +++ b/libs/midi++2/midiparser.cc @@ -101,7 +101,7 @@ Parser::midi_event_type_name (eventType t) default: return "unknow MIDI event type"; } -}; +} Parser::Parser (Port &p) : _port (p) diff --git a/libs/pbd/pbd/basename.h b/libs/pbd/pbd/basename.h index 35aebe166c..a7e36acff0 100644 --- a/libs/pbd/pbd/basename.h +++ b/libs/pbd/pbd/basename.h @@ -8,6 +8,6 @@ namespace PBD extern std::string basename_nosuffix (const std::string&); -}; +} // namespace PBD #endif // __stupid_basename_h__ diff --git a/libs/pbd/pbd/rcu.h b/libs/pbd/pbd/rcu.h new file mode 100644 index 0000000000..6d9586cb3c --- /dev/null +++ b/libs/pbd/pbd/rcu.h @@ -0,0 +1,120 @@ +#ifndef __pbd_rcu_h__ +#define __pbd_rcu_h__ + +#include "boost/shared_ptr.hpp" +#include "glibmm/thread.h" + +#include <list> + +template<class T> +class RCUManager +{ +public: + + RCUManager (T* new_rcu_value) + : m_rcu_value(new_rcu_value) + { + + } + + virtual ~RCUManager() { } + + boost::shared_ptr<T> reader () const { return m_rcu_value; } + + // should be private + virtual boost::shared_ptr<T> write_copy () = 0; + + // should be private + virtual void update (boost::shared_ptr<T> new_value) = 0; + +protected: + + boost::shared_ptr<T> m_rcu_value; + + +}; + + +template<class T> +class SerializedRCUManager : public RCUManager<T> +{ +public: + + SerializedRCUManager(T* new_rcu_value) + : RCUManager<T>(new_rcu_value) + { + + } + + virtual boost::shared_ptr<T> write_copy () + { + m_lock.lock(); + + // I hope this is doing what I think it is doing :) + boost::shared_ptr<T> new_copy(new T(*RCUManager<T>::m_rcu_value)); + + // XXX todo remove old copies with only 1 reference from the list. + + return new_copy; + } + + virtual void update (boost::shared_ptr<T> new_value) + { + // So a current reader doesn't hold the only reference to + // the existing value when we assign it a new value which + // should ensure that deletion of old values doesn't + // occur in a reader thread. + boost::shared_ptr<T> old_copy = RCUManager<T>::m_rcu_value; + + // we hold the lock at this point effectively blocking + // other writers. + RCUManager<T>::m_rcu_value = new_value; + + + // XXX add the old value to the list of old copies. + + m_lock.unlock(); + } + +private: + Glib::Mutex m_lock; + + std::list<boost::shared_ptr<T> > m_old_values; +}; + +template<class T> +class RCUWriter +{ +public: + + RCUWriter(RCUManager<T>& manager) + : m_manager(manager) + { + m_copy = m_manager.write_copy(); + } + + ~RCUWriter() + { + // we can check here that the refcount of m_copy is 1 + + if(m_copy.use_count() == 1) { + m_manager.update(m_copy); + } else { + + // critical error. + } + + } + + // or operator boost::shared_ptr<T> (); + boost::shared_ptr<T> get_copy() { return m_copy; } + +private: + + RCUManager<T>& m_manager; + + // preferably this holds a pointer to T + boost::shared_ptr<T> m_copy; +}; + +#endif /* __pbd_rcu_h__ */ diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h index afb896e1d5..5dcb4f084a 100644 --- a/libs/pbd/pbd/xml++.h +++ b/libs/pbd/pbd/xml++.h @@ -37,7 +37,6 @@ private: string _filename; XMLNode *_root; int _compression; - bool _initialized; public: XMLTree(); @@ -45,9 +44,8 @@ public: XMLTree(const XMLTree *); ~XMLTree(); - bool initialized() const { return _initialized; }; XMLNode *root() const { return _root; }; - XMLNode *set_root(XMLNode *n) { _initialized = true; return _root = n; }; + XMLNode *set_root(XMLNode *n) { return _root = n; }; const string & filename() const { return _filename; }; const string & set_filename(const string &fn) { return _filename = fn; }; @@ -69,7 +67,6 @@ public: class XMLNode { private: - bool _initialized; string _name; bool _is_content; string _content; @@ -83,18 +80,17 @@ public: XMLNode(const XMLNode&); ~XMLNode(); - bool initialized() const { return _initialized; }; const string name() const { return _name; }; bool is_content() const { return _is_content; }; const string & content() const { return _content; }; - const string & set_content(const string &); + const string & set_content (const string &); XMLNode *add_content(const string & = string()); - const XMLNodeList & children(const string & = string()) const; - XMLNode *add_child(const char *); - XMLNode *add_child_copy(const XMLNode&); - void add_child_nocopy (XMLNode&); + const XMLNodeList & children (const string & = string()) const; + XMLNode *add_child (const char *); + XMLNode *add_child_copy (const XMLNode&); + void add_child_nocopy (XMLNode&); const XMLPropertyList & properties() const { return _proplist; }; XMLProperty *property(const char * ); diff --git a/libs/pbd/pool.cc b/libs/pbd/pool.cc index 089766482d..be8032b7b6 100644 --- a/libs/pbd/pool.cc +++ b/libs/pbd/pool.cc @@ -70,7 +70,7 @@ Pool::alloc () } else { return ptr; } -}; +} void Pool::release (void *ptr) diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc index 16aa528f59..786410e817 100644 --- a/libs/pbd/stateful.cc +++ b/libs/pbd/stateful.cc @@ -134,4 +134,3 @@ Stateful::instant_xml (const string& str, const string& dir) return 0; } - diff --git a/libs/pbd/whitespace.cc b/libs/pbd/whitespace.cc index 7f74940457..e35a8a8c0e 100644 --- a/libs/pbd/whitespace.cc +++ b/libs/pbd/whitespace.cc @@ -7,9 +7,11 @@ strip_whitespace_edges (string& str) { string::size_type i; string::size_type len; - string::size_type s; + string::size_type s; len = str.length(); + + /* strip front */ for (i = 0; i < len; ++i) { if (isgraph (str[i])) { @@ -17,14 +19,26 @@ strip_whitespace_edges (string& str) } } - s = i; + /* strip back */ + + if (len > 1) { + + s = i; + i = len - 1; + + do { + if (isgraph (str[i]) || i == 0) { + break; + } - for (i = len - 1; i >= 0; --i) { - if (isgraph (str[i])) { - break; - } - } + --i; + + } while (true); + + str = str.substr (s, (i - s) + 1); - str = str.substr (s, (i - s) + 1); + } else { + str = str.substr (s); + } } diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index e496d8b2fd..03fa116279 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -12,117 +12,112 @@ static void writenode(xmlDocPtr, XMLNode *, xmlNodePtr, int); XMLTree::XMLTree() : _filename(), - _root(), - _compression(0), - _initialized(false) + _root(0), + _compression(0) { } XMLTree::XMLTree(const string &fn) : _filename(fn), _root(0), - _compression(0), - _initialized(false) + _compression(0) { read(); } XMLTree::XMLTree(const XMLTree * from) { - _filename = from->filename(); - _root = new XMLNode(*from->root()); - _compression = from->compression(); - _initialized = true; + _filename = from->filename(); + _root = new XMLNode(*from->root()); + _compression = from->compression(); } XMLTree::~XMLTree() { - if (_initialized && _root) + if (_root) { delete _root; + } } int XMLTree::set_compression(int c) { - if (c > 9) - c = 9; - - if (c < 0) - c = 0; - - _compression = c; - - return _compression; + if (c > 9) { + c = 9; + } else if (c < 0) { + c = 0; + } + + _compression = c; + + return _compression; } bool XMLTree::read(void) { - xmlDocPtr doc; - - if (_root) { + xmlDocPtr doc; + + if (_root) { delete _root; _root = 0; - } - - xmlKeepBlanksDefault(0); - - doc = xmlParseFile(_filename.c_str()); - if (!doc) { - _initialized = false; - return false; - } - - _root = readnode(xmlDocGetRootElement(doc)); - xmlFreeDoc(doc); - _initialized = true; - - return true; + } + + xmlKeepBlanksDefault(0); + + doc = xmlParseFile(_filename.c_str()); + if (!doc) { + return false; + } + + _root = readnode(xmlDocGetRootElement(doc)); + xmlFreeDoc(doc); + + return true; } bool XMLTree::read_buffer(const string & buffer) { - xmlDocPtr doc; - - _filename = ""; - - if (_root) { + xmlDocPtr doc; + + _filename = ""; + + if (_root) { delete _root; _root = 0; - } - - doc = xmlParseMemory((char *) buffer.c_str(), buffer.length()); - if (!doc) { - _initialized = false; + } + + doc = xmlParseMemory((char *) buffer.c_str(), buffer.length()); + if (!doc) { return false; - } - - _root = readnode(xmlDocGetRootElement(doc)); - xmlFreeDoc(doc); - _initialized = true; - - return true; + } + + _root = readnode(xmlDocGetRootElement(doc)); + xmlFreeDoc(doc); + + return true; } bool XMLTree::write(void) const { - xmlDocPtr doc; - XMLNodeList children; - int result; - - xmlKeepBlanksDefault(0); - doc = xmlNewDoc((xmlChar *) "1.0"); - xmlSetDocCompressMode(doc, _compression); - writenode(doc, _root, doc->children, 1); - result = xmlSaveFormatFile(_filename.c_str(), doc, 1); - xmlFreeDoc(doc); - - if (result == -1) + xmlDocPtr doc; + XMLNodeList children; + int result; + + xmlKeepBlanksDefault(0); + doc = xmlNewDoc((xmlChar *) "1.0"); + xmlSetDocCompressMode(doc, _compression); + writenode(doc, _root, doc->children, 1); + result = xmlSaveFormatFile(_filename.c_str(), doc, 1); + xmlFreeDoc(doc); + + if (result == -1) { return false; - - return true; + } + + return true; } void @@ -142,105 +137,104 @@ XMLTree::debug(FILE* out) const const string & XMLTree::write_buffer(void) const { - static string retval; - char *ptr; - int len; - xmlDocPtr doc; - XMLNodeList children; - - xmlKeepBlanksDefault(0); - doc = xmlNewDoc((xmlChar *) "1.0"); - xmlSetDocCompressMode(doc, _compression); - writenode(doc, _root, doc->children, 1); - xmlDocDumpMemory(doc, (xmlChar **) & ptr, &len); - xmlFreeDoc(doc); - - retval = ptr; - - free(ptr); - - return retval; + static string retval; + char *ptr; + int len; + xmlDocPtr doc; + XMLNodeList children; + + xmlKeepBlanksDefault(0); + doc = xmlNewDoc((xmlChar *) "1.0"); + xmlSetDocCompressMode(doc, _compression); + writenode(doc, _root, doc->children, 1); + xmlDocDumpMemory(doc, (xmlChar **) & ptr, &len); + xmlFreeDoc(doc); + + retval = ptr; + + free(ptr); + + return retval; } XMLNode::XMLNode(const string & n) : _name(n), _is_content(false), _content(string()) { - - if (_name.empty()) - _initialized = false; - else - _initialized = true; } XMLNode::XMLNode(const string & n, const string & c) - :_name(string()), _is_content(true), _content(c) + :_name(n), _is_content(true), _content(c) { - _initialized = true; } XMLNode::XMLNode(const XMLNode& from) - : _initialized(false) { - XMLPropertyList props; - XMLPropertyIterator curprop; - XMLNodeList nodes; - XMLNodeIterator curnode; - - _name = from.name(); - set_content(from.content()); - - props = from.properties(); - for (curprop = props.begin(); curprop != props.end(); curprop++) - add_property((*curprop)->name().c_str(), (*curprop)->value()); - - nodes = from.children(); - for (curnode = nodes.begin(); curnode != nodes.end(); curnode++) + XMLPropertyList props; + XMLPropertyIterator curprop; + XMLNodeList nodes; + XMLNodeIterator curnode; + + _name = from.name(); + set_content(from.content()); + + props = from.properties(); + for (curprop = props.begin(); curprop != props.end(); ++curprop) { + add_property((*curprop)->name().c_str(), (*curprop)->value()); + } + + nodes = from.children(); + for (curnode = nodes.begin(); curnode != nodes.end(); ++curnode) { add_child_copy(**curnode); + } } XMLNode::~XMLNode() { - XMLNodeIterator curchild; - XMLPropertyIterator curprop; - - for (curchild = _children.begin(); curchild != _children.end(); - curchild++) + XMLNodeIterator curchild; + XMLPropertyIterator curprop; + + for (curchild = _children.begin(); curchild != _children.end(); ++curchild) { delete *curchild; - - for (curprop = _proplist.begin(); curprop != _proplist.end(); - curprop++) + } + + for (curprop = _proplist.begin(); curprop != _proplist.end(); ++curprop) { delete *curprop; + } } const string & XMLNode::set_content(const string & c) { - if (c.empty()) + if (c.empty()) { _is_content = false; - else + } else { _is_content = true; - - _content = c; - - return _content; + } + + _content = c; + + return _content; } const XMLNodeList & XMLNode::children(const string & n) const { - static XMLNodeList retval; - XMLNodeConstIterator cur; - - if (n.length() == 0) + static XMLNodeList retval; + XMLNodeConstIterator cur; + + if (n.length() == 0) { return _children; - - retval.erase(retval.begin(), retval.end()); - - for (cur = _children.begin(); cur != _children.end(); cur++) - if ((*cur)->name() == n) - retval.insert(retval.end(), *cur); - - return retval; + } + + retval.erase(retval.begin(), retval.end()); + + for (cur = _children.begin(); cur != _children.end(); ++cur) { + if ((*cur)->name() == n) { + retval.insert(retval.end(), *cur); + } + } + + return retval; } XMLNode * @@ -273,8 +267,10 @@ XMLProperty * XMLNode::property(const char * n) { string ns(n); - if (_propmap.find(ns) == _propmap.end()) + if (_propmap.find(ns) == _propmap.end()) { return 0; + } + return _propmap[ns]; } @@ -288,8 +284,9 @@ XMLNode::add_property(const char * n, const string & v) XMLProperty *tmp = new XMLProperty(ns, v); - if (!tmp) + if (!tmp) { return 0; + } _propmap[tmp->name()] = tmp; _proplist.insert(_proplist.end(), tmp); @@ -307,43 +304,43 @@ XMLNode::add_property(const char * n, const char * v) void XMLNode::remove_property(const string & n) { - if (_propmap.find(n) != _propmap.end()) { + if (_propmap.find(n) != _propmap.end()) { _proplist.remove(_propmap[n]); _propmap.erase(n); - } + } } void XMLNode::remove_nodes(const string & n) { - XMLNodeIterator i = _children.begin(); - XMLNodeIterator tmp; - - while (i != _children.end()) { - tmp = i; - ++tmp; - if ((*i)->name() == n) { - _children.erase (i); - } - i = tmp; - } + XMLNodeIterator i = _children.begin(); + XMLNodeIterator tmp; + + while (i != _children.end()) { + tmp = i; + ++tmp; + if ((*i)->name() == n) { + _children.erase (i); + } + i = tmp; + } } void XMLNode::remove_nodes_and_delete(const string & n) { - XMLNodeIterator i = _children.begin(); - XMLNodeIterator tmp; - - while (i != _children.end()) { - tmp = i; - ++tmp; - if ((*i)->name() == n) { - delete *i; - _children.erase (i); - } - i = tmp; - } + XMLNodeIterator i = _children.begin(); + XMLNodeIterator tmp; + + while (i != _children.end()) { + tmp = i; + ++tmp; + if ((*i)->name() == n) { + delete *i; + _children.erase (i); + } + i = tmp; + } } XMLProperty::XMLProperty(const string &n, const string &v) @@ -359,64 +356,65 @@ XMLProperty::~XMLProperty() static XMLNode * readnode(xmlNodePtr node) { - string name, content; - xmlNodePtr child; - XMLNode *tmp; - xmlAttrPtr attr; - - if (node->name) + string name, content; + xmlNodePtr child; + XMLNode *tmp; + xmlAttrPtr attr; + + if (node->name) { name = (char *) node->name; - - tmp = new XMLNode(name); - - for (attr = node->properties; attr; attr = attr->next) { + } + + tmp = new XMLNode(name); + + for (attr = node->properties; attr; attr = attr->next) { content = ""; - if (attr->children) - content = (char *) attr->children->content; + if (attr->children) { + content = (char *) attr->children->content; + } tmp->add_property((char *) attr->name, content); - } - - if (node->content) + } + + if (node->content) { tmp->set_content((char *) node->content); - else + } else { tmp->set_content(string()); - - for (child = node->children; child; child = child->next) - tmp->add_child_nocopy (*readnode(child)); - - return tmp; + } + + for (child = node->children; child; child = child->next) { + tmp->add_child_nocopy (*readnode(child)); + } + + return tmp; } static void -writenode(xmlDocPtr doc, XMLNode * n, xmlNodePtr p, int root = - 0) +writenode(xmlDocPtr doc, XMLNode * n, xmlNodePtr p, int root = 0) { - XMLPropertyList props; - XMLPropertyIterator curprop; - XMLNodeList children; - XMLNodeIterator curchild; - xmlNodePtr node; - - if (root) - node = doc->children = - xmlNewDocNode(doc, 0, (xmlChar *) n->name().c_str(), 0); - - else + XMLPropertyList props; + XMLPropertyIterator curprop; + XMLNodeList children; + XMLNodeIterator curchild; + xmlNodePtr node; + + if (root) { + node = doc->children = xmlNewDocNode(doc, 0, (xmlChar *) n->name().c_str(), 0); + } else { node = xmlNewChild(p, 0, (xmlChar *) n->name().c_str(), 0); - - if (n->is_content()) { + } + + if (n->is_content()) { node->type = XML_TEXT_NODE; - xmlNodeSetContentLen(node, (const xmlChar *) n->content().c_str(), - n->content().length()); - } - - props = n->properties(); - for (curprop = props.begin(); curprop != props.end(); curprop++) - xmlSetProp(node, (xmlChar *) (*curprop)->name().c_str(), - (xmlChar *) (*curprop)->value().c_str()); - - children = n->children(); - for (curchild = children.begin(); curchild != children.end(); - curchild++) + xmlNodeSetContentLen(node, (const xmlChar *) n->content().c_str(), n->content().length()); + } + + props = n->properties(); + for (curprop = props.begin(); curprop != props.end(); ++curprop) { + xmlSetProp(node, (xmlChar *) (*curprop)->name().c_str(), (xmlChar *) (*curprop)->value().c_str()); + } + + children = n->children(); + for (curchild = children.begin(); curchild != children.end(); ++curchild) { writenode(doc, *curchild, node); + } } diff --git a/libs/soundtouch/STTypes.h b/libs/soundtouch/STTypes.h index dc6a97001a..c404675ecd 100644 --- a/libs/soundtouch/STTypes.h +++ b/libs/soundtouch/STTypes.h @@ -105,6 +105,6 @@ namespace soundtouch #endif #endif // INTEGER_SAMPLES -}; +} #endif diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc index 10295bc698..dd9adc206e 100644 --- a/libs/surfaces/control_protocol/control_protocol.cc +++ b/libs/surfaces/control_protocol/control_protocol.cc @@ -49,7 +49,7 @@ void ControlProtocol::next_track (uint32_t initial_id) { uint32_t limit = session->nroutes(); - Route* cr = route_table[0]; + boost::shared_ptr<Route> cr = route_table[0]; uint32_t id; if (cr) { @@ -88,7 +88,7 @@ void ControlProtocol::prev_track (uint32_t initial_id) { uint32_t limit = session->nroutes() - 1; - Route* cr = route_table[0]; + boost::shared_ptr<Route> cr = route_table[0]; uint32_t id; if (cr) { @@ -128,29 +128,32 @@ void ControlProtocol::set_route_table_size (uint32_t size) { while (route_table.size() < size) { - route_table.push_back (0); + route_table.push_back (boost::shared_ptr<Route> ((Route*) 0)); } } void -ControlProtocol::set_route_table (uint32_t table_index, ARDOUR::Route*) +ControlProtocol::set_route_table (uint32_t table_index, boost::shared_ptr<ARDOUR::Route> r) { + if (table_index >= route_table.size()) { + return; + } + + route_table[table_index] = r; + + // XXX SHAREDPTR need to handle r->GoingAway } bool ControlProtocol::set_route_table (uint32_t table_index, uint32_t remote_control_id) { - if (table_index >= route_table.size()) { - return false; - } - - Route* r = session->route_by_remote_id (remote_control_id); + boost::shared_ptr<Route> r = session->route_by_remote_id (remote_control_id); if (!r) { return false; } - - route_table[table_index] = r; + + set_route_table (table_index, r); return true; } @@ -162,9 +165,9 @@ ControlProtocol::route_set_rec_enable (uint32_t table_index, bool yn) return; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; - AudioTrack* at = dynamic_cast<AudioTrack*>(r); + boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack>(r); if (at) { at->set_record_enable (yn, this); @@ -178,9 +181,9 @@ ControlProtocol::route_get_rec_enable (uint32_t table_index) return false; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; - AudioTrack* at = dynamic_cast<AudioTrack*>(r); + boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack>(r); if (at) { return at->record_enabled (); @@ -197,7 +200,7 @@ ControlProtocol::route_get_gain (uint32_t table_index) return 0.0f; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r == 0) { return 0.0f; @@ -213,7 +216,7 @@ ControlProtocol::route_set_gain (uint32_t table_index, float gain) return; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r != 0) { r->set_gain (gain, this); @@ -227,7 +230,7 @@ ControlProtocol::route_get_effective_gain (uint32_t table_index) return 0.0f; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r == 0) { return 0.0f; @@ -244,7 +247,7 @@ ControlProtocol::route_get_peak_input_power (uint32_t table_index, uint32_t whic return 0.0f; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r == 0) { return 0.0f; @@ -261,7 +264,7 @@ ControlProtocol::route_get_muted (uint32_t table_index) return false; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r == 0) { return false; @@ -277,7 +280,7 @@ ControlProtocol::route_set_muted (uint32_t table_index, bool yn) return; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r != 0) { r->set_mute (yn, this); @@ -292,7 +295,7 @@ ControlProtocol::route_get_soloed (uint32_t table_index) return false; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r == 0) { return false; @@ -308,7 +311,7 @@ ControlProtocol::route_set_soloed (uint32_t table_index, bool yn) return; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r != 0) { r->set_solo (yn, this); @@ -322,7 +325,7 @@ ControlProtocol:: route_get_name (uint32_t table_index) return ""; } - Route* r = route_table[table_index]; + boost::shared_ptr<Route> r = route_table[table_index]; if (r == 0) { return ""; diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index 2bd23f5b48..8be652b9df 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -25,6 +25,7 @@ #include <string> #include <vector> #include <list> +#include <boost/shared_ptr.hpp> #include <sigc++/sigc++.h> #include <pbd/stateful.h> #include <control_protocol/basic_ui.h> @@ -73,7 +74,7 @@ class ControlProtocol : public sigc::trackable, public Stateful, public BasicUI */ void set_route_table_size (uint32_t size); - void set_route_table (uint32_t table_index, ARDOUR::Route*); + void set_route_table (uint32_t table_index, boost::shared_ptr<ARDOUR::Route>); bool set_route_table (uint32_t table_index, uint32_t remote_control_id); void route_set_rec_enable (uint32_t table_index, bool yn); @@ -94,7 +95,7 @@ class ControlProtocol : public sigc::trackable, public Stateful, public BasicUI std::string route_get_name (uint32_t table_index); protected: - std::vector<ARDOUR::Route*> route_table; + std::vector<boost::shared_ptr<ARDOUR::Route> > route_table; std::string _name; bool _active; diff --git a/tools/.cvsignore b/tools/.cvsignore deleted file mode 100644 index 4149fafb53..0000000000 --- a/tools/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -ard_i18n -Makefile.in -Makefile diff --git a/tools/config.guess b/tools/config.guess index 78f6b92cd3..917bbc50f3 100755 --- a/tools/config.guess +++ b/tools/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2003-01-10' +timestamp='2005-07-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +17,15 @@ timestamp='2003-01-10' # # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner <per@bothner.com>. # Please send patches to <config-patches@gnu.org>. Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,7 +55,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -66,11 +68,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -106,6 +108,7 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; @@ -122,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -195,141 +198,109 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:MicroBSD:*:*) - echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - eval $set_cc_for_build - cat <<EOF >$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null - if test "$?" = 0 ; then - case `$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - 3-1307) - UNAME_MACHINE="alphaev7" - ;; - esac - fi - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -337,29 +308,32 @@ EOF else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -368,10 +342,10 @@ EOF esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -383,10 +357,10 @@ EOF echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -397,37 +371,40 @@ EOF # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -451,32 +428,33 @@ EOF exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -492,29 +470,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -522,7 +500,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -537,14 +515,18 @@ EOF exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then @@ -558,28 +540,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -641,9 +623,19 @@ EOF esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -651,11 +643,11 @@ EOF fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -683,147 +675,166 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; + exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 - exit 0 ;; + exit ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -841,7 +852,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -860,14 +871,14 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -881,7 +892,7 @@ EOF objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -889,22 +900,25 @@ EOF PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -922,15 +936,15 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -953,17 +967,23 @@ EOF LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -971,24 +991,27 @@ EOF # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -996,15 +1019,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` @@ -1022,73 +1046,73 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv32 fi - exit 0 ;; + exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp - exit 0 ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 - exit 0 ;; + exit ;; paragon:*:*:*) echo i860-intel-osf1 - exit 0 ;; + exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1096,68 +1120,73 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - case `uname -p` in + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1165,22 +1194,25 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1191,25 +1223,44 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1241,7 +1292,7 @@ main () #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1330,11 +1381,12 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1343,22 +1395,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1369,7 +1421,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/tools/osx_packaging/ardour2_mac_ui.rc b/tools/osx_packaging/ardour2_mac_ui.rc new file mode 100644 index 0000000000..fb739a94b7 --- /dev/null +++ b/tools/osx_packaging/ardour2_mac_ui.rc @@ -0,0 +1,1225 @@ +# +# This is the GTK style file for Ardour +# +# + +style "very_small_text" +{ + font_name = "sans 9" +} + +style "small_text" +{ + font_name = "sans 10" +} + +style "small_bold_text" +{ + font_name = "sans bold 10" +} + +style "medium_bold_text" +{ + font_name = "sans bold 11" +} + +style "medium_text" +{ + font_name = "sans 11" +} + +style "red_medium_text" = "medium_text" +{ + fg[NORMAL] = { 1.0, 0, 0 } + fg[ACTIVE] = { 1.0, 0, 0 } + fg[SELECTED] = { 1.0, 0, 0 } +} + + +style "large_text" +{ + font_name = "sans 18" +} + +style "larger_bold_text" +{ + font_name = "sans bold 14" +} + +style "plugin_name_text" +{ + font_name = "sans bold 25" + fg[NORMAL] = { 0.80, 0.80, 0.80 } +} + +style "plugin_maker_text" +{ + font_name = "sans bold 14" + fg[NORMAL] = { 0.80, 0.80, 0.80 } +} + +style "first_action_message" +{ + font_name = "sans medium 34" +} + +style "verbose_canvas_cursor" +{ + font_name = "sans bold 24" +} + +style "marker_text" +{ + font_name = "sans 9" +} + +style "time_axis_view_item_name" +{ + font_name = "sans medium 10" +} + +style "default_base" = "medium_text" +{ + GtkWidget::cursor_color = {1.0, 1.0, 1.0 } + GtkButton::default_border = { 0, 0, 0, 0 } + GtkButton::default_outside_border = { 0, 0, 0, 0 } + GtkTreeView::vertical-padding = 0 + GtkTreeView::horizontal-padding = 0 + + fg[NORMAL] = { 0.80, 0.80, 0.80 } + fg[ACTIVE] = { 0.80, 0.80, 0.80 } + fg[PRELIGHT] = { 1.0, 1.0, 1.0 } + fg[INSENSITIVE] = { 0.80, 0.80, 0.80 } + fg[SELECTED] = { 0.80, 0.80, 0.80 } + + bg[NORMAL] = { 0.40, 0.40, 0.40 } + bg[ACTIVE] = { 0.40, 0.40, 0.40 } + bg[PRELIGHT] = "#565690" + bg[INSENSITIVE] = { 0.10, 0.10, 0.10 } + bg[SELECTED] = { 0, 0.40, 0.60 } + + text[NORMAL] = { 0.80, 0.80, 0.80 } + text[ACTIVE] = { 0.80, 0.80, 0.80 } + text[PRELIGHT] = { 0.80, 0.80, 0.80 } + text[INSENSITIVE] = { 0.80, 0.80, 0.80} + text[SELECTED] = { 1.0, 1.0, 1.0 } + + base[ACTIVE] = "#2f272f" + base[NORMAL] = "#1c1e21" + base[PRELIGHT] = { 0.20, 0.20, 0.20 } + base[INSENSITIVE] = "#4c5159" + base[SELECTED] = { 0.25, 0.25, 0.25 } + + engine "clearlooks" { + menubarstyle = 2 # 0 = flat, 1 = sunken, 2 = flat gradient + menuitemstyle = 1 # 0 = flat, 1 = 3d-ish (gradient), 2 = 3d-ish (button) + listviewitemstyle = 1 # 0 = flat, 1 = 3d-ish (gradient) + progressbarstyle = 0 # 0 = candy bar, 1 = flat + } +} + +style "base_frame" +{ + fg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[NORMAL] = { 0.40, 0.40, 0.40 } +} + +style "transport_base" = "medium_bold_text" +{ + bg[NORMAL] = { 0.10, 0.10, 0.10 } + bg[ACTIVE] = { 0, 0, 0 } + bg[PRELIGHT] = { 0, 0, 0 } + bg[INSENSITIVE] = { 0, 0, 0 } + bg[SELECTED] = { 0, 0, 0 } +} + +style "black_mackie_menu_bar" = "medium_bold_text" +{ + font_name = "sans bold 12" + fg[NORMAL] = { 1.0, 1.0, 1.0 } + bg[NORMAL] = { 0, 0, 0 } +} + +style "default_buttons_menus" +{ + font_name = "sans 11" + fg[ACTIVE] = { 1.0, 1.0, 1.0 } + + bg[NORMAL] = { 0.35, 0.35, 0.35 } + bg[ACTIVE] = "#565690" + bg[PRELIGHT] = { 0.20, 0.20, 0.20 } + bg[INSENSITIVE] = { 0.20, 0.20, 0.20 } + bg[SELECTED] = { 0.20, 0.20, 0.20 } +} + +style "very_small_button" = "default_buttons_menus" +{ + font_name = "sans 8" + ythickness = 0 + xthickness = 0 +} + +style "small_button" = "default_buttons_menus" +{ +} + +style "very_small_red_active_and_selected_button" = "very_small_button" +{ + bg[ACTIVE] = { 1.0, 0, 0} + bg[SELECTED] = { 1.0, 0, 0} +} + +style "small_red_active_and_selected_button" = "small_button" +{ + fg[ACTIVE] = { 0, 0, 0 } + bg[ACTIVE] = { 1.0, 0, 0} + bg[SELECTED] = { 1.0, 0, 0} +} + +style "track_rec_enable_button" = "small_button" +{ + fg[SELECTED] = { 0.0, 0.0, 0.0 } + fg[ACTIVE] = { 0.0, 0.0, 0.0 } + fg[PRELIGHT] = { 0.0, 0.0, 0.0 } + + bg[SELECTED] = { 1.0, 0.0, 0.0 } + bg[ACTIVE] = { 0.91, 0.68, 0.68} + bg[PRELIGHT] = { 1.0, 0.0, 0.0 } +} + +style "mixer_rec_enable_button" = "track_rec_enable_button" +{ + font_name = "sans 8" + xthickness = 0 + ythickness = 0 +} + +style "solo_button" = "small_button" +{ + bg[PRELIGHT] = { 0, 1.0, 0 } + bg[ACTIVE] = { 0.66, 0.97, 0.19 } + + fg[PRELIGHT] = { 0, 0, 0 } + fg[ACTIVE] = { 0, 0, 0 } +} + +style "mixer_solo_button" = "solo_button" +{ + font_name = "sans 8" + xthickness = 0 + ythickness = 0 + +} + + +style "mute_button" = "small_button" +{ + bg[PRELIGHT] = { 1.0, 0.65, 0.13 } + bg[ACTIVE] = { 1.0, 0.98, 0.53 } + + fg[PRELIGHT] = { 0, 0, 0 } +} + +style "mixer_mute_button" = "mute_button" +{ + font_name = "sans 8" + xthickness = 0 + ythickness = 0 +} + +style "track_loop_button" = "small_button" +{ + bg[ACTIVE] = { 1.0, 0.98, 0.53 } + bg[PRELIGHT] = { 1.0, 0.98, 0.53 } + +} + +style "mixer_red_active_button" = "very_small_button" +{ + fg[ACTIVE] = { 0, 1.0, 1.0 } + bg[ACTIVE] = { 0.7, 0, 0 } + + base[INSENSITIVE] = { 0.21, 0.21, 0.21 } + bg[INSENSITIVE] = { 0.21, 0.21, 0.21 } +} + +style "time_button" = "default_buttons_menus" +{ + font_name = "sans 10" +} + +style "default_menus" = "default_buttons_menus" +{ + font_name = "sans 11" +} + +style "transport_button" +{ + font_name = "sans 9" + bg[ACTIVE] = { 0.50, 1.0, 0.50 } + fg[ACTIVE] = { 0, 0, 0 } +} + +style "transport_rec_button" +{ + bg[ACTIVE] = { 1.0, 0, 0 } + bg[PRELIGHT] = { 0.91, 0.68, 0.68 } #blinking rec button color +} + +style "shuttle_control" = "very_small_text" +{ + fg[NORMAL] = { 0.85, 0.92, 0.98 } + fg[ACTIVE] = { 0.85, 0.92, 0.98 } + fg[PRELIGHT] = { 0.85, 0.92, 0.98 } + fg[SELECTED] = { 0.85, 0.92, 0.98 } + fg[INSENSITIVE] = { 0.85, 0.92, 0.98 } + + bg[NORMAL] = { 0.31, 0.31, 0.31 } + bg[PRELIGHT] = { 0.31, 0.31, 0.31 } + bg[INSENSITIVE] = { 0.31, 0.31, 0.31 } + bg[ACTIVE] = { 0.50, 1.0, 0.50 } + bg[SELECTED] = { 1.0, 0.04, 0.04 } +} + +style "ardour_adjusters" = "default_buttons_menus" +{ + bg[NORMAL] = { 0.60, 0.60, 0.60 } + bg[PRELIGHT] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 0.06, 0.06, 0.06 } +} + +style "ardour_progressbars" = "default_buttons_menus" +{ + bg[NORMAL] = { 0, 0, 0 } + bg[PRELIGHT] = { 0.00, 0.36, 0.40 } +} + +style "options_window" = "default_base" +{ + font_name = "sans 11" + fg[PRELIGHT] = { 0.80, 0.80, 0.80 } +} + +style "option_entry" = "default_base" +{ + fg[NORMAL] = { 0.50, 1.0, 1.0 } + fg[ACTIVE] = { 0.50, 1.0, 1.0 } + fg[INSENSITIVE] = { 0.80, 0.80, 0.80 } + + base[INSENSITIVE] = { 0.12, 0.12, 0.12 } + + bg[NORMAL] = { 0.40, 0.40, 0.40 } + bg[ACTIVE] = { 0.40, 0.40, 0.40 } +} + +style "red_when_active" = "medium_text" +{ + fg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[NORMAL] = { 0.31, 0.31, 0.31 } + + fg[ACTIVE] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 1.0, 0, 0} +} + +style "xrun_warn" +{ + font_name = "sans bold 18" + + fg[NORMAL] = { 1.0, 1.0, 1.0 } + fg[ACTIVE] = { 1.0, 1.0, 1.0 } + text[NORMAL] = { 1.0, 1.0, 1.0 } + text[ACTIVE] = { 1.0, 1.0, 1.0 } + base[NORMAL] = { 0.09, 0.48, 0.46 } + base[ACTIVE] = { 0.09, 0.48, 0.46 } + bg[NORMAL] = { 1.0, 0.48, 0.46 } + bg[ACTIVE] = { 0.09, 1.0, 0.46 } +} + +style "menu_bar_base" +{ + bg[NORMAL] = { 0, 0, 0 } + bg[ACTIVE] = { 0, 0, 0 } + bg[PRELIGHT] = { 0, 0, 0 } + bg[INSENSITIVE] = { 0, 0, 0 } + bg[SELECTED] = { 0, 0, 0 } +} + +style "fatal_message" = "medium_text" +{ + fg[ACTIVE] = { 1.0, 0, 1.0 } + fg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 0,0,0 } + bg[NORMAL] = { 0,0,0 } + base[ACTIVE] = { 0,0,0 } + base[NORMAL] = { 0,0,0 } +} + +style "error_message" = "medium_text" +{ + fg[ACTIVE] = { 1.0, 0, 0 } + fg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 0,0,0 } + bg[NORMAL] = { 0,0,0 } + base[ACTIVE] = { 0,0,0 } + base[NORMAL] = { 0,0,0 } +} + +style "info_message" = "medium_text" +{ + fg[ACTIVE] = { 1.0, 0, 0 } + fg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 0,0,0 } + bg[NORMAL] = { 0,0,0 } + base[ACTIVE] = { 0,0,0 } + base[NORMAL] = { 0,0,0 } +} + +style "warning_message" = "medium_text" +{ + fg[ACTIVE] = { 0.30,0.30, 1.0 } + fg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 0, 0, 0 } + bg[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + base[NORMAL] = { 0, 0, 0 } +} + +style "medium_entry" = "medium_text" +{ + fg[NORMAL] = { 0.50, 1.0, 1.0 } + fg[ACTIVE] = { 0.50, 1.0, 1.0 } + fg[SELECTED] = { 0.50, 1.0, 0.50 } + + bg[NORMAL] = { 0.40, 0.40, 0.40 } + + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + base[SELECTED] = { 0.5, 0.5, 1.0 } +} + +style "medium_entry_noselection_fg" = "medium_entry" +{ + fg[SELECTED] = { 0.50, 1.0, 0.50 } +} + +style "medium_entry_noselection_bg" = "medium_entry" +{ + bg[SELECTED] = { 0.50, 1.0, 1.0 } +} + +style "medium_bold_entry" = "medium_bold_text" +{ + fg[NORMAL] = { 0.50, 1.0, 1.0 } + fg[ACTIVE] = { 0.50, 1.0, 1.0 } + + bg[NORMAL] = { 0.40, 0.40, 0.40 } + + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + base[SELECTED] = { 0, 0, 0 } +} + + +style "small_entry" = "small_text" +{ + fg[NORMAL] = { 0.50, 1.0, 1.0 } + fg[ACTIVE] = { 0.50, 1.0, 1.0 } + bg[NORMAL] = { 0.0, 0.0, 0.0 } + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + base[SELECTED] = { 0, 0, 0 } +} + +style "red_active_small_entry" = "small_entry" +{ + fg[ACTIVE] = { 1.0, 0.0, 0.0 } + fg[SELECTED] = { 1.0, 0, 0 } +} + +style "small_bold_entry" = "small_bold_text" +{ + fg[NORMAL] = { 0.50, 1.0, 1.0 } + fg[ACTIVE] = { 0.50, 1.0, 1.0 } + + bg[NORMAL] = { 0.40, 0.40, 0.40 } + + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + base[SELECTED] = { 0, 0, 0 } +} + +style "small_red_on_black_entry" = "small_bold_text" +{ + fg[NORMAL] = { 1.0, 0, 0 } + fg[ACTIVE] = { 1.0, 0, 0 } + base[NORMAL] = { 0.0, 0.0, 0.0 } + base[ACTIVE] = { 0.0, 0.0, 0.0 } + bg[NORMAL] = { 0.0, 0.0, 0.0 } + bg[ACTIVE] = { 0.0, 0.0, 0.0 } +} + +style "big_clock_display" = "medium_entry" +{ + font_name = "courier bold 34" +} + +style "transport_clock_display" +{ + font_name = "sans bold 14" + + fg[NORMAL] = { 0.50, 1.0, 0.50 } + fg[ACTIVE] = { 1.0, 0, 0.0 } + fg[SELECTED] = { 1.0, 0, 0 } + fg[PRELIGHT] = { 1.0, 0, 0.0 } + fg[INSENSITIVE] = { 1.0, 0, 0.0 } + + base[NORMAL] = { 0.0, 0.0, 0.0 } + base[ACTIVE] = { 0.0, 0.0, 0.0 } + bg[NORMAL] = { 0.0, 0.0, 0.0 } + bg[ACTIVE] = { 0.0, 0.0, 0.0 } +} + +style "tempo_meter_clock_display" +{ + font_name = "sans 9" + fg[NORMAL] = { 1.0, 1.0, 1.0 } + fg[ACTIVE] = { 1.0, 1.0, 0.0 } + fg[SELECTED] = { 1.0, 0, 0 } + base[NORMAL] = { 0.0, 0.48, 1.0 } + base[ACTIVE] = { 0.09, 0.98, 0.46 } + bg[NORMAL] = { 0.0, 0.48, 1.0 } + bg[ACTIVE] = { 0.09, 0.98, 0.46 } +} + +style "default_clock_display" = "medium text" +{ + font_name = "sans 10" + fg[NORMAL] = { 0.50, 1.0, 0.50 } + fg[ACTIVE] = { 1.0, 0.0, 0.0 } + fg[SELECTED] = { 1.0, 0, 0 } + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + bg[NORMAL] = { 0, 0, 0 } + bg[ACTIVE] = { 0, 0, 0 } +} + +style "editor_time_ruler" = "small_text" +{ + fg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[NORMAL] = { 0.09, 0.09, 0.09 } +} + +style "audio_track_base" = "default_base" +{ + font_name = "sans 8" + fg[NORMAL] = { 0.77, 0.77, 0.72 } + bg[NORMAL] = { 0.18, 0.18, 0.22 } + bg[ACTIVE] = { 0.20, 0.20, 0.20 } + bg[PRELIGHT] = { 0.20, 0.20, 0.20 } + bg[INSENSITIVE] = { 0.20, 0.20, 0.20 } + bg[SELECTED] = { 0.20, 0.20, 0.20 } +} + +style "audio_bus_base" +{ + font_name = "sans 8" + fg[NORMAL] = { 0.77, 0.77, 0.72 } + fg[NORMAL] = { 0.7, 0.8, 0.2 } + #bg[NORMAL] = {0, 0.36, 0.40 } + bg[NORMAL] = "#464666" +} + +style "track_name_display" +{ + font_name = "sans medium 11" + fg[NORMAL] = { 0.80, 0.80, 0.80 } + fg[ACTIVE] = { 0.80, 0.80, 0.80 } + + base[NORMAL] = { 0.06, 0.06, 0.06 } + base[ACTIVE] = { 0.26, 0.26, 0.26 } + bg[NORMAL] = { 0.26, 0.26, 0.26 } + bg[ACTIVE] = { 0.26, 0.26, 0.26 } +} + +style "active_track_name_display" +{ + font_name = "sans medium 11" + text[NORMAL] = { 0.26, 0.26, 0.26 } + base[NORMAL] = { 0.89, 0.89, 0.89 } +} + +style "track_separator" +{ + bg[NORMAL] = { 0.40, 0.40, 0.40 } +} + +# +# Track edit groups. These styles define +# the colors that the "edit" button will +# use as a track is moved from +# track edit group to track edit group. +# There are 8 edit groups. Edit group 0 +# is used for tracks that are not editable, +# so we leave its style to the default. +# + +style "edit_group_0" + +{ + bg[ACTIVE] = { 1.0, 0.65, 0.13 } + bg[NORMAL] = { 0.31, 0.31, 0.31 } + fg[NORMAL] = { 0.82, 0.91, 0.99 } + fg[ACTIVE] = { 0, 0, 0 } +} + +style "edit_group_1" +{ + fg[NORMAL] = { 0, 0, 0 } + fg[PRELIGHT] = { 0, 0, 0 } + fg[SELECTED] = { 0, 0, 0 } + bg[NORMAL] = { 0.93, 0.34, 0.08 } + bg[PRELIGHT] = { 0.93, 0.34, 0.08 } + bg[SELECTED] = { 0.93, 0.34, 0.08 } +} + +style "edit_group_2" +{ + fg[NORMAL] = { 0, 0, 0 } + fg[PRELIGHT] = { 0, 0, 0 } + fg[SELECTED] = { 0, 0, 0 } + bg[NORMAL] = { 0.93, 0.34, 0.08 } + bg[PRELIGHT] = { 0.93, 0.34, 0.08 } + bg[SELECTED] = { 0.93, 0.34, 0.08 } +} + +style "edit_group_3" +{ + fg[NORMAL] = { 0, 0, 0 } + fg[PRELIGHT] = { 0, 0, 0 } + fg[SELECTED] = { 0, 0, 0 } + bg[NORMAL] = { 0.93, 0.34, 0.08 } + bg[PRELIGHT] = { 0.93, 0.34, 0.08 } + bg[SELECTED] = { 0.93, 0.34, 0.08 } +} + +style "region_list_display" = "small_bold_text" +{ + fg[NORMAL] = { 0.80, 0.80, 0.80 } + fg[ACTIVE] = { 0.80, 0.80, 0.80 } + fg[SELECTED] = { 0.50, 1.0, 1.0 } + bg[NORMAL] = { 0, 0, 0 } + bg[ACTIVE] = { 0, 0, 0 } + bg[SELECTED] = { 0, 0, 0 } + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 1, 0 } + base[INSENSITIVE] = { 0, 0, 0 } + base[SELECTED] = { 0.80, 0.80, 0.80 } +} + +style "main_canvas_area" +{ + bg[NORMAL] = { 0.38, 0.38, 0.38 } + bg[ACTIVE] = { 0.38, 0.38, 0.38 } + bg[INSENSITIVE] = { 0.38, 0.38, 0.38 } + bg[SELECTED] = { 0.38, 0.38, 0.38 } + bg[PRELIGHT] = { 0.38, 0.38, 0.38 } +} + +style "track_controls_inactive" +{ + bg[NORMAL] = { 0.60, 0.60, 0.66 } + bg[ACTIVE] = { 0.60, 0.60, 0.66 } + bg[INSENSITIVE] = { 0.60, 0.60, 0.66 } + bg[SELECTED] = { 0.60, 0.60, 0.66 } + bg[PRELIGHT] = { 0.60, 0.60, 0.66 } + + font_name = "sans medium 10" + fg[NORMAL] = { 0.7, 0.8, 0.2 } +} + +style "edit_controls_base_selected" +{ + bg[NORMAL] = { 0.56, 0.56, 0.56 } + bg[ACTIVE] = { 0.56, 0.56, 0.56 } + bg[INSENSITIVE] = { 0.56, 0.56, 0.56 } + bg[SELECTED] = { 0.56, 0.56, 0.56 } + bg[PRELIGHT] = { 0.56, 0.56, 0.56 } +} + +style "automation_track_controls_base" +{ + bg[NORMAL] = { 0.22, 0.22, 0.29 } + bg[ACTIVE] = { 0.22, 0.22, 0.29 } + bg[INSENSITIVE] = { 0.22, 0.22, 0.29 } + bg[SELECTED] = { 0.22, 0.22, 0.29 } + bg[PRELIGHT] = { 0.22, 0.22, 0.29 } +} + +# Plugin Editors +style "plugin_slider" +{ + font_name ="sans bold 10" + + # the slider itself. the inactive part is INSENSITIVE, + # the active part is something else. + + fg[NORMAL] = { 0.37, 0.43, 0.52 } + fg[ACTIVE] = { 0.37, 0.43, 0.52 } + fg[INSENSITIVE] = {0.40, 0.40, 0.40 } # matches default_base + fg[SELECTED] = { 0.37, 0.43, 0.52 } + fg[PRELIGHT] = { 0.37, 0.43, 0.52 } + + # draws the outer rectangle around the slider + + bg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 0.80, 0.80, 0.80 } + bg[INSENSITIVE] = {0.80, 0.80, 0.80 } + bg[SELECTED] = { 0.80, 0.80, 0.80 } + bg[PRELIGHT] = { 0.80, 0.80, 0.80 } + + # the numeric display + + text[NORMAL] = { 0.80, 0.80, 0.80 } + text[ACTIVE] = { 0.80, 0.80, 0.80 } + text[INSENSITIVE] = { 0.80, 0.80, 0.80 } + text[SELECTED] = { 0.80, 0.80, 0.80 } + text[PRELIGHT] = { 0.80, 0.80, 0.80 } +} + +style "track_list_display" = "small_bold_text" +{ + text[NORMAL] = { 0.80, 0.80, 0.80 } + text[ACTIVE] = { 0.3, 0.3, 0.3 } + text[INSENSITIVE] = { 0, 0, 0 } + text[SELECTED] = { 0.8, 0.8, 0.8 } + + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + base[INSENSITIVE] = { 0, 0, 0 } + base[SELECTED] = { 0, 0, 0 } +} + +style "inspector_track_list_display" = "track_list_display" +{ + text[ACTIVE] = { 0.8, 0.8, 0.8 } + + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0.2, 0.2, 0.2 } + base[INSENSITIVE] = { 0, 0, 0 } + base[SELECTED] = { 0.3, 0.3, 0.4 } +} + +style "redirect_list_display" +{ + GtkTreeView::horizontal-separator = 0 + GtkTreeView::vertical-separator = 0 + + font_name = "sans 10" + text[NORMAL] = { 0.80, 0.80, 0.80 } + text[ACTIVE] = { 0.5, 0.5, 0.9 } + text[INSENSITIVE] = { 0, 0, 0 } + text[SELECTED] = { 0.9, 0.3, 0.3 } + + base[NORMAL] = { 0, 0, 0 } + base[ACTIVE] = { 0, 0, 0 } + base[INSENSITIVE] = { 0, 0, 0 } + base[SELECTED] = { 0, 0, 0 } + + # these two are explicitly used by the cell renderer for the + # text + + fg[NORMAL] = { 0.5, 0.5, 0.5 } # used for inactive + fg[ACTIVE] = { 0.5, 1.0, 1.0 } # used for active +} + +style "inspector_redirect_list_display" = "redirect_list_display" +{ + base[SELECTED] = { 0.3, 0.3, 0.3 } +} + +# MixerPanZone: +# +# the NORMAL fg color is used for the pan puck +# the ACTIVE fg color is used for the speaker boxes + +style "pan_zone" = "default_base" +{ + fg[NORMAL] = { 0.34, 0.95, 0.92 } + fg[ACTIVE] = { 0.95, 0.48, 0.11 } +} + +style "wall_clock" = "medium_bold_text" +{ + fg[NORMAL] = { 1.0, 1.0, 1.0 } + bg[NORMAL] = { 0, 0, 0 } +} + +style "paler_red_when_active" = "medium_text" +{ + fg[NORMAL] = { 0.80, 0.80, 0.80 } + fg[PRELIGHT] = { 0.80, 0.80, 0.80 } + bg[NORMAL] = { 0.31, 0.31, 0.31 } + bg[PRELIGHT] = { 0.31, 0.31, 0.31 } + + fg[ACTIVE] = { 0.36, 0.46, 0.28 } + bg[ACTIVE] = { 1.00, 0.59, 0.59} +} + +style "peak_display_peaked_entry" = "small_text" +{ + fg[NORMAL] = { 1.0, 1.0, 1.0 } + fg[ACTIVE] = { 1.0, 1.0, 1.0 } + fg[SELECTED] = { 1.0, 1.0, 1.0 } + + bg[NORMAL] = {0.9, 0.0, 0.0 } + bg[ACTIVE] = { 0.9, 0.0, 0.0 } + bg[PRELIGHT] = { 0.9, 0.0, 0.0 } + bg[INSENSITIVE] = { 0.9, 0.0, 0.0 } + bg[SELECTED] = { 0.9, 0.0, 0.0 } + base[NORMAL] = { 0.9, 0.0, 0.0 } + base[ACTIVE] = { 0.9, 0.0, 0.0 } + base[PRELIGHT] = { 0.9, 0.0, 0.0 } + base[INSENSITIVE] = { 0.9, 0.0, 0.0 } + base[SELECTED] = { 0.9, 0.0, 0.0 } +} + +style "selected_strip_frame" +{ + fg[NORMAL] = { 0.74, 0.42, 0.47 } + bg[NORMAL] = { 0.79, 0.28, 0.18 } +} + +style "flashing_alert" = "very_small_text" +{ + fg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[NORMAL] = { 0.31, 0.31, 0.31 } + + fg[ACTIVE] = { 0.80, 0.80, 0.80 } + bg[ACTIVE] = { 1.0, 0, 0} +} + +style "selected_io_selector_port_list" = "medium_text" +{ + fg[NORMAL] = { 0.50, 1.0, 1.0 } + fg[SELECTED] = { 0.50, 1.0, 1.0 } + base[NORMAL] = { 0, 0, 0 } + base[SELECTED] = { 0, 0, 0 } +} + +style "io_selector_port_list" = "medium_text" +{ + fg[NORMAL] = {0.80, 0.80, 0.70 } + fg[SELECTED] = {0.80, 0.80, 0.70 } + base[NORMAL] = { 0.26, 0.26, 0.26 } + base[SELECTED] = { 0.26, 0.26, 0.26 } +} + +style "io_selector_notebook" = "default_base" +{ + fg[NORMAL] = { 0.50, 1.0, 1.0 } + font_name ="sans bold 10" +} + +style "tearoff_arrow" = "medium_bold_entry" +{ + fg[NORMAL] = { 0.80, 0.80, 0.80 } + fg[PRELIGHT] = { 0.80, 0.80, 0.80 } + bg[NORMAL] = { 0.80, 0.80, 0.80 } + bg[PRELIGHT] = { 0.80, 0.80, 0.80 } +} + +style "meter_metrics_strip" = "default_base" +{ + font_name = "sans 5" + fg[NORMAL] = { 1.0, 0.8, 0.2 } +} + +style "location_row_button" = "default_buttons_menus" +{ + font_name = "sans 10" +} + +style "location_rows_clock" = "default_clock_display" +{ + font_name = "sans 12" +} + +style "pan_slider" +{ + font_name = "sans 8" + + fg[NORMAL] = { 0.67, 0.23, 0.22 } + fg[ACTIVE] = { 0.67, 0.23, 0.22 } + fg[INSENSITIVE] = {0.32, 0.39, 0.45 } # matches default_base + fg[SELECTED] = { 0.67, 0.23, 0.22 } + fg[PRELIGHT] = { 0.67, 0.23, 0.22 } + + bg[NORMAL] = { 0, 0, 0 } + bg[ACTIVE] = { 0, 0, 0 } + bg[INSENSITIVE] = {0.32, 0.39, 0.45 } # matches default_base + bg[SELECTED] = { 0, 0, 0 } + bg[PRELIGHT] = { 0, 0, 0 } + + text[NORMAL] = { 0.85, 0.92, 0.98 } + text[ACTIVE] = { 0.85, 0.92, 0.98 } + text[INSENSITIVE] = { 0.85, 0.92, 0.98 } + text[SELECTED] = { 0.85, 0.92, 0.98 } + text[PRELIGHT] = { 0.85, 0.92, 0.98 } +} + +style "region_list_whole_file" +{ + fg[NORMAL] = { 0.4, 0.4, 0.9 } +} + +style "ardour_button" ="default_buttons_menus" +{ + xthickness = 1 + ythickness = 1 +} + +#--------------------------------------------------------------- +widget "*FirstActionMessage" style "first_action_message" +widget "*VerboseCanvasCursor" style "verbose_canvas_cursor" +widget "*MarkerText" style "marker_text" +widget "*TimeAxisViewItemName" style "time_axis_view_item_name" +#widget "*ExportProgress" style "default_buttons_menus" +widget "*ExportFileLabel" style "small_bold_text" +widget "*ExportFormatLabel" style "medium_bold_text" +widget "*ExportHeader" style "small_bold_text" +widget "*ExportFileDisplay" style "medium_entry" +widget "*ExportFormatDisplay" style "medium_entry" +widget "*ExportCheckbox" style "small_entry" +widget "*ExportTrackSelector*" style "medium_entry_noselection_bg" +widget "*EditModeSelector" style "medium_bold_entry" +widget "*SnapTypeSelector" style "medium_bold_entry" +widget "*SnapModeSelector" style "medium_bold_entry" +widget "*ZoomFocusSelector" style "medium_bold_entry" +widget "*ArdourContextMenu*" style "default_menus" +widget "*EditGroupTitleButton*" style "default_buttons_menus" +widget "*MixerGroupTitleButton*" style "default_buttons_menus" +widget "*ErrorLogCloseButton" style "default_buttons_menus" +widget "*EditorGTKButton*" style "default_buttons_menus" +widget "*ToolbarButton" style "default_buttons_menus" +widget "*ToolbarButton*" style "default_buttons_menus" +widget "*CrossfadeEditButton" style "default_buttons_menus" +widget "*CrossfadeEditButton*" style "default_buttons_menus" +widget "*TrackHistoryButton*" style "default_buttons_menus" +widget "*TrackSizeButton*" style "default_buttons_menus" +widget "*TrackPlaylistButton*" style "default_buttons_menus" +widget "*TrackAutomationButton*" style "default_buttons_menus" +widget "*TrackGroupButton*" style "default_buttons_menus" +widget "*TrackMixButton*" style "default_buttons_menus" +widget "*TrackVisualButton*" style "default_buttons_menus" +widget "*TrackRemoveButton*" style "default_buttons_menus" +widget "*BaseButton" style "default_buttons_menus" +widget "*TakeButtonLabel" style "default_buttons_menus" +widget "*MixerWidthButton" style "default_buttons_menus" +widget "*MixerHideButton" style "default_buttons_menus" +widget "*MixerSendButton" style "default_buttons_menus" +widget "*MixerSendButtonLabel" style "default_buttons_menus" +widget "*MixerSendSwitch" style "default_buttons_menus" +widget "*MixerInsertButton" style "default_buttons_menus" +widget "*MixerInsertButtonLabel" style "default_buttons_menus" +widget "*MixerInsertSwitch" style "default_buttons_menus" +widget "*MixerMonitorInputButton*" style "very_small_button" +widget "*MixerMonitorInputButton.*" style "very_small_button" +widget "*MixerIOButton" style "very_small_button" +widget "*MixerIOButtonLabel" style "very_small_button" +widget "*AddRouteDialogSpinner" style "ardour_adjusters" +widget "*AddRouteDialogRadioButton*" style "options_window" +widget "*OptionsNotebook" style "options_window" +widget "*OptionEditorToggleButton*" style "options_window" +widget "*OptionsLabel" style "options_window" +widget "*OptionEditorAuditionerLabel" style "options_window" +widget "*OptionsEntry" style "option_entry" +widget "*InspectorNotebook" style "options_window" +widget "*NewSessionDialog" style "options_window" +widget "*NewSessionDialogButton*" style "options_window" +widget "*MixerSendSwitch*" style "very_small_red_active_and_selected_button" +widget "*OptionEditorToggleButton" style "small_red_active_and_selected_button" +widget "*NewSessionDialogButton" style "small_red_active_and_selected_button" +widget "*MixerRecordEnableButton" style "mixer_rec_enable_button" +widget "*MixerRecordEnableButton*" style "mixer_rec_enable_button" +widget "*TrackRecordEnableButton" style "track_rec_enable_button" +widget "*TrackRecordEnableButton*" style "track_rec_enable_button" +widget "*TrackMuteButton*" style "mute_button" +widget "*TrackLoopButton*" style "track_loop_button" +widget "*EditorTimeButton*" style "time_button" +widget "*EditorMixerButton*" style "default_buttons_menus" +widget "*SoloButton*" style "solo_button" +widget "*SoloButton.*" style "solo_button" +widget "*SafeSoloButton*" style "solo_button" +widget "*SafeSoloButton.*" style "solo_button" +widget "*MixerPhaseInvertButton*" style "very_small_button" +widget "*MixerPhaseInvertButton.*" style "very_small_button" +widget "*MixerAutomationRecordingButton*" style "very_small_button" +widget "*MixerAutomationRecordingButton.*" style "very_small_button" +widget "*MixerAutomationModeButton*" style "very_small_button" +widget "*MixerAutomationModeButton.*" style "very_small_button" +widget "*MixerAutomationPlaybackButton*" style "very_small_button" +widget "*MixerAutomationPlaybackButton.*" style "very_small_button" +widget "*MixerMuteButton*" style "mixer_mute_button" +widget "*MixerMuteButton.*" style "mixer_mute_button" +widget "*MixerSoloButton*" style "mixer_solo_button" +widget "*MixerSoloButton.*" style "mixer_solo_button" +widget "*MixerNameButton" style "very_small_button" +widget "*MixerNameButtonLabel" style "very_small_button" +widget "*MixerGroupButton" style "very_small_button" +widget "*MixerGroupButtonLabel" style "very_small_button" +widget "*MixerCommentButton" style "very_small_button" +widget "*MixerCommentButton*" style "very_small_button" +widget "*EditGroupButton" style "very_small_button" +widget "*EditGroupButtonLabel" style "very_small_button" +widget "*TransportButton" style "transport_button" +widget "*TransportButton*" style "transport_button" +widget "*ShuttleButton" style "transport_button" +widget "*ShuttleButton*" style "transport_button" +widget "*ShuttleDisplay" style "transport_button" +widget "*ShuttleDisplay*" style "transport_button" +widget "*ShuttleControl" style "shuttle_control" +widget "*TransportRecButton" style "transport_rec_button" +widget "*TransportRecButton*" style "transport_rec_button" +widget "*RecordingXrunWarningWindow" style "xrun_warn" +widget "*RecordingXrunWarningWindow*" style "xrun_warn" +widget "*MainMenuBar" style "menu_bar_base" +widget "*ErrorMessage" style "error_message" +widget "*FatalMessage" style "fatal_message" +widget "*InfoMessage" style "info_message" +widget "*WarningMessage" style "warning_message" +widget "*BigClockDisplay" style "big_clock_display" +widget "*TransportClockDisplay" style "transport_clock_display" +widget "*SecondaryClockDisplay" style "transport_clock_display" +widget "*BBTTempoLabel" style "tempo_meter_clock_display" +widget "*BBTMeterLabel" style "tempo_meter_clock_display" +widget "*SelectionStartClock" style "default_clock_display" +widget "*SelectionEndClock" style "default_clock_display" +widget "*EditCursorClock" style "default_clock_display" +widget "*PreRollClock" style "default_clock_display" +widget "*PostRollClock" style "default_clock_display" +widget "*NudgeClock" style "default_clock_display" +widget "*ZoomRangeClock" style "default_clock_display" +widget "*SMPTEOffsetClock" style "default_clock_display" +widget "*TransportLabel" style "small_bold_text" +widget "*TakeLabel" style "small_bold_text" +widget "*LocationLabel" style "small_bold_text" +widget "*WipeLabel" style "small_bold_text" +widget "*TakeTagLabel" style "small_bold_text" +widget "*ToolBarLabel" style "small_bold_text" +widget "*EditorDisplayLabel" style "small_bold_text" +widget "*NewSessionLabel" style "large_text" +widget "*GlobalButtonLabel" style "default_buttons_menus" +widget "*ClickButton" style "medium_entry" +widget "*RegionNameDisplay" style "medium_entry" +widget "*PluginDisplay" style "medium_entry" +widget "*SelectionDisplay" style "medium_entry" +widget "*HistorySelector" style "medium_entry" +widget "*LocationSelector" style "medium_entry" +widget "*TakeSelector" style "medium_entry" +widget "*RegionSelector" style "medium_entry" +widget "*SMPTERuler" style "editor_time_ruler" +widget "*BBTRuler" style "editor_time_ruler" +widget "*FramesRuler" style "editor_time_ruler" +widget "*MinSecRuler" style "editor_time_ruler" +widget "*BaseFrame" style "base_frame" +widget "*AudioTrackStripBase" style "audio_track_base" +widget "*TimeAxisViewControlsBaseUnselected" style "audio_track_base" +widget "*AudioTrackControlsBaseUnselected" style "audio_track_base" +widget "*AudioTrackFader" style "audio_track_base" +widget "*AudioBusStripBase" style "audio_bus_base" +widget "*BusControlsBaseUnselected" style "audio_bus_base" +widget "*AudioBusFader" style "audio_bus_base" +widget "*TrackSeparator" style "track_separator" +widget "*TrackEditIndicator0*" style "edit_group_0" +widget "*TrackEditIndicator1*" style "edit_group_1" +widget "*TrackEditIndicator2*" style "edit_group_2" +widget "*TrackEditIndicator3*" style "edit_group_3" +widget "*TrackEditIndicator4*" style "edit_group_3" +widget "*TrackEditIndicator5*" style "edit_group_3" +widget "*TrackEditIndicator6*" style "edit_group_3" +widget "*TrackEditIndicator7*" style "edit_group_3" +widget "*EditorTrackNameDisplay" style "track_name_display" +widget "*EditorTrackNameDisplay*" style "track_name_display" +widget "*EditorActiveTrackNameDisplay" style "active_track_name_display" +widget "*EditorActiveTrackNameDisplay*" style "active_track_name_display" +widget "*EditorRegionList" style "region_list_display" +widget "*CrossfadeEditAuditionButton" style "red_when_active" +widget "*CrossfadeEditAuditionButton*" style "red_when_active" +widget "*CrossfadeEditCurveButton" style "red_when_active" +widget "*CrossfadeEditCurveButton*" style "red_when_active" +widget "*CrossfadeEditLabel" style "medium_text" +widget "*CrossfadeEditFrame" style "base_frame" +widget "*MouseModeButton" style "default_buttons_menus" +widget "*MouseModeButton*" style "default_buttons_menus" +widget "*EditorMainCanvas" style "main_canvas_area" +widget "*AudioTrackControlsBaseInactiveUnselected" style "track_controls_inactive" +widget "*BusControlsBaseInactiveUnselected" style "track_controls_inactive" +widget "*AutomationTrackControlsBaseInactiveUnselected" style "track_controls_inactive" +widget "*AudioTrackControlsBaseInactiveSelected" style "track_controls_inactive" +widget "*BusControlsBaseInactiveSelected" style "track_controls_inactive" +widget "*AutomationTrackControlsBaseInactiveSelected" style "track_controls_inactive" +widget "*AudioTrackStripBaseInactive" style "track_controls_inactive" +widget "*AudioBusStripBaseInactive" style "track_controls_inactive" +widget "*AudioTrackControlsBaseSelected" style "edit_controls_base_selected" +widget "*BusControlsBaseSelected" style "edit_controls_base_selected" +widget "*AutomationTrackControlsBase" style "automation_track_controls_base" +widget "*AutomationTrackControlsBaseSelected" style "edit_controls_base_selected" +widget "*EditorMenuBar*" style "black_mackie_menu_bar" +widget "*MainMenuBar*" style "black_mackie_menu_bar" +widget "*ZoomClickBox" style "medium_bold_entry" +widget "*PluginParameterLabel" style "medium_text" +widget "*PluginNameInfo" style "plugin_name_text" +widget "*PluginMakerInfo" style "plugin_maker_text" +widget "*PluginParameterInfo" style "medium_text" +widget "*MotionControllerValue" style "medium_entry" +widget "*ParameterValueDisplay" style "medium_bold_entry" +widget "*PluginUIClickBox" style "medium_bold_entry" +widget "*PluginUIClickBox*" style "medium_bold_entry" +widget "*PluginSlider" style "plugin_slider" +widget "*TrackListDisplay" style "track_list_display" +widget "*TrackListDisplay.*" style "small_bold_text" +widget "*EditGroupList" style "track_list_display" +widget "*RegionListDisplay" style "small_bold_entry" +widget "*RegionListDisplay.*" style "small_bold_text" +widget "*RedirectSelector" style "redirect_list_display" +widget "*RedirectSelector.*" style "redirect_list_display" +widget "*MixerTrackCommentArea" style "option_entry" +widget "*MixerPanZone" style "pan_zone" +widget "*MixerTrackDisplayList" style "track_list_display" +widget "*MixerSnapshotDisplayList" style "track_list_display" +widget "*MixerAuxDisplayList" style "track_list_display" +widget "*MixerGroupList" style "track_list_display" +widget "*WallClock" style "wall_clock" +widget "*CPULoad" style "wall_clock" +widget "*RegionEditorLabel" style "medium_text" +widget "*RegionEditorSmallLabel" style "small_text" +widget "*RegionEditorEntry" style "medium_entry" +widget "*RegionEditorClock" style "default_clock_display" +widget "*RegionEditorToggleButton" style "paler_red_when_active" +widget "*RegionEditorToggleButton*" style "paler_red_when_active" +widget "*MixerStripSpeedBase" style "small_entry" +widget "*MixerStripSpeedBase*" style "small_entry" +widget "*MixerStripSpeedBaseNotOne" style "small_red_on_black_entry" +widget "*MixerStripSpeedBaseNotOne*" style "small_red_on_black_entry" +widget "*MixerStripGainDisplay" style "small_entry" +widget "*MixerStripGainUnitButton" style "very_small_button" +widget "*MixerStripGainUnitButton*" style "very_small_button" +widget "*MixerStripMeterPreButton" style "very_small_button" +widget "*MixerStripMeterPreButton*" style "very_small_button" +widget "*MixerStripPeakDisplay*" style "red_active_small_entry" +widget "*MixerStripPeakDisplayPeak*" style "peak_display_peaked_entry" +widget "*MixerStripSelectedFrame" style "selected_strip_frame" +widget "*MixerStripFrame" style "base_frame" +widget "*HWMonitorButton" style "red_when_active" +widget "*HWMonitorButton*" style "red_when_active" +widget "*BypassButton" style "red_when_active" +widget "*BypassButton*" style "red_when_active" +widget "*TransportSoloAlert" style "flashing_alert" +widget "*TransportSoloAlert.*" style "flashing_alert" +widget "*TransportAuditioningAlert" style "flashing_alert" +widget "*TransportAuditioningAlert.*" style "flashing_alert" +widget "*FadeCurve" style "medium_bold_entry" +widget "*FadeCurve*" style "medium_bold_entry" +widget "*IOSelectorButton" style "default_buttons_menus" +widget "*IOSelectorButton*" style "default_buttons_menus" +widget "*IOSelectorList" style "medium_entry_noselection_fg" +widget "*IOSelectorPortList" style "io_selector_port_list" +widget "*IOSelectorPortListSelected" style "selected_io_selector_port_list" +widget "*IOSelectorNotebook" style "io_selector_notebook" +widget "*IOSelectorNotebookTab" style "io_selector_notebook" +widget "*IOSelectorFrame" style "base_frame" +widget "*ConnectionEditorButton" style "default_buttons_menus" +widget "*ConnectionEditorButton*" style "default_buttons_menus" +widget "*ConnectionEditorList" style "medium_entry_noselection_fg" +widget "*ConnectionEditorConnectionList" style "medium_entry" +widget "*ConnectionEditorPortList" style "io_selector_port_list" +widget "*ConnectionEditorPortListSelected" style "selected_io_selector_port_list" +widget "*ConnectionEditorNotebook" style "io_selector_notebook" +widget "*ConnectionEditorNotebookTab" style "io_selector_notebook" +widget "*ConnectionEditorFrame" style "base_frame" +widget "*RouteParamsListDisplay" style "inspector_track_list_display" +widget "*RouteParamsPreListDisplay" style "inspector_redirect_list_display" +widget "*RouteParamsPostListDisplay" style "inspector_redirect_list_display" +widget "*TearOffArrow" style "tearoff_arrow" +widget "*RouteParamsTitleButton" style "medium_text" +widget "*RouteParamsTitleLabel" style "medium_text" +widget "*PluginAutomateRecordButton" style "small_red_active_and_selected_button" +widget "*PluginAutomateRecordButton*" style "small_red_active_and_selected_button" +widget "*PluginAutomatePlayButton" style "small_red_active_and_selected_button" +widget "*PluginAutomatePlayButton*" style "small_red_active_and_selected_button" +widget "*PluginAutomateButton" style "small_button" +widget "*PluginAutomateButton*" style "small_button" +widget "*PluginSaveButton" style "small_button" +widget "*PluginSaveButton*" style "small_button" +widget "*PluginLoadButton" style "small_button" +widget "*PluginLoadButton*" style "small_button" +widget "*FaderMetricsStrip" style "meter_metrics_strip" +widget "*MeterMetricsStrip" style "meter_metrics_strip" +widget "*MetricDialogFrame" style "base_frame" +widget "*MetricEntry" style "medium_bold_entry" +widget "*MetricButton" style "default_buttons_menus" +widget "*MetricButton.*" style "default_buttons_menus" +widget "*MetricLabel" style "medium_text" +widget "*TimeStretchButton" style "default_buttons_menus" +widget "*TimeStretchButton.*" style "default_buttons_menus" +widget "*TimeStretchProgress" style "default_buttons_menus" +widget "*ChoiceWindow" style "default_buttons_menus" +widget "*ChoicePrompt" style "default_buttons_menus" +widget "*ChoiceButton" style "default_buttons_menus" +widget "*ChoiceButton*" style "default_buttons_menus" +widget "*SelectionModeButton" style "default_buttons_menus" +widget "*SelectionModeButton*" style "default_buttons_menus" +widget "*TrackLabel" style "medium_text" +widget "*TrackPlugName" style "medium_text" +widget "*TrackParameterName" style "small_text" +widget "*AddRouteDialog*" style "medium_text" +widget "*AddRouteDialog.GtkLabel" style "medium_text" +widget "*AddRouteDialogChannelChoice" style "medium_bold_entry" +widget "*AddRouteDialogSpinner" style "medium_bold_entry" +widget "*AddRouteDialogSpinner*" style "medium_bold_entry" +widget "*AddRouteDialogRadioButton" style "red_when_active" +widget "*AddRouteDialogButton" style "default_buttons_menus" +widget "*AddRouteDialogNameTemplateEntry" style "medium_bold_entry" +widget "*NewSessionIOLabel" style "larger_bold_text" +widget "*NewSessionSR1Label" style "red_medium_text" +widget "*NewSessionSR2Label" style "medium_text" +widget "*NewSessionChannelChoice" style "medium_bold_entry" +widget "*NewSessionMainButton" style "larger_bold_text" +widget "*NewSessionMainButton*" style "larger_bold_text" +widget "*NewSessionMainLabel" style "larger_bold_text" +widget "*LocationEditRowClock" style "location_rows_clock" +widget "*LocationEditNameLabel" style "medium_text" +widget "*LocationEditSetButton" style "location_row_button" +widget "*LocationEditSetButton*" style "location_row_button" +widget "*LocationEditGoButton" style "location_row_button" +widget "*LocationEditGoButton*" style "location_row_button" +widget "*LocationEditCdButton" style "small_red_active_and_selected_button" +widget "*LocationEditCdButton*" style "small_red_active_and_selected_button" +widget "*LocationEditHideButton" style "small_red_active_and_selected_button" +widget "*LocationEditHideButton*" style "small_red_active_and_selected_button" +widget "*LocationEditNumberLabel" style "small_text" +widget "*LocationLocEditorFrame" style "base_frame" +widget "*LocationRangeEditorFrame" style "base_frame" +widget "*LocationEditNameEntry" style "option_entry" +widget "*LocationAddLocationButton" style "default_buttons_menus" +widget "*LocationAddLocationButton*" style "default_buttons_menus" +widget "*LocationAddRangeButton" style "default_buttons_menus" +widget "*LocationAddRangeButton*" style "default_buttons_menus" +widget "*LocationEditRemoveButton" style "location_row_button" +widget "*LocationEditRemoveButton*" style "location_row_button" +widget "*PanSlider" style "pan_slider" +widget "*PanningLinkButton" style "mixer_red_active_button" +widget "*PanningLinkButton.*" style "mixer_red_active_button" +widget "*PanningLinkDirectionButton" style "very_small_button" +widget "*PanningLinkDirectionButton.*" style "very_small_button" +widget "*ChannelCountSelector" style "medium_bold_entry" +widget "*ChannelCountSelector.GtkArrow" style "default_buttons_menus" +widget "*RegionListWholeFile" style "region_list_whole_file" + +class "GtkWidget" style "default_base" +class "GtkScrollbar" style "ardour_adjusters" +class "GtkLabel" style "default_buttons_menus" +class "GtkButton" style "ardour_button" +class "GtkArrow" style "tearoff_arrow" +class "GtkProgressBar" style "ardour_progressbars" + |