# The slider (pitch bend) is mapped to master speed.
master_speed: { controller_number: 128 }
+master_speed_light: { controller_number: 10 }
+master_speed_light_min: 1
+master_speed_light_max: 16
# Master speed lock is mapped to lock.
toggle_lock: { note_number: 25 }
optional MIDIControllerProto master_speed = 34;
optional int32 master_speed_bank = 35;
+ optional MIDIControllerProto master_speed_light = 42; // NOTE: Controller, not light.
+ optional int32 master_speed_light_min = 43;
+ optional int32 master_speed_light_max = 44 [default=128]; // Exclusive.
// Buttons.
optional MIDIButtonProto preview = 18;
float speed = percent / 100.0f;
ui->speed_lock_btn->setText(QString::fromStdString(" " + to_string(percent) + "%"));
live_player->set_master_speed(speed);
+ midi_mapper.set_speed_light(speed);
}
void MainWindow::speed_lock_clicked()
ui->speed_lock_btn->setText(QString::fromStdString(" " + to_string(percent) + "%"));
live_player->set_master_speed(speed);
+ midi_mapper.set_speed_light(speed);
});
}
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/message.h>
#include <google/protobuf/text_format.h>
+#include <math.h>
#include <pthread.h>
#include <poll.h>
#include <stdint.h>
activate_mapped_light(camera, CameraMIDIMappingProto::kIsCurrentFieldNumber, &active_lights);
}
+ // Master speed light.
+ if (mapping_proto->has_master_speed_light()) {
+ unsigned controller = mapping_proto->master_speed_light().controller_number();
+ unsigned min = mapping_proto->master_speed_light_min();
+ unsigned max = mapping_proto->master_speed_light_max();
+ int speed_light_value = lrintf((max - min - 1) * current_speed / 2.0f) + min;
+ active_lights[MIDIDevice::LightKey{MIDIDevice::LightKey::CONTROLLER, controller}] = speed_light_value;
+ }
+
// These are always enabled right now.
activate_mapped_light(*mapping_proto, MIDIMappingProto::kCueInEnabledFieldNumber, &active_lights);
activate_mapped_light(*mapping_proto, MIDIMappingProto::kCueOutEnabledFieldNumber, &active_lights);
current_highlighted_camera = stream_idx;
refresh_lights();
}
+ void set_speed_light(float speed) { // Goes from 0.0 to 2.0.
+ current_speed = speed;
+ refresh_lights();
+ }
// MIDIReceiver.
void controller_received(int controller, int value) override;
std::atomic<LightState> play_enabled_light{Off};
std::atomic<LightState> locked_light{On};
std::atomic<int> current_highlighted_camera{-1};
+ std::atomic<float> current_speed{1.0f};
MIDIDevice midi_device;
};