mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 15:16:25 +01:00
more changes to reduce unnecessary midi messages. Also, don't throw an exception on port write overflow.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2441 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
f1c4219fa9
commit
ebadae4c96
4 changed files with 26 additions and 10 deletions
|
|
@ -1017,11 +1017,15 @@ void MackieControlProtocol::notify_panner_changed( RouteSignal * route_signal )
|
||||||
float pos;
|
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
|
||||||
|
// sends in spite of more work on the comparison
|
||||||
|
MidiByteArray bytes = builder.build_led_ring( pot, ControlState( on, pos ), MackieMidiBuilder::midi_pot_mode_dot );
|
||||||
// check that something has actually changed
|
// check that something has actually changed
|
||||||
if ( pos != route_signal->last_pan_written() )
|
if ( bytes != route_signal->last_pan_written() )
|
||||||
{
|
{
|
||||||
route_signal->port().write( builder.build_led_ring( pot, ControlState( on, pos ), MackieMidiBuilder::midi_pot_mode_dot ) );
|
route_signal->port().write( bytes );
|
||||||
route_signal->last_pan_written( pos );
|
route_signal->last_pan_written( bytes );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1049,11 +1053,12 @@ void MackieControlProtocol::update_automation( RouteSignal & rs )
|
||||||
{
|
{
|
||||||
notify_panner_changed( &rs );
|
notify_panner_changed( &rs );
|
||||||
}
|
}
|
||||||
|
_automation_last.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MackieControlProtocol::poll_automation()
|
void MackieControlProtocol::poll_automation()
|
||||||
{
|
{
|
||||||
if ( _active )
|
if ( _active && _automation_last.elapsed() >= 20 )
|
||||||
{
|
{
|
||||||
// do all currently mapped routes
|
// do all currently mapped routes
|
||||||
for( RouteSignals::iterator it = route_signals.begin(); it != route_signals.end(); ++it )
|
for( RouteSignals::iterator it = route_signals.begin(); it != route_signals.end(); ++it )
|
||||||
|
|
@ -1063,6 +1068,8 @@ void MackieControlProtocol::poll_automation()
|
||||||
|
|
||||||
// and the master strip
|
// and the master strip
|
||||||
if ( master_route_signal != 0 ) update_automation( *master_route_signal );
|
if ( master_route_signal != 0 ) update_automation( *master_route_signal );
|
||||||
|
|
||||||
|
_automation_last.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,9 @@ class MackieControlProtocol
|
||||||
Mackie::Timer _frm_left_last;
|
Mackie::Timer _frm_left_last;
|
||||||
|
|
||||||
Mackie::JogWheel _jog_wheel;
|
Mackie::JogWheel _jog_wheel;
|
||||||
|
|
||||||
|
// Timer for controlling midi bandwidth used by automation polls
|
||||||
|
Mackie::Timer _automation_last;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ardour_mackie_control_protocol_h
|
#endif // ardour_mackie_control_protocol_h
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "midi_byte_array.h"
|
||||||
|
|
||||||
class MackieControlProtocol;
|
class MackieControlProtocol;
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
|
|
@ -44,7 +46,7 @@ class RouteSignal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RouteSignal( ARDOUR::Route & route, MackieControlProtocol & mcp, Strip & strip, MackiePort & port )
|
RouteSignal( ARDOUR::Route & route, MackieControlProtocol & mcp, Strip & strip, MackiePort & port )
|
||||||
: _route( route ), _mcp( mcp ), _strip( strip ), _port( port ), _last_gain_written(0.0), _last_pan_written(0.0)
|
: _route( route ), _mcp( mcp ), _strip( strip ), _port( port ), _last_gain_written(0.0)
|
||||||
{
|
{
|
||||||
connect();
|
connect();
|
||||||
}
|
}
|
||||||
|
|
@ -67,8 +69,8 @@ public:
|
||||||
float last_gain_written() const { return _last_gain_written; }
|
float last_gain_written() const { return _last_gain_written; }
|
||||||
void last_gain_written( float other ) { _last_gain_written = other; }
|
void last_gain_written( float other ) { _last_gain_written = other; }
|
||||||
|
|
||||||
float last_pan_written() const { return _last_pan_written; }
|
const MidiByteArray & last_pan_written() const { return _last_pan_written; }
|
||||||
void last_pan_written( float other ) { _last_pan_written = other; }
|
void last_pan_written( const MidiByteArray & other ) { _last_pan_written = other; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ARDOUR::Route & _route;
|
ARDOUR::Route & _route;
|
||||||
|
|
@ -82,7 +84,7 @@ private:
|
||||||
// Last written values for the gain and pan, to avoid overloading
|
// Last written values for the gain and pan, to avoid overloading
|
||||||
// the midi connection to the surface
|
// the midi connection to the surface
|
||||||
float _last_gain_written;
|
float _last_gain_written;
|
||||||
float _last_pan_written;
|
MidiByteArray _last_pan_written;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,11 +132,15 @@ void SurfacePort::write( const MidiByteArray & mba )
|
||||||
int count = port().write( mba.bytes().get(), mba.size() );
|
int count = port().write( mba.bytes().get(), mba.size() );
|
||||||
if ( count != (int)mba.size() )
|
if ( count != (int)mba.size() )
|
||||||
{
|
{
|
||||||
if ( errno != EAGAIN )
|
if ( errno == 0 )
|
||||||
|
{
|
||||||
|
cout << "port overflow on " << port().name() << ". Did not write all of " << mba << endl;
|
||||||
|
}
|
||||||
|
else if ( errno != EAGAIN )
|
||||||
{
|
{
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
os << "Surface: couldn't write to port " << port().name();
|
os << "Surface: couldn't write to port " << port().name();
|
||||||
os << ": " << errno << fetch_errmsg( errno );
|
os << ", error: " << fetch_errmsg( errno ) << "(" << errno << ")";
|
||||||
|
|
||||||
cout << os.str();
|
cout << os.str();
|
||||||
inactive_event();
|
inactive_event();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue