fix for #3 mute button not lighting at startup. Because LCD messages sent as straight bytes instead of sysex msg.

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2271 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
John Anderson 2007-08-08 18:09:27 +00:00
parent e2af5ea6fc
commit c02991ca5d
4 changed files with 47 additions and 24 deletions

View file

@ -1,5 +1,8 @@
* fader problem (reported by Giso Grimm). Also with P4 (hyperthread)
* two bcf doesn't work
* remappable buttons * remappable buttons
* 7/1 configurable to 8 * 7/1 configurable to 8
* need an object that can encapsulate different port types, ie BCF vs MCU. Not at the surface level.
* finish button implementations. * finish button implementations.
* concurrency for bank switching? And make sure "old" events aren't sent to "new" faders * concurrency for bank switching? And make sure "old" events aren't sent to "new" faders
* TODOs in code * TODOs in code
@ -41,3 +44,8 @@ UI integration
* maybe use current snap state for jog wheel and ffwd/rew * maybe use current snap state for jog wheel and ffwd/rew
* Some indication on the UI of currently bank-switched-in routes? * Some indication on the UI of currently bank-switched-in routes?
Useful for surfaces that don't have a scribble strip. Useful for surfaces that don't have a scribble strip.
Bugs
----
* when using alsa/sequencer, some midi events intended for mcu port end up being
read by the seq port.

View file

@ -309,7 +309,8 @@ void MackieControlProtocol::switch_banks( int initial )
{ {
Strip & strip = *surface().strips[i]; Strip & strip = *surface().strips[i];
// send zero for this strip // send zero for this strip
port_for_id(i).write( builder.zero_strip( strip ) ); MackiePort & port = port_for_id(i);
port.write( builder.zero_strip( port, strip ) );
} }
} }
@ -342,11 +343,12 @@ void MackieControlProtocol::zero_all()
// zero all strips // zero all strips
for ( Surface::Strips::iterator it = surface().strips.begin(); it != surface().strips.end(); ++it ) for ( Surface::Strips::iterator it = surface().strips.begin(); it != surface().strips.end(); ++it )
{ {
port_for_id( (*it)->index() ).write( builder.zero_strip( **it ) ); MackiePort & port = port_for_id( (*it)->index() );
port.write( builder.zero_strip( port, **it ) );
} }
// and the master strip // and the master strip
mcu_port().write( builder.zero_strip( master_strip() ) ); mcu_port().write( builder.zero_strip( mcu_port(), master_strip() ) );
// and the led ring for the master strip, in bcf mode // and the led ring for the master strip, in bcf mode
if ( mcu_port().emulation() == MackiePort::bcf2000 ) if ( mcu_port().emulation() == MackiePort::bcf2000 )
@ -1006,12 +1008,9 @@ void MackieControlProtocol::notify_name_changed( void *, RouteSignal * route_sig
line1 = PBD::short_version( fullname, 6 ); line1 = PBD::short_version( fullname, 6 );
} }
route_signal->port().write_sysex( MackiePort & port = route_signal->port();
builder.strip_display( strip, 0, line1 ) port.write( builder.strip_display( port, strip, 0, line1 ) );
); port.write( builder.strip_display_blank( port, strip, 1 ) );
route_signal->port().write_sysex(
builder.strip_display_blank( strip, 1 )
);
} }
} }
catch( exception & e ) catch( exception & e )

View file

@ -23,6 +23,7 @@
#include "controls.h" #include "controls.h"
#include "midi_byte_array.h" #include "midi_byte_array.h"
#include "mackie_port.h"
using namespace Mackie; using namespace Mackie;
using namespace std; using namespace std;
@ -100,7 +101,7 @@ MidiByteArray MackieMidiBuilder::build_fader( const Fader & fader, float pos )
); );
} }
MidiByteArray MackieMidiBuilder::zero_strip( const Strip & strip ) MidiByteArray MackieMidiBuilder::zero_strip( MackiePort & port, const Strip & strip )
{ {
Group::Controls::const_iterator it = strip.controls().begin(); Group::Controls::const_iterator it = strip.controls().begin();
MidiByteArray retval; MidiByteArray retval;
@ -110,8 +111,10 @@ MidiByteArray MackieMidiBuilder::zero_strip( const Strip & strip )
if ( control.accepts_feedback() ) if ( control.accepts_feedback() )
retval << zero_control( control ); retval << zero_control( control );
} }
retval << strip_display_blank( strip, 0 );
retval << strip_display_blank( strip, 1 ); // These must have sysex headers
retval << strip_display_blank( port, strip, 0 );
retval << strip_display_blank( port, strip, 1 );
return retval; return retval;
} }
@ -174,13 +177,13 @@ MidiByteArray MackieMidiBuilder::two_char_display( unsigned int value, const std
return two_char_display( os.str() ); return two_char_display( os.str() );
} }
MidiByteArray MackieMidiBuilder::strip_display_blank( const Strip & strip, unsigned int line_number ) MidiByteArray MackieMidiBuilder::strip_display_blank( MackiePort & port, const Strip & strip, unsigned int line_number )
{ {
// 6 spaces, not 7 because strip_display adds a space where appropriate // 6 spaces, not 7 because strip_display adds a space where appropriate
return strip_display( strip, line_number, " " ); return strip_display( port, strip, line_number, " " );
} }
MidiByteArray MackieMidiBuilder::strip_display( const Strip & strip, unsigned int line_number, const std::string & line ) MidiByteArray MackieMidiBuilder::strip_display( MackiePort & port, const Strip & strip, unsigned int line_number, const std::string & line )
{ {
if ( line_number > 1 ) if ( line_number > 1 )
{ {
@ -197,6 +200,10 @@ MidiByteArray MackieMidiBuilder::strip_display( const Strip & strip, unsigned in
#endif #endif
MidiByteArray retval; MidiByteArray retval;
// sysex header
retval << port.sysex_hdr();
// code for display // code for display
retval << 0x12; retval << 0x12;
// offset (0 to 0x37 first line, 0x38 to 0x6f for second line ) // offset (0 to 0x37 first line, 0x38 to 0x6f for second line )
@ -209,13 +216,17 @@ MidiByteArray MackieMidiBuilder::strip_display( const Strip & strip, unsigned in
retval << ' '; retval << ' ';
} }
// sysex trailer
retval << MIDI::eox;
#ifdef DEBUG #ifdef DEBUG
cout << "MackieMidiBuilder::strip_display midi: " << retval << endl; cout << "MackieMidiBuilder::strip_display midi: " << retval << endl;
#endif #endif
return retval; return retval;
} }
MidiByteArray MackieMidiBuilder::all_strips_display( std::vector<std::string> & lines1, std::vector<std::string> & lines2 ) MidiByteArray MackieMidiBuilder::all_strips_display( MackiePort & port, std::vector<std::string> & lines1, std::vector<std::string> & lines2 )
{ {
MidiByteArray retval; MidiByteArray retval;
retval << 0x12 << 0; retval << 0x12 << 0;

View file

@ -25,6 +25,8 @@
namespace Mackie namespace Mackie
{ {
class MackiePort;
/** /**
This knows how to build midi messages given a control and This knows how to build midi messages given a control and
a state. a state.
@ -62,8 +64,8 @@ public:
MidiByteArray build_fader( const Fader & fader, float pos ); MidiByteArray build_fader( const Fader & fader, float pos );
/// return bytes that will reset all controls to their zero positions /// return bytes that will reset all controls to their zero positions
/// And blank the display for the strip /// And blank the display for the strip. Pass MackiePort so we know which sysex header to use.
MidiByteArray zero_strip( const Strip & strip ); MidiByteArray zero_strip( MackiePort &, const Strip & strip );
// provide bytes to zero the given control // provide bytes to zero the given control
MidiByteArray zero_control( const Control & control ); MidiByteArray zero_control( const Control & control );
@ -74,14 +76,17 @@ public:
MidiByteArray two_char_display( const std::string & msg, const std::string & dots = " " ); MidiByteArray two_char_display( const std::string & msg, const std::string & dots = " " );
MidiByteArray two_char_display( unsigned int value, const std::string & dots = " " ); MidiByteArray two_char_display( unsigned int value, const std::string & dots = " " );
/// for displaying characters on the strip LCD /**
MidiByteArray strip_display( const Strip & strip, unsigned int line_number, const std::string & line ); for displaying characters on the strip LCD
pass MackiePort so we know which sysex header to use
*/
MidiByteArray strip_display( MackiePort &, const Strip & strip, unsigned int line_number, const std::string & line );
/// blank the strip LCD, ie write all spaces /// blank the strip LCD, ie write all spaces. Pass MackiePort so we know which sysex header to use.
MidiByteArray strip_display_blank( const Strip & strip, unsigned int line_number ); MidiByteArray strip_display_blank( MackiePort &, const Strip & strip, unsigned int line_number );
/// for generating all strip names /// for generating all strip names. Pass MackiePort so we know which sysex header to use.
MidiByteArray all_strips_display( std::vector<std::string> & lines1, std::vector<std::string> & lines2 ); MidiByteArray all_strips_display( MackiePort &, std::vector<std::string> & lines1, std::vector<std::string> & lines2 );
protected: protected:
static MIDI::byte calculate_pot_value( midi_pot_mode mode, const ControlState & ); static MIDI::byte calculate_pot_value( midi_pot_mode mode, const ControlState & );