float 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
- 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->last_pan_written( pos );
+ route_signal->port().write( bytes );
+ route_signal->last_pan_written( bytes );
}
}
else
{
notify_panner_changed( &rs );
}
+ _automation_last.start();
}
void MackieControlProtocol::poll_automation()
{
- if ( _active )
+ if ( _active && _automation_last.elapsed() >= 20 )
{
// do all currently mapped routes
for( RouteSignals::iterator it = route_signals.begin(); it != route_signals.end(); ++it )
// and the master strip
if ( master_route_signal != 0 ) update_automation( *master_route_signal );
+
+ _automation_last.start();
}
}
Mackie::Timer _frm_left_last;
Mackie::JogWheel _jog_wheel;
+
+ // Timer for controlling midi bandwidth used by automation polls
+ Mackie::Timer _automation_last;
};
#endif // ardour_mackie_control_protocol_h
#include <vector>
+#include "midi_byte_array.h"
+
class MackieControlProtocol;
namespace ARDOUR {
{
public:
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();
}
float last_gain_written() const { return _last_gain_written; }
void last_gain_written( float other ) { _last_gain_written = other; }
- float last_pan_written() const { return _last_pan_written; }
- void last_pan_written( float other ) { _last_pan_written = other; }
+ const MidiByteArray & last_pan_written() const { return _last_pan_written; }
+ void last_pan_written( const MidiByteArray & other ) { _last_pan_written = other; }
private:
ARDOUR::Route & _route;
// Last written values for the gain and pan, to avoid overloading
// the midi connection to the surface
float _last_gain_written;
- float _last_pan_written;
+ MidiByteArray _last_pan_written;
};
}
int count = port().write( mba.bytes().get(), 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;
os << "Surface: couldn't write to port " << port().name();
- os << ": " << errno << fetch_errmsg( errno );
+ os << ", error: " << fetch_errmsg( errno ) << "(" << errno << ")";
cout << os.str();
inactive_event();