]> git.sesse.net Git - nageru/blobdiff - shared/midi_device.h
Support non-binary MIDI lights (ie., with an on-velocity different from 1).
[nageru] / shared / midi_device.h
index 498443931ab368ba931d2ead88192a969a27b116..9c76d18b9d1a667c18cf2111f9fc36d4ac63ee80 100644 (file)
@@ -7,7 +7,6 @@
 #include <atomic>
 #include <map>
 #include <mutex>
-#include <set>
 #include <thread>
 
 typedef struct snd_seq_addr snd_seq_addr_t;
@@ -33,7 +32,7 @@ public:
        ~MIDIDevice();
        void start_thread();
 
-       void update_lights(const std::set<unsigned> &active_lights)
+       void update_lights(const std::map<unsigned, uint8_t> &active_lights)
        {
                std::lock_guard<std::mutex> lock(mu);
                update_lights_lock_held(active_lights);
@@ -43,7 +42,7 @@ private:
        void thread_func();
        void handle_event(snd_seq_t *seq, snd_seq_event_t *event);
        void subscribe_to_port_lock_held(snd_seq_t *seq, const snd_seq_addr_t &addr);
-       void update_lights_lock_held(const std::set<unsigned> &active_lights);
+       void update_lights_lock_held(const std::map<unsigned, uint8_t> &active_lights);
 
        std::atomic<bool> should_quit{false};
        int should_quit_fd;
@@ -52,7 +51,7 @@ private:
        MIDIReceiver *receiver;  // Under <mu>.
 
        std::thread midi_thread;
-       std::map<unsigned, bool> current_light_status;  // Keyed by note number. Under <mu>.
+       std::map<unsigned, uint8_t> current_light_status;  // Keyed by note number. Under <mu>.
        snd_seq_t *alsa_seq{nullptr};  // Under <mu>.
        int alsa_queue_id{-1};  // Under <mu>.
        std::atomic<int> num_subscribed_ports{0};