MCP: try to fix madness with extender strip indices
git-svn-id: svn://localhost/ardour2/branches/3.0@11819 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
1e1ceaba7e
commit
9cdeaa30b9
@ -185,15 +185,10 @@ MackiePort&
|
||||
MackieControlProtocol::port_for_id (uint32_t index)
|
||||
{
|
||||
uint32_t current_max = 0;
|
||||
|
||||
cerr << "Looking for port for index " << index << endl;
|
||||
|
||||
|
||||
for (MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it) {
|
||||
cerr << "\tport " << (*it)->input_port().name() << '/' << (*it)->output_port().name() << " has " << (*it)->strips() << endl;
|
||||
current_max += (*it)->strips();
|
||||
if (index < current_max) {
|
||||
cerr << "\t\tUSE IT\n";
|
||||
return **it;
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,14 @@
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
#include "pbd/compose.h"
|
||||
|
||||
#include "ardour/debug.h"
|
||||
#include "controls.h"
|
||||
#include "midi_byte_array.h"
|
||||
#include "mackie_port.h"
|
||||
|
||||
using namespace PBD;
|
||||
using namespace Mackie;
|
||||
using namespace std;
|
||||
|
||||
@ -191,39 +195,40 @@ MidiByteArray MackieMidiBuilder::strip_display_blank( SurfacePort & port, const
|
||||
return strip_display( port, strip, line_number, " " );
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
assert (line_number <= 1);
|
||||
assert (strip.index() < 8);
|
||||
|
||||
#ifdef NUCLEUS_DEBUG
|
||||
cout << "MackieMidiBuilder::strip_display index: " << strip.index() << ", line " << line_number << ": " << line << endl;
|
||||
#endif
|
||||
|
||||
MidiByteArray retval;
|
||||
|
||||
uint32_t index = strip.index() % port.strips();
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("MackieMidiBuilder::strip_display index: %1, line %2 = %3\n", strip.index(), line_number, line));
|
||||
|
||||
// sysex header
|
||||
retval << port.sysex_hdr();
|
||||
|
||||
// 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 << (index * 7 + (line_number * 0x38));
|
||||
|
||||
// ascii data to display
|
||||
retval << line;
|
||||
// pad with " " out to 6 chars
|
||||
for ( int i = line.length(); i < 6; ++i ) retval << ' ';
|
||||
for (int i = line.length(); i < 6; ++i) {
|
||||
retval << ' ';
|
||||
}
|
||||
|
||||
// column spacer, unless it's the right-hand column
|
||||
if ( strip.index() < 7 ) retval << ' ';
|
||||
if (strip.index() < 7) {
|
||||
retval << ' ';
|
||||
}
|
||||
|
||||
// sysex trailer
|
||||
retval << MIDI::eox;
|
||||
|
||||
#ifdef NUCLEUS_DEBUG
|
||||
cout << "MackieMidiBuilder::strip_display midi: " << retval << endl;
|
||||
#endif
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("MackieMidiBuilder::strip_display midi: %1\n", retval));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "ardour/debug.h"
|
||||
#include "surface.h"
|
||||
|
||||
#include <sstream>
|
||||
@ -5,6 +6,7 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace PBD;
|
||||
using namespace Mackie;
|
||||
|
||||
Surface::Surface( uint32_t max_strips, uint32_t unit_strips )
|
||||
@ -14,14 +16,10 @@ Surface::Surface( uint32_t max_strips, uint32_t unit_strips )
|
||||
|
||||
void Surface::init()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
cout << "Surface::init" << endl;
|
||||
#endif
|
||||
DEBUG_TRACE (DEBUG::MackieControl, "Surface::init\n");
|
||||
init_controls();
|
||||
init_strips( _max_strips, _unit_strips );
|
||||
#ifdef DEBUG
|
||||
cout << "Surface::init finish" << endl;
|
||||
#endif
|
||||
DEBUG_TRACE (DEBUG::MackieControl, "Surface::init finish\n");
|
||||
}
|
||||
|
||||
Surface::~Surface()
|
||||
@ -42,12 +40,13 @@ Surface::~Surface()
|
||||
// Mackie-specific, because of multiple devices on separate ports
|
||||
// add the strips from 9..max_strips
|
||||
// unit_strips is the number of strips for additional units.
|
||||
void Surface::init_strips( uint32_t max_strips, uint32_t unit_strips )
|
||||
void Surface::init_strips (uint32_t max_strips, uint32_t unit_strips)
|
||||
{
|
||||
if ( strips.size() < max_strips )
|
||||
{
|
||||
if ( strips.size() < max_strips ) {
|
||||
|
||||
uint32_t const old_size = strips.size();
|
||||
strips.resize (max_strips);
|
||||
|
||||
for (uint32_t i = old_size; i < max_strips; ++i) {
|
||||
// because I can't find itoa
|
||||
ostringstream os;
|
||||
@ -62,8 +61,8 @@ void Surface::init_strips( uint32_t max_strips, uint32_t unit_strips )
|
||||
Strip * strip = new Strip( *strips[i % unit_strips] );
|
||||
|
||||
// update the relevant values
|
||||
strip->index( i );
|
||||
strip->name( name );
|
||||
strip->index (i);
|
||||
strip->name (name);
|
||||
|
||||
// add to data structures
|
||||
groups[name] = strip;
|
||||
|
Loading…
Reference in New Issue
Block a user