Fix startup of the mackie surface code.

git-svn-id: svn://localhost/ardour2/branches/3.0@7520 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-07-29 19:24:25 +00:00
parent c2cf3c5bfd
commit 21fd76ef9a
5 changed files with 21 additions and 16 deletions

View file

@ -54,6 +54,7 @@ Port::Port (string const & name, Flags flags, jack_client_t* jack_client)
, input_fifo (1024) , input_fifo (1024)
, _flags (flags) , _flags (flags)
{ {
assert (jack_client);
init (name, flags); init (name, flags);
} }
@ -66,6 +67,8 @@ Port::Port (const XMLNode& node, jack_client_t* jack_client)
, output_fifo (512) , output_fifo (512)
, input_fifo (1024) , input_fifo (1024)
{ {
assert (jack_client);
Descriptor desc (node); Descriptor desc (node);
init (desc.tag, desc.flags); init (desc.tag, desc.flags);

View file

@ -277,6 +277,8 @@ MackieControlProtocol::switch_banks (int initial)
for (; it != end && it != sorted.end(); ++it, ++i) for (; it != end && it != sorted.end(); ++it, ++i)
{ {
boost::shared_ptr<Route> route = *it; boost::shared_ptr<Route> route = *it;
assert (surface().strips[i]);
Strip & strip = *surface().strips[i]; Strip & strip = *surface().strips[i];
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("remote id %1 connecting %2 to %3 with port %4\n", DEBUG_TRACE (DEBUG::MackieControl, string_compose ("remote id %1 connecting %2 to %3 with port %4\n",
@ -957,7 +959,9 @@ MackieControlProtocol::notify_property_changed (const PropertyChange& what_chang
try try
{ {
Strip & strip = route_signal->strip(); Strip & strip = route_signal->strip();
if (!strip.is_master())
/* XXX: not sure about this check to only display stuff for strips of index < 8 */
if (!strip.is_master() && strip.index() < 8)
{ {
string line1; string line1;
string fullname = route_signal->route()->name(); string fullname = route_signal->route()->name();

View file

@ -114,8 +114,13 @@ MidiByteArray MackieMidiBuilder::zero_strip( SurfacePort & port, const Strip & s
} }
// These must have sysex headers // These must have sysex headers
/* XXX: not sure about this check to only display stuff for strips of index < 8 */
if (strip.index() < 8) {
retval << strip_display_blank( port, strip, 0 ); retval << strip_display_blank( port, strip, 0 );
retval << strip_display_blank( port, strip, 1 ); retval << strip_display_blank( port, strip, 1 );
}
return retval; return retval;
} }
@ -186,15 +191,8 @@ MidiByteArray MackieMidiBuilder::strip_display_blank( SurfacePort & port, const
MidiByteArray MackieMidiBuilder::strip_display( SurfacePort & port, const Strip & strip, unsigned int line_number, const std::string & line ) MidiByteArray MackieMidiBuilder::strip_display( SurfacePort & port, const Strip & strip, unsigned int line_number, const std::string & line )
{ {
if ( line_number > 1 ) assert (line_number <= 1);
{ assert (strip.index() < 8);
throw runtime_error( "line_number must be 0 or 1" );
}
if ( strip.index() > 7 )
{
throw runtime_error( "strip.index() must be between 0 and 7" );
}
#ifdef DEBUG #ifdef DEBUG
cout << "MackieMidiBuilder::strip_display index: " << strip.index() << ", line " << line_number << ": " << line << endl; cout << "MackieMidiBuilder::strip_display index: " << strip.index() << ", line " << line_number << ": " << line << endl;

View file

@ -46,9 +46,9 @@ void Surface::init_strips( uint32_t max_strips, uint32_t unit_strips )
{ {
if ( strips.size() < max_strips ) if ( strips.size() < max_strips )
{ {
strips.resize( max_strips ); uint32_t const old_size = strips.size();
for ( uint32_t i = strips.size(); i < max_strips; ++i ) strips.resize (max_strips);
{ for (uint32_t i = old_size; i < max_strips; ++i) {
// because I can't find itoa // because I can't find itoa
ostringstream os; ostringstream os;
os << "strip_" << i + 1; os << "strip_" << i + 1;

View file

@ -124,7 +124,7 @@ MidiByteArray SurfacePort::read()
void SurfacePort::write( const MidiByteArray & mba ) void SurfacePort::write( const MidiByteArray & mba )
{ {
#ifdef PORT_DEBUG #ifdef PORT_DEBUG
cout << "SurfacePort::write: " << mba << endl; cout << "SurfacePort::write: " << mba << " to " << output_port().name() << endl;
#endif #endif
// check active before and after lock - to make sure // check active before and after lock - to make sure