* when we connected to the per-channel pitchbend events.
*/
+
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi pitchbend on port %3, fader = %1 value = %2\n",
fader_id, pb, _number));
+ if (_mcp.device_info().no_handshake()) {
+ turn_it_on ();
+ }
+
Fader* fader = faders[fader_id];
if (fader) {
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("SurfacePort::handle_note_on %1 = %2\n", (int) ev->note_number, (int) ev->velocity));
+ if (_mcp.device_info().no_handshake()) {
+ turn_it_on ();
+ }
+
Button* button = buttons[ev->note_number];
if (button) {
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("SurfacePort::handle_midi_controller %1 = %2\n", (int) ev->controller_number, (int) ev->value));
+ if (_mcp.device_info().no_handshake()) {
+ turn_it_on ();
+ }
+
Pot* pot = pots[ev->controller_number];
// bit 6 gives the sign
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
+ if (_mcp.device_info().no_handshake()) {
+ turn_it_on ();
+ }
+
/* always save the device type ID so that our outgoing sysex messages
* are correct
*/
write_sysex (host_connection_query (bytes));
} else {
if (!_active) {
- _active = true;
- zero_controls ();
- for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
- (*s)->notify_all ();
- }
- update_view_mode_display ();
+ turn_it_on ();
}
}
break;
return MidiByteArray (2, 0x13, 0x00);
}
+void
+Surface::turn_it_on ()
+{
+ if (!_active) {
+ _active = true;
+ zero_controls ();
+ for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
+ (*s)->notify_all ();
+ }
+ update_view_mode_display ();
+ }
+}
+
void
-Surface::handle_port_inactive (SurfacePort * port)
+Surface::handle_port_inactive (SurfacePort*)
{
_active = false;
}
Surface::map_routes (const vector<boost::shared_ptr<Route> >& routes)
{
vector<boost::shared_ptr<Route> >::const_iterator r;
- Strips::iterator s;
+ Strips::iterator s = strips.begin();
- for (r = routes.begin(), s = strips.begin(); r != routes.end() && s != strips.end(); ++s) {
+ for (r = routes.begin(); r != routes.end() && s != strips.end(); ++s) {
/* don't try to assign routes to a locked strip. it won't
use it anyway, but if we do, then we get out of sync
show_two_char_display (os.str());
}
-void
-Surface::display_timecode (const std::string & timecode, const std::string & timecode_last)
+void
+Surface::display_timecode (const std::string & timecode, const std::string & last_timecode)
{
- if (_active && _mcp.device_info().has_timecode_display()) {
- _port->write (timecode_display (timecode, timecode_last));
+ if (!_active || !_mcp.device_info().has_timecode_display()) {
+ return;
}
-}
-
-MidiByteArray
-Surface::timecode_display (const std::string & timecode, const std::string & last_timecode)
-{
// if there's no change, send nothing, not even sysex header
- if (timecode == last_timecode) return MidiByteArray();
+ if (timecode == last_timecode) return;
// length sanity checking
string local_timecode = timecode;
// find the suffix of local_timecode that differs from last_timecode
std::pair<string::const_iterator,string::iterator> pp = mismatch (last_timecode.begin(), last_timecode.end(), local_timecode.begin());
- MidiByteArray retval;
-
- // sysex header
- retval << sysex_hdr();
-
- // code for timecode display
- retval << 0x10;
-
+ int position = 0x40;
+
// translate characters. These are sent in reverse order of display
// hence the reverse iterators
string::reverse_iterator rend = reverse_iterator<string::iterator> (pp.second);
for (string::reverse_iterator it = local_timecode.rbegin(); it != rend; ++it) {
+ MidiByteArray retval (2, 0xb0, position++);
retval << translate_seven_segment (*it);
+ _port->write (retval);
}
-
- // sysex trailer
- retval << MIDI::eox;
-
- return retval;
}
void
}
void
-Surface::gui_selection_changed (ARDOUR::RouteNotificationListPtr routes)
+Surface::gui_selection_changed (const ARDOUR::StrongRouteNotificationList& routes)
{
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
(*s)->gui_selection_changed (routes);
}
void
-Surface::set_jog_mode (JogWheel::Mode m)
+Surface::set_jog_mode (JogWheel::Mode)
{
}