mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-11 07:56:27 +01:00
deeper fixes for route issue/s .. make RouteSignal use shared_ptr<Route> rather than Route&, like the rest of Ardour. NOTE: something probably needs to handle Route::GoingAway
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4830 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
e8185a39f2
commit
27ccbab6c8
3 changed files with 29 additions and 35 deletions
|
|
@ -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();
|
||||
|
|
@ -658,7 +658,8 @@ void MackieControlProtocol::create_ports()
|
|||
|
||||
shared_ptr<Route> MackieControlProtocol::master_route()
|
||||
{
|
||||
return session->master_out ();
|
||||
boost::shared_ptr<IO> mo = session->master_out ();
|
||||
return boost::dynamic_pointer_cast<Route>(mo);
|
||||
}
|
||||
|
||||
Strip & MackieControlProtocol::master_strip()
|
||||
|
|
@ -962,7 +963,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 )
|
||||
{
|
||||
|
|
@ -975,7 +976,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 )
|
||||
{
|
||||
|
|
@ -988,7 +989,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 )
|
||||
{
|
||||
|
|
@ -1018,7 +1019,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() )
|
||||
{
|
||||
|
|
@ -1041,7 +1042,7 @@ void MackieControlProtocol::notify_name_changed( void *, RouteSignal * route_sig
|
|||
if ( !strip.is_master() )
|
||||
{
|
||||
string line1;
|
||||
string fullname = route_signal->route().name();
|
||||
string fullname = route_signal->route()->name();
|
||||
|
||||
if ( fullname.length() <= 6 )
|
||||
{
|
||||
|
|
@ -1068,11 +1069,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.size() == 1 || ( panner.size() == 2 && panner.linked() ) )
|
||||
{
|
||||
float pos;
|
||||
route_signal->route().panner()[0]->get_effective_position( pos );
|
||||
route_signal->route()->panner()[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
|
||||
|
|
@ -1099,13 +1100,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_automation_state();
|
||||
ARDOUR::AutoState gain_state = rs.route()->gain_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 );
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace Mackie;
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -33,39 +34,30 @@ 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.name_changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_name_changed ), this ) );
|
||||
cins = _route->name_changed.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().size(); ++i )
|
||||
cins = _route->panner().Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
|
||||
for ( unsigned int i = 0; i < _route->panner().size(); ++i )
|
||||
{
|
||||
cins = _route.panner()[i]->Changed.connect( sigc::bind ( mem_fun ( _mcp, &MackieControlProtocol::notify_panner_changed ), this, true ) );
|
||||
cins = _route->panner()[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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue