mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 17:16:38 +01:00
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
3 changed files with 28 additions and 29 deletions
|
|
@ -186,14 +186,9 @@ MackieControlProtocol::port_for_id (uint32_t index)
|
||||||
{
|
{
|
||||||
uint32_t current_max = 0;
|
uint32_t current_max = 0;
|
||||||
|
|
||||||
cerr << "Looking for port for index " << index << endl;
|
|
||||||
|
|
||||||
|
|
||||||
for (MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it) {
|
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();
|
current_max += (*it)->strips();
|
||||||
if (index < current_max) {
|
if (index < current_max) {
|
||||||
cerr << "\t\tUSE IT\n";
|
|
||||||
return **it;
|
return **it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,14 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "pbd/compose.h"
|
||||||
|
|
||||||
|
#include "ardour/debug.h"
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
#include "midi_byte_array.h"
|
#include "midi_byte_array.h"
|
||||||
#include "mackie_port.h"
|
#include "mackie_port.h"
|
||||||
|
|
||||||
|
using namespace PBD;
|
||||||
using namespace Mackie;
|
using namespace Mackie;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
@ -191,16 +195,14 @@ MidiByteArray MackieMidiBuilder::strip_display_blank( SurfacePort & port, const
|
||||||
return strip_display( port, strip, line_number, " " );
|
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 (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;
|
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
|
// sysex header
|
||||||
retval << port.sysex_hdr();
|
retval << port.sysex_hdr();
|
||||||
|
|
@ -208,22 +210,25 @@ MidiByteArray MackieMidiBuilder::strip_display( SurfacePort & port, const Strip
|
||||||
// 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 )
|
||||||
retval << ( strip.index() * 7 + ( line_number * 0x38 ) );
|
retval << (index * 7 + (line_number * 0x38));
|
||||||
|
|
||||||
// ascii data to display
|
// ascii data to display
|
||||||
retval << line;
|
retval << line;
|
||||||
// pad with " " out to 6 chars
|
// 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
|
// column spacer, unless it's the right-hand column
|
||||||
if ( strip.index() < 7 ) retval << ' ';
|
if (strip.index() < 7) {
|
||||||
|
retval << ' ';
|
||||||
|
}
|
||||||
|
|
||||||
// sysex trailer
|
// sysex trailer
|
||||||
retval << MIDI::eox;
|
retval << MIDI::eox;
|
||||||
|
|
||||||
#ifdef NUCLEUS_DEBUG
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("MackieMidiBuilder::strip_display midi: %1\n", retval));
|
||||||
cout << "MackieMidiBuilder::strip_display midi: " << retval << endl;
|
|
||||||
#endif
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "ardour/debug.h"
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
@ -5,6 +6,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace PBD;
|
||||||
using namespace Mackie;
|
using namespace Mackie;
|
||||||
|
|
||||||
Surface::Surface( uint32_t max_strips, uint32_t unit_strips )
|
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()
|
void Surface::init()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
DEBUG_TRACE (DEBUG::MackieControl, "Surface::init\n");
|
||||||
cout << "Surface::init" << endl;
|
|
||||||
#endif
|
|
||||||
init_controls();
|
init_controls();
|
||||||
init_strips( _max_strips, _unit_strips );
|
init_strips( _max_strips, _unit_strips );
|
||||||
#ifdef DEBUG
|
DEBUG_TRACE (DEBUG::MackieControl, "Surface::init finish\n");
|
||||||
cout << "Surface::init finish" << endl;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface::~Surface()
|
Surface::~Surface()
|
||||||
|
|
@ -42,12 +40,13 @@ Surface::~Surface()
|
||||||
// Mackie-specific, because of multiple devices on separate ports
|
// Mackie-specific, because of multiple devices on separate ports
|
||||||
// add the strips from 9..max_strips
|
// add the strips from 9..max_strips
|
||||||
// unit_strips is the number of strips for additional units.
|
// 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();
|
uint32_t const old_size = strips.size();
|
||||||
strips.resize (max_strips);
|
strips.resize (max_strips);
|
||||||
|
|
||||||
for (uint32_t i = old_size; i < max_strips; ++i) {
|
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;
|
||||||
|
|
@ -62,8 +61,8 @@ void Surface::init_strips( uint32_t max_strips, uint32_t unit_strips )
|
||||||
Strip * strip = new Strip( *strips[i % unit_strips] );
|
Strip * strip = new Strip( *strips[i % unit_strips] );
|
||||||
|
|
||||||
// update the relevant values
|
// update the relevant values
|
||||||
strip->index( i );
|
strip->index (i);
|
||||||
strip->name( name );
|
strip->name (name);
|
||||||
|
|
||||||
// add to data structures
|
// add to data structures
|
||||||
groups[name] = strip;
|
groups[name] = strip;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue