#include <cmath>
+#include "pbd/compose.h"
+
+#include "ardour/debug.h"
+
#include "fader.h"
#include "surface.h"
#include "control_group.h"
using namespace ArdourSurface;
using namespace Mackie;
+using namespace PBD;
Control*
Fader::factory (Surface& surface, int id, const char* name, Group& group)
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);
}
* 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",
- fader_id, pb, _number));
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface::handle_midi_pitchbend_message on port %3, fader = %1 value = %2 (%4)\n",
+ fader_id, pb, _number, pb/16384.0));
if (_mcp.device_info().no_handshake()) {
turn_it_on ();
if (fader) {
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) {
strip->handle_fader (*fader, pos);
} else {