#include <functional>
#include <memory>
#include <mutex>
-#include <set>
#include <string>
#include <thread>
virtual void preview() = 0;
virtual void queue() = 0;
virtual void play() = 0;
+ virtual void next() = 0;
+ virtual void toggle_lock() = 0;
virtual void jog(int delta) = 0;
virtual void switch_camera(unsigned camera_idx) = 0;
+ virtual void set_master_speed(float speed) = 0;
virtual void cue_in() = 0;
virtual void cue_out() = 0;
class MIDIMapper : public MIDIReceiver {
public:
+ // Converts conveniently from a bool.
+ enum LightState {
+ Off = 0,
+ On = 1,
+ Blinking = 2
+ };
+
MIDIMapper(ControllerReceiver *receiver);
virtual ~MIDIMapper();
void set_midi_mapping(const MIDIMappingProto &new_mapping);
void refresh_lights();
- void set_preview_enabled(bool enabled) {
+ void set_preview_enabled(LightState enabled) {
preview_enabled_light = enabled;
refresh_lights();
}
queue_enabled_light = enabled;
refresh_lights();
}
- void set_play_enabled(bool enabled) {
+ void set_play_enabled(LightState enabled) {
play_enabled_light = enabled;
refresh_lights();
}
+ void set_next_ready(LightState enabled) {
+ next_ready_light = enabled;
+ refresh_lights();
+ }
+ void set_locked(LightState locked) {
+ locked_light = locked;
+ refresh_lights();
+ }
void highlight_camera_input(int stream_idx) { // -1 for none.
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;
bool bank_mismatch(int bank_field_number);
void update_lights_lock_held();
- void activate_lights_all_buses(int field_number, std::set<unsigned> *active_lights);
std::atomic<bool> should_quit{false};
- int should_quit_fd;
mutable std::mutex mu;
ControllerReceiver *receiver; // Under <mu>.
int num_controller_banks; // Under <mu>.
std::atomic<int> current_controller_bank{0};
- std::atomic<bool> preview_enabled_light{false};
+ std::atomic<LightState> preview_enabled_light{Off};
std::atomic<bool> queue_enabled_light{false};
- std::atomic<bool> play_enabled_light{false};
+ std::atomic<LightState> play_enabled_light{Off};
+ std::atomic<LightState> next_ready_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;
};