#include <limits>
#include <string>
+#include "controller_spin_box.h"
#include "midi_mapper.h"
-#include "midi_mapping.pb.h"
+#include "nageru_midi_mapping.pb.h"
#include "shared/post_to_main_thread.h"
#include "ui_midi_mapping.h"
item->setText(0, QString::fromStdString(control.label + " "));
for (unsigned bus_idx = 0; bus_idx < num_buses; ++bus_idx) {
- QSpinBox *spinner = new QSpinBox(this);
- spinner->setRange(-1, 127);
+ QSpinBox *spinner;
+ if (control_type == ControlType::CONTROLLER) {
+ spinner = new ControllerSpinBox(this);
+ spinner->setRange(-1, 128); // 128 for pitch bend.
+ } else {
+ spinner = new QSpinBox(this);
+ spinner->setRange(-1, 127);
+ }
spinner->setAutoFillBackground(true);
spinner->setSpecialValueText("\u200d"); // Zero-width joiner (ie., empty).
spinner->installEventFilter(this); // So we know when the focus changes.
// The bus has a controller set that the source bus doesn't set.
return not_found;
}
+ if (source_spinner->value() == MIDIReceiver::PITCH_BEND_CONTROLLER) {
+ // It's impossible to interpolate across the pitch bend.
+ return not_found;
+ }
int candidate_offset = spinner->value() - source_spinner->value();
if (!found_offset) {