diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-04-15 18:04:23 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-04-15 18:04:23 +0000 |
commit | 54d9f2f2d83af1f0f44579fe2ebf090e68259938 (patch) | |
tree | 44a61c36048be6edabeb5fc5461d47c95623f79f /libs | |
parent | ece2bacb2c7d7f72b6a25a75760837efce0d5e30 (diff) |
first half of the mega-by-hand-commit-by-commit merge from 2.X
git-svn-id: svn://localhost/ardour2/branches/3.0@4980 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/configuration_vars.h | 2 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 4 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 8 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 3 | ||||
-rw-r--r-- | libs/ardour/route.cc | 12 | ||||
-rw-r--r-- | libs/ardour/session.cc | 64 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/utils.h | 13 | ||||
-rw-r--r-- | libs/gtkmm2ext/sync-menu.c | 15 | ||||
-rw-r--r-- | libs/gtkmm2ext/utils.cc | 42 | ||||
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 42 | ||||
-rw-r--r-- | libs/surfaces/mackie/route_signal.cc | 41 | ||||
-rw-r--r-- | libs/surfaces/mackie/route_signal.h | 7 |
12 files changed, 150 insertions, 103 deletions
diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 208fcbb0f0..81985ff77a 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -83,6 +83,8 @@ CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher) CONFIG_VARIABLE (bool, link_region_and_track_selection, "link-region-and-track-selection", false) CONFIG_VARIABLE (std::string, keyboard_layout_name, "keyboard-layout-name", "ansi") CONFIG_VARIABLE (bool, automation_follows_regions, "automation-follows-regions", false) +CONFIG_VARIABLE (bool, region_boundaries_from_selected_tracks, "region-boundaries-from-selected-tracks", true) +CONFIG_VARIABLE (bool, region_boundaries_from_onscreen_tracks, "region-boundaries-from-onscreen_tracks", true) /* monitoring, mute, solo etc */ diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 19e6c27ba4..e0be9af6d9 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -558,9 +558,9 @@ AudioEngine::port_registration_failure (const std::string& portname) string reason; if (p) { - reason = _("a port with this name already exists: check for duplicated track/bus names"); + reason = string_compose (_("a port with the name \"%1\" already exists: check for duplicated track/bus names"), portname); } else { - reason = _("unknown error"); + reason = _("No more JACK ports are available. You will need to stop Ardour and restart JACK with ports if you need this many tracks."); } throw PortRegistrationFailure (string_compose (_("AudioEngine: cannot register port \"%1\": %2"), portname, reason).c_str()); diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index b5d733aea1..085296281c 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -356,10 +356,10 @@ nframes_t AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, sframes_t position, nframes_t cnt, uint32_t chan_n) const { - return _read_at (_master_sources, - _master_sources.front()->length(_master_sources.front()->timeline_position()), - buf, mixdown_buffer, gain_buffer, - position, cnt, chan_n, 0, 0); + /* do not read gain/scaling/fades and do not count this disk i/o in statistics */ + + return _read_at (_master_sources, _master_sources.front()->length(_master_sources.front()->timeline_position()), + buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, 0, 0, ReadOps (0)); } nframes_t diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 3f8785cf37..f34e47b9da 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1606,7 +1606,8 @@ Playlist::find_next_region (nframes_t frame, RegionPoint point, int dir) pos = r->last_frame (); break; case SyncPoint: - pos = r->adjust_to_sync (r->first_frame()); + pos = r->sync_position (); + // r->adjust_to_sync (r->first_frame()); break; } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 107603c176..04b4974ceb 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2261,6 +2261,18 @@ Route::_set_state (const XMLNode& node, bool call_base) delete _control_outs; _control_outs = new IO (_session, coutname); + + /* fix up the control out name in the XML before setting it. + Otherwise track templates don't work because the control + outs end up with the stored template name, rather than + the new name of the track based on the template. + */ + + XMLProperty* prop = (*child->children().begin())->property ("name"); + if (prop) { + prop->set_value (coutname); + } + _control_outs->set_state (**(child->children().begin())); } else if (child->name() == X_("Comment")) { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 25cf610189..e62d672984 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -565,17 +565,21 @@ Session::when_engine_running () } else { - /* default state for Click */ + /* default state for Click: dual-mono to first 2 physical outputs */ - first_physical_output = _engine.get_nth_physical_output (DataType::AUDIO, 0); + for (int physport = 0; physport < 2; ++physport) { + string physical_output = _engine.get_nth_physical_output (DataType::AUDIO, physport); - if (first_physical_output.length()) { - if (_click_io->add_output_port (first_physical_output, this)) { - // relax, even though its an error - } else { - _clicking = Config->get_clicking (); - } - } + if (physical_output.length()) { + if (_click_io->add_output_port (physical_output, this)) { + // relax, even though its an error + } + } + } + + if (_click_io->n_outputs () > ChanCount::ZERO) { + _clicking = Config->get_clicking (); + } } } @@ -1529,7 +1533,7 @@ Session::new_midi_track (TrackMode mode, uint32_t how_many) shared_ptr<RouteList> r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - if (dynamic_cast<MidiTrack*>((*i).get()) != 0) { + if (boost::dynamic_pointer_cast<MidiTrack>(*i) != 0) { if (!(*i)->is_hidden()) { n++; //channels_used += (*i)->n_inputs().n_midi(); @@ -1687,7 +1691,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod shared_ptr<RouteList> r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - if (dynamic_cast<AudioTrack*>((*i).get()) != 0) { + if (boost::dynamic_pointer_cast<AudioTrack>(*i) != 0) { if (!(*i)->is_hidden()) { n++; channels_used += (*i)->n_inputs().n_audio(); @@ -1805,7 +1809,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod catch (AudioEngine::PortRegistrationFailure& pfe) { - error << _("No more JACK ports are available. You will need to stop Ardour and restart JACK with ports if you need this many tracks.") << endmsg; + error << pfe.what() << endmsg; if (track) { /* we need to get rid of this, since the track failed to be created */ @@ -1963,7 +1967,7 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_ } catch (AudioEngine::PortRegistrationFailure& pfe) { - error << _("No more JACK ports are available. You will need to stop Ardour and restart JACK with ports if you need this many tracks.") << endmsg; + error << pfe.what() << endmsg; goto failure; } @@ -2058,7 +2062,7 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template } catch (AudioEngine::PortRegistrationFailure& pfe) { - error << _("No more JACK ports are available. You will need to stop Ardour and restart JACK with ports if you need this many tracks.") << endmsg; + error << pfe.what() << endmsg; goto out; } @@ -2182,10 +2186,10 @@ Session::remove_route (shared_ptr<Route> route) /* writer goes out of scope, forces route list update */ } - Track* t; + boost::shared_ptr<Track> t; boost::shared_ptr<Diskstream> ds; - if ((t = dynamic_cast<Track*>(route.get())) != 0) { + if ((t = boost::dynamic_pointer_cast<Track>(route)) != 0) { ds = t->diskstream(); } @@ -2262,7 +2266,7 @@ Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr) /* don't mess with busses */ - if (dynamic_cast<Track*>((*i).get()) == 0) { + if (boost::dynamic_pointer_cast<Track>(*i) == 0) { continue; } @@ -2270,7 +2274,7 @@ Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr) /* don't mess with tracks */ - if (dynamic_cast<Track*>((*i).get()) != 0) { + if (boost::dynamic_pointer_cast<Track>(*i) != 0) { continue; } } @@ -2306,7 +2310,7 @@ Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr) for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if ((*i)->soloed()) { something_soloed = true; - if (dynamic_cast<Track*>((*i).get())) { + if (boost::dynamic_pointer_cast<Track>(*i)) { if (is_track) { same_thing_soloed = true; break; @@ -2353,7 +2357,7 @@ Session::update_route_solo_state () for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if ((*i)->soloed()) { mute = true; - if (dynamic_cast<Track*>((*i).get())) { + if (boost::dynamic_pointer_cast<Track>(*i)) { is_track = true; } break; @@ -2398,7 +2402,7 @@ Session::modify_solo_mute (bool is_track, bool mute) /* only alter track solo mute */ - if (dynamic_cast<Track*>((*i).get())) { + if (boost::dynamic_pointer_cast<Track>(*i)) { if ((*i)->soloed()) { (*i)->set_solo_mute (!mute); } else { @@ -2410,7 +2414,7 @@ Session::modify_solo_mute (bool is_track, bool mute) /* only alter bus solo mute */ - if (!dynamic_cast<Track*>((*i).get())) { + if (!boost::dynamic_pointer_cast<Track>(*i)) { if ((*i)->soloed()) { @@ -3673,10 +3677,10 @@ Session::record_enable_change_all (bool yn) shared_ptr<RouteList> r = routes.reader (); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - Track* at; + boost::shared_ptr<Track> t; - if ((at = dynamic_cast<Track*>((*i).get())) != 0) { - at->set_record_enable (yn, this); + if ((t = boost::dynamic_pointer_cast<Track>(*i)) != 0) { + t->set_record_enable (yn, this); } } @@ -4040,13 +4044,13 @@ Session::freeze (InterThreadInfo& itt) for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - Track *at; + boost::shared_ptr<Track> t; - if ((at = dynamic_cast<Track*>((*i).get())) != 0) { + if ((t = boost::dynamic_pointer_cast<Track>(*i)) != 0) { /* XXX this is wrong because itt.progress will keep returning to zero at the start of every track. */ - at->freeze (itt); + t->freeze (itt); } } @@ -4255,7 +4259,7 @@ Session::ntracks () const shared_ptr<RouteList> r = routes.reader (); for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) { - if (dynamic_cast<Track*> ((*i).get())) { + if (boost::dynamic_pointer_cast<Track> (*i)) { ++n; } } @@ -4270,7 +4274,7 @@ Session::nbusses () const shared_ptr<RouteList> r = routes.reader (); for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) { - if (dynamic_cast<Track*> ((*i).get()) == 0) { + if (boost::dynamic_pointer_cast<Track>(*i) == 0) { ++n; } } diff --git a/libs/gtkmm2ext/gtkmm2ext/utils.h b/libs/gtkmm2ext/gtkmm2ext/utils.h index e664f2420d..7f986e738c 100644 --- a/libs/gtkmm2ext/gtkmm2ext/utils.h +++ b/libs/gtkmm2ext/gtkmm2ext/utils.h @@ -45,12 +45,21 @@ namespace Gtkmm2ext { gint vpadding); void set_size_request_to_display_given_text (Gtk::Widget &w, - const std::vector<std::string>&, + const std::vector<std::string>&, gint hpadding, gint vpadding); void set_popdown_strings (Gtk::ComboBoxText&, - const std::vector<std::string>&); + const std::vector<std::string>&, + bool set_size = false, + gint hpadding = 0, gint vpadding = 0); + + // Combo's are stupid - they steal space from the entry for the button +#ifdef GTKOSX + static const guint32 COMBO_FUDGE = 38; +#else + static const guint32 COMBO_FUDGE = 24; +#endif template<class T> void deferred_delete (void *ptr) { delete static_cast<T *> (ptr); diff --git a/libs/gtkmm2ext/sync-menu.c b/libs/gtkmm2ext/sync-menu.c index 894446c424..a16babce54 100644 --- a/libs/gtkmm2ext/sync-menu.c +++ b/libs/gtkmm2ext/sync-menu.c @@ -313,6 +313,7 @@ carbon_menu_item_update_accelerator (CarbonMenuItem *carbon_item, gint n_keys; gint use_command; gboolean add_modifiers = FALSE; + UInt8 modifiers = 0; /* implies Command key */ if (gdk_keymap_get_entries_for_keyval (keymap, key->accel_key, &keys, &n_keys) == 0) @@ -347,10 +348,14 @@ carbon_menu_item_update_accelerator (CarbonMenuItem *carbon_item, } } else { - SetMenuItemCommandKey (carbon_item->menu, carbon_item->index, - true, keys[0].keycode); - g_free (keys); - add_modifiers = TRUE; + SetMenuItemCommandKey (carbon_item->menu, carbon_item->index, true, keys[0].keycode); + if (keys[0].level == 1) { + /* regular key, but it needs shift to make it work */ + modifiers |= kMenuShiftModifier; + } + + g_free (keys); + add_modifiers = TRUE; } if (add_modifiers) @@ -589,7 +594,7 @@ menu_event_handler_func (EventHandlerCallRef event_handler_call_ref, sizeof (widget), 0, &widget); if (err == noErr && GTK_IS_WIDGET (widget)) { - g_idle_add (dummy_gtk_menu_item_activate, widget); + g_idle_add ((GSourceFunc) dummy_gtk_menu_item_activate, widget); // gtk_menu_item_activate (GTK_MENU_ITEM (widget)); _in_carbon_menu_event_handler = 0; return noErr; diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc index adcaaaaeb5..3a021bbe7b 100644 --- a/libs/gtkmm2ext/utils.cc +++ b/libs/gtkmm2ext/utils.cc @@ -59,8 +59,8 @@ Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar * void Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, - const std::vector<std::string>& strings, - gint hpadding, gint vpadding) + const std::vector<std::string>& strings, + gint hpadding, gint vpadding) { int width, height; @@ -68,11 +68,10 @@ Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, int height_max = 0; w.ensure_style (); - for (vector<string>::const_iterator i = strings.begin(); - i != strings.end(); ++i) { - get_ink_pixel_size (w.create_pango_layout (*i), width, height); - width_max = max(width_max,width); - height_max = max(height_max, height); + for (vector<string>::const_iterator i = strings.begin(); i != strings.end(); ++i) { + get_ink_pixel_size (w.create_pango_layout (*i), width, height); + width_max = max(width_max,width); + height_max = max(height_max, height); } w.set_size_request(width_max + hpadding, height_max + vpadding); } @@ -85,11 +84,36 @@ Gtkmm2ext::init () } void -Gtkmm2ext::set_popdown_strings (Gtk::ComboBoxText& cr, const vector<string>& strings) +Gtkmm2ext::set_popdown_strings (Gtk::ComboBoxText& cr, const vector<string>& strings, bool set_size, gint hpadding, gint vpadding) { + vector<string>::const_iterator i; + cr.clear (); - for (vector<string>::const_iterator i = strings.begin(); i != strings.end(); ++i) { + if (set_size) { + vector<string> copy; + + for (i = strings.begin(); i != strings.end(); ++i) { + if ((*i).find_first_of ("gy") != string::npos) { + /* contains a descender */ + break; + } + } + + if (i == strings.end()) { + + /* make a copy of the strings then add one that has a descener */ + + copy = strings; + copy.push_back ("g"); + set_size_request_to_display_given_text (cr, copy, COMBO_FUDGE+10+hpadding, 15+vpadding); + + } else { + set_size_request_to_display_given_text (cr, strings, COMBO_FUDGE+10+hpadding, 15+vpadding); + } + } + + for (i = strings.begin(); i != strings.end(); ++i) { cr.append_text (*i); } } diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 18dbd28c0e..c9f67a6bef 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -293,7 +293,7 @@ void MackieControlProtocol::switch_banks( int initial ) cout << "remote id " << route->remote_control_id() << " connecting " << route->name() << " to " << strip.name() << " with port " << port_for_id(i) << endl; #endif route_table[i] = route; - RouteSignal * rs = new RouteSignal( *route, *this, strip, port_for_id(i) ); + RouteSignal * rs = new RouteSignal (route, *this, strip, port_for_id(i) ); route_signals.push_back( rs ); // update strip from route rs->notify_all(); @@ -543,11 +543,14 @@ void MackieControlProtocol::update_surface() switch_banks( _current_initial_bank ); // create a RouteSignal for the master route - // but only the first time around - master_route_signal = shared_ptr<RouteSignal>( new RouteSignal( *master_route(), *this, master_strip(), mcu_port() ) ); - // update strip from route - master_route_signal->notify_all(); - + + boost::shared_ptr<Route> mr = master_route (); + if (mr) { + master_route_signal = shared_ptr<RouteSignal> (new RouteSignal (mr, *this, master_strip(), mcu_port()) ); + // update strip from route + master_route_signal->notify_all(); + } + // sometimes the jog wheel is a pot surface().blank_jog_ring( mcu_port(), builder ); @@ -656,13 +659,8 @@ void MackieControlProtocol::create_ports() shared_ptr<Route> MackieControlProtocol::master_route() { - shared_ptr<Route> retval; - retval = session->route_by_name( "master" ); - if ( retval == 0 ) - { - // TODO search through all routes for one with the master attribute set - } - return retval; + boost::shared_ptr<IO> mo = session->master_out (); + return boost::dynamic_pointer_cast<Route>(mo); } Strip & MackieControlProtocol::master_strip() @@ -966,7 +964,7 @@ void MackieControlProtocol::notify_solo_changed( RouteSignal * route_signal ) try { Button & button = route_signal->strip().solo(); - route_signal->port().write( builder.build_led( button, route_signal->route().soloed() ) ); + route_signal->port().write( builder.build_led( button, route_signal->route()->soloed() ) ); } catch( exception & e ) { @@ -979,7 +977,7 @@ void MackieControlProtocol::notify_mute_changed( RouteSignal * route_signal ) try { Button & button = route_signal->strip().mute(); - route_signal->port().write( builder.build_led( button, route_signal->route().muted() ) ); + route_signal->port().write( builder.build_led( button, route_signal->route()->muted() ) ); } catch( exception & e ) { @@ -992,7 +990,7 @@ void MackieControlProtocol::notify_record_enable_changed( RouteSignal * route_si try { Button & button = route_signal->strip().recenable(); - route_signal->port().write( builder.build_led( button, route_signal->route().record_enabled() ) ); + route_signal->port().write( builder.build_led( button, route_signal->route()->record_enabled() ) ); } catch( exception & e ) { @@ -1022,7 +1020,7 @@ void MackieControlProtocol::notify_gain_changed( RouteSignal * route_signal, boo Fader & fader = route_signal->strip().gain(); if ( !fader.in_use() ) { - float gain_value = route_signal->route().gain_control()->get_value(); + float gain_value = route_signal->route()->gain_control()->get_value(); // check that something has actually changed if ( force_update || gain_value != route_signal->last_gain_written() ) { @@ -1045,7 +1043,7 @@ void MackieControlProtocol::notify_name_changed( RouteSignal * route_signal ) if ( !strip.is_master() ) { string line1; - string fullname = route_signal->route().name(); + string fullname = route_signal->route()->name(); if ( fullname.length() <= 6 ) { @@ -1072,11 +1070,11 @@ void MackieControlProtocol::notify_panner_changed( RouteSignal * route_signal, b try { Pot & pot = route_signal->strip().vpot(); - const Panner & panner = route_signal->route().panner(); + const Panner & panner = route_signal->route()->panner(); if ( panner.npanners() == 1 || ( panner.npanners() == 2 && panner.linked() ) ) { float pos; - route_signal->route().panner().streampanner(0).get_effective_position( pos ); + route_signal->route()->panner().streampanner(0).get_effective_position( pos ); // cache the MidiByteArray here, because the mackie led control is much lower // resolution than the panner control. So we save lots of byte @@ -1103,13 +1101,13 @@ void MackieControlProtocol::notify_panner_changed( RouteSignal * route_signal, b // TODO handle plugin automation polling void MackieControlProtocol::update_automation( RouteSignal & rs ) { - ARDOUR::AutoState gain_state = rs.route().gain_control()->automation_state(); + ARDOUR::AutoState gain_state = rs.route()->gain_control()->automation_state(); if ( gain_state == Touch || gain_state == Play ) { notify_gain_changed( &rs, false ); } - ARDOUR::AutoState panner_state = rs.route().panner().automation_state(); + ARDOUR::AutoState panner_state = rs.route()->panner().automation_state(); if ( panner_state == Touch || panner_state == Play ) { notify_panner_changed( &rs, false ); diff --git a/libs/surfaces/mackie/route_signal.cc b/libs/surfaces/mackie/route_signal.cc index 33a8908dde..b2139e1cbe 100644 --- a/libs/surfaces/mackie/route_signal.cc +++ b/libs/surfaces/mackie/route_signal.cc @@ -25,48 +25,39 @@ #include <stdexcept> +using namespace ARDOUR; using namespace Mackie; using namespace std; void RouteSignal::connect() { back_insert_iterator<Connections> cins = back_inserter( _connections ); - + if ( _strip.has_solo() ) - cins = _route.solo_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), this ) ); + cins = _route->solo_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_solo_changed ), this ) ); if ( _strip.has_mute() ) - cins = _route.mute_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), this ) ); + cins = _route->mute_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_mute_changed ), this ) ); if ( _strip.has_gain() ) - cins = _route.gain_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), this, true ) ); + cins = _route->gain_control()->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_gain_changed ), this, true ) ); - cins = _route.NameChanged.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) ); + cins = _route->NameChanged.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) ); - cins = _route.panner().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) ); - for ( unsigned int i = 0; i < _route.panner().npanners(); ++i ) - { - cins = _route.panner().streampanner (i).Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) ); - } + cins = _route->panner().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) ); + for ( unsigned int i = 0; i < _route->panner().npanners(); ++i ) { + cins = _route->panner().streampanner (i).Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) ); + } - try - { - cins = dynamic_cast<ARDOUR::Track&>( _route ) - .rec_enable_control() - ->Changed - .connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), this ) ) - ; + boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route); + if (trk) { + cins = trk->rec_enable_control()->Changed .connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_record_enable_changed ), this)); } - catch ( std::bad_cast & ) - { - // this should catch the dynamic_cast to Track, if what we're working - // with can't be record-enabled - } - + // TODO this works when a currently-banked route is made inactive, but not // when a route is activated which should be currently banked. - cins = _route.active_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_active_changed ), this ) ); - + cins = _route->active_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_active_changed ), this ) ); + // TODO // SelectedChanged // RemoteControlIDChanged. Better handled at Session level. diff --git a/libs/surfaces/mackie/route_signal.h b/libs/surfaces/mackie/route_signal.h index 01b3c97c16..a272449e52 100644 --- a/libs/surfaces/mackie/route_signal.h +++ b/libs/surfaces/mackie/route_signal.h @@ -19,6 +19,7 @@ #define route_signal_h #include <sigc++/sigc++.h> +#include <boost/shared_ptr.hpp> #include <vector> @@ -45,7 +46,7 @@ class SurfacePort; class RouteSignal { public: - RouteSignal( ARDOUR::Route & route, MackieControlProtocol & mcp, Strip & strip, SurfacePort & port ) + RouteSignal(boost::shared_ptr<ARDOUR::Route> route, MackieControlProtocol & mcp, Strip & strip, SurfacePort & port ) : _route( route ), _mcp( mcp ), _strip( strip ), _port( port ), _last_gain_written(0.0) { connect(); @@ -62,7 +63,7 @@ public: // call all signal handlers manually void notify_all(); - const ARDOUR::Route & route() const { return _route; } + boost::shared_ptr<const ARDOUR::Route> route() const { return _route; } Strip & strip() { return _strip; } SurfacePort & port() { return _port; } @@ -73,7 +74,7 @@ public: void last_pan_written( const MidiByteArray & other ) { _last_pan_written = other; } private: - ARDOUR::Route & _route; + boost::shared_ptr<ARDOUR::Route> _route; MackieControlProtocol & _mcp; Strip & _strip; SurfacePort & _port; |