mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
fix handler of fader (pitchbend) messages in Mackie Control so that the outbound messages match the inbound ones
Pitch bend values really can span 0 to 16384, not 16383
This commit is contained in:
parent
71bf231199
commit
918133a342
2 changed files with 10 additions and 4 deletions
|
|
@ -19,6 +19,10 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "pbd/compose.h"
|
||||||
|
|
||||||
|
#include "ardour/debug.h"
|
||||||
|
|
||||||
#include "fader.h"
|
#include "fader.h"
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
#include "control_group.h"
|
#include "control_group.h"
|
||||||
|
|
@ -26,6 +30,7 @@
|
||||||
|
|
||||||
using namespace ArdourSurface;
|
using namespace ArdourSurface;
|
||||||
using namespace Mackie;
|
using namespace Mackie;
|
||||||
|
using namespace PBD;
|
||||||
|
|
||||||
Control*
|
Control*
|
||||||
Fader::factory (Surface& surface, int id, const char* name, Group& group)
|
Fader::factory (Surface& surface, int id, const char* name, Group& group)
|
||||||
|
|
@ -54,6 +59,7 @@ Fader::update_message ()
|
||||||
return MidiByteArray();
|
return MidiByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
int posi = lrintf (0x3fff * position);
|
int posi = lrintf (16384.0 * position);
|
||||||
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("generate fader message for position %1 (%2)\n", position, posi));
|
||||||
return MidiByteArray (3, 0xe0 + id(), posi & 0x7f, posi >> 7);
|
return MidiByteArray (3, 0xe0 + id(), posi & 0x7f, posi >> 7);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -396,8 +396,8 @@ Surface::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb, uin
|
||||||
* when we connected to the per-channel pitchbend events.
|
* when we connected to the per-channel pitchbend events.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface::handle_midi_pitchbend_message on port %3, fader = %1 value = %2\n",
|
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface::handle_midi_pitchbend_message on port %3, fader = %1 value = %2 (%4)\n",
|
||||||
fader_id, pb, _number));
|
fader_id, pb, _number, pb/16384.0));
|
||||||
|
|
||||||
if (_mcp.device_info().no_handshake()) {
|
if (_mcp.device_info().no_handshake()) {
|
||||||
turn_it_on ();
|
turn_it_on ();
|
||||||
|
|
@ -407,7 +407,7 @@ Surface::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb, uin
|
||||||
|
|
||||||
if (fader) {
|
if (fader) {
|
||||||
Strip* strip = dynamic_cast<Strip*> (&fader->group());
|
Strip* strip = dynamic_cast<Strip*> (&fader->group());
|
||||||
float pos = (pb >> 4)/1023.0; // only the top 10 bytes are used
|
float pos = pb / 16384.0;
|
||||||
if (strip) {
|
if (strip) {
|
||||||
strip->handle_fader (*fader, pos);
|
strip->handle_fader (*fader, pos);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue