13
0

poll for automation

git-svn-id: svn://localhost/ardour2/trunk@1566 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
John Anderson 2007-03-09 11:24:14 +00:00
parent a48a83ae5a
commit 04a7c950ab
6 changed files with 41 additions and 6 deletions

View File

@ -3,8 +3,9 @@
if the handler is not called in the "correct thread", it will use a pseudo-RT-safe-enough technique to get the correct thread to recall "handler" later on, and return.
* automation feedback not working. gtk2_ardour seems to poll.
* optimise strip_from_route. Can just pass in strips.
* jog with transport rolling doesn't work properly. My use of ScrollTimeline also doesn't work.
* finish button mapping
* finish button mapping. Click on/off. start/end locate. punch in/out
* discuss button mapping for Ardour
* concurrency for bank switching? And make sure "old" events aren't sent to "new" faders
* TODOs in code

View File

@ -105,7 +105,18 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
MackieControlProtocol::~MackieControlProtocol()
{
cout << "~MackieControlProtocol::MackieControlProtocol" << endl;
close();
try
{
close();
}
catch ( exception & e )
{
cout << "~MackieControlProtocol caught " << e.what() << endl;
}
catch ( ... )
{
cout << "~MackieControlProtocol caught unknown" << endl;
}
}
Mackie::Surface & MackieControlProtocol::surface()
@ -983,7 +994,7 @@ void MackieControlProtocol::notify_gain_changed( ARDOUR::Route * route, MackieP
Fader & fader = strip_from_route( route ).gain();
if ( !fader.touch() )
{
port->write( builder.build_fader( fader, gain_to_slider_position( route->gain() ) ) );
port->write( builder.build_fader( fader, gain_to_slider_position( route->effective_gain() ) ) );
}
}
catch( exception & e )
@ -1027,6 +1038,19 @@ void MackieControlProtocol::notify_panner_changed( ARDOUR::Route * route, Mackie
}
}
void MackieControlProtocol::poll_automation()
{
for( RouteSignals::iterator it = route_signals.begin(); it != route_signals.end(); ++it )
{
// update strip from route
ARDOUR::AutoState state = (*it)->route().gain_automation_state();
if ( state == Touch || state == Play )
{
(*it)->notify_all();
}
}
}
/////////////////////////////////////
// Transport Buttons
/////////////////////////////////////

View File

@ -233,6 +233,9 @@ class MackieControlProtocol
void read_ports();
void add_port( MIDI::Port &, int number );
/// read automation data from the currently active routes and send to surface
void poll_automation();
/**
used by the notify_XXX methods to find

View File

@ -71,6 +71,9 @@ void * MackieControlProtocol::monitor_work()
}
// provide a cancellation point
pthread_testcancel();
// poll for automation data from the routes
poll_automation();
}
// these never get called
@ -86,6 +89,7 @@ void MackieControlProtocol::update_ports()
// create pollfd structures if necessary
if ( _ports_changed )
{
cout << "MackieControlProtocol::update_ports changed 1" << endl;
Glib::Mutex::Lock ul( update_mutex );
// yes, this is a double-test locking paradigm, or whatever it's called
// because we don't *always* need to acquire the lock for the first test
@ -178,10 +182,14 @@ void MackieControlProtocol::handle_port_changed( SurfacePort * port, bool active
}
else
{
cout << __FILE__ << ':' << __LINE__ << endl;
_ports_changed = true;
cout << __FILE__ << ':' << __LINE__ << endl;
// port added
update_ports();
cout << __FILE__ << ':' << __LINE__ << endl;
update_surface();
cout << __FILE__ << ':' << __LINE__ << endl;
// TODO update bank size

View File

@ -76,8 +76,6 @@ void RouteSignal::disconnect()
void RouteSignal::notify_all()
{
void * src = &_route;
if ( _strip.has_solo() )
_mcp.notify_solo_changed( &_route, &_port );
@ -87,7 +85,7 @@ void RouteSignal::notify_all()
if ( _strip.has_gain() )
_mcp.notify_gain_changed( &_route, &_port );
_mcp.notify_name_changed( src, &_route, &_port );
_mcp.notify_name_changed( &_route, &_route, &_port );
if ( _strip.has_vpot() )
_mcp.notify_panner_changed( &_route, &_port );

View File

@ -60,6 +60,7 @@ public:
const ARDOUR::Route & route() const { return _route; }
Strip & strip() { return _strip; }
Port & port() { return _port; }
private:
ARDOUR::Route & _route;