From aee603ea9d7d2c317cf93783bdbafeec43d2ada4 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Mon, 30 Jul 2007 11:18:00 +0000 Subject: pass a Strip & to strip_display instead of integer. Implement and use strip_display_blank. git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2186 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/surfaces/mackie/TODO | 1 + libs/surfaces/mackie/mackie_control_protocol.cc | 6 ++---- libs/surfaces/mackie/mackie_midi_builder.cc | 21 ++++++++++++++------- libs/surfaces/mackie/mackie_midi_builder.h | 9 ++++++--- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/libs/surfaces/mackie/TODO b/libs/surfaces/mackie/TODO index 7917b380da..245929886c 100644 --- a/libs/surfaces/mackie/TODO +++ b/libs/surfaces/mackie/TODO @@ -1,4 +1,5 @@ * if mackie wheel moves too fast, it's ignored. +* active (pressed?) state for controls, including timeout * update manual with jog wheel states * alsa/sequencer ports unstable. possibly problems with use of ::poll * use glib::timeout for check_scrubbing diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 14b2e348ff..d0b977c57f 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -1003,7 +1003,6 @@ void MackieControlProtocol::notify_name_changed( void *, RouteSignal * route_sig if ( !strip.is_master() ) { string line1; - string line2; string fullname = route_signal->route().name(); if ( fullname.length() <= 6 ) @@ -1013,14 +1012,13 @@ void MackieControlProtocol::notify_name_changed( void *, RouteSignal * route_sig else { line1 = PBD::short_version( fullname, 6 ); - line2 = fullname.substr( fullname.length() - 6, 6 ); } route_signal->port().write_sysex( - builder.strip_display( strip.index(), 0, line1 ) + builder.strip_display( strip, 0, line1 ) ); route_signal->port().write_sysex( - builder.strip_display( strip.index(), 1, line2 ) + builder.strip_display_blank( strip, 1 ) ); } } diff --git a/libs/surfaces/mackie/mackie_midi_builder.cc b/libs/surfaces/mackie/mackie_midi_builder.cc index 8ddbff1043..d16aecf5e1 100644 --- a/libs/surfaces/mackie/mackie_midi_builder.cc +++ b/libs/surfaces/mackie/mackie_midi_builder.cc @@ -110,6 +110,8 @@ MidiByteArray MackieMidiBuilder::zero_strip( const Strip & strip ) if ( control.accepts_feedback() ) retval << zero_control( control ); } + retval << strip_display_blank( strip, 0 ); + retval << strip_display_blank( strip, 1 ); return retval; } @@ -172,30 +174,35 @@ MidiByteArray MackieMidiBuilder::two_char_display( unsigned int value, const std return two_char_display( os.str() ); } -MidiByteArray MackieMidiBuilder::strip_display( unsigned int strip_index, unsigned int line_number, const std::string & line ) +MidiByteArray MackieMidiBuilder::strip_display_blank( const Strip & strip, unsigned int line_number ) +{ + // 6 spaces, not 7 because strip_display adds a space where appropriate + return strip_display( strip, line_number, " " ); +} + +MidiByteArray MackieMidiBuilder::strip_display( const Strip & strip, unsigned int line_number, const std::string & line ) { if ( line_number > 1 ) { throw runtime_error( "line_number must be 0 or 1" ); } - if ( strip_index > 7 ) + if ( strip.index() > 7 ) { - throw runtime_error( "strip_index must be between 0 and 7" ); + throw runtime_error( "strip.index() must be between 0 and 7" ); } - cout << "MackieMidiBuilder::strip_display index: " << strip_index << ", line " << line_number << ": " << line << endl; + cout << "MackieMidiBuilder::strip_display index: " << strip.index() << ", line " << line_number << ": " << line << endl; MidiByteArray retval; // code for display retval << 0x12; // offset (0 to 0x37 first line, 0x38 to 0x6f for second line ) - retval << ( strip_index * 7 + ( line_number * 0x38 ) ); + retval << ( strip.index() * 7 + ( line_number * 0x38 ) ); // ascii data to display retval << line; - // column spacer, unless it's the right-hand column - if ( strip_index < 7 ) + if ( strip.index() < 7 ) { retval << ' '; } diff --git a/libs/surfaces/mackie/mackie_midi_builder.h b/libs/surfaces/mackie/mackie_midi_builder.h index d039fb43d1..96e4b3f0f9 100644 --- a/libs/surfaces/mackie/mackie_midi_builder.h +++ b/libs/surfaces/mackie/mackie_midi_builder.h @@ -62,6 +62,7 @@ public: MidiByteArray build_fader( const Fader & fader, float pos ); /// return bytes that will reset all controls to their zero positions + /// And blank the display for the strip MidiByteArray zero_strip( const Strip & strip ); // provide bytes to zero the given control @@ -73,9 +74,11 @@ public: MidiByteArray two_char_display( const std::string & msg, const std::string & dots = " " ); MidiByteArray two_char_display( unsigned int value, const std::string & dots = " " ); - /// for displaying a particular strip name - /// index is zero-based - MidiByteArray strip_display( unsigned int strip_index, unsigned int line_number, const std::string & line ); + /// for displaying characters on the strip LCD + MidiByteArray strip_display( const Strip & strip, unsigned int line_number, const std::string & line ); + + /// blank the strip LCD, ie write all spaces + MidiByteArray strip_display_blank( const Strip & strip, unsigned int line_number ); /// for generating all strip names MidiByteArray all_strips_display( std::vector & lines1, std::vector & lines2 ); -- cgit v1.2.3