X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=midi_mapper.h;h=445cc2e96d910254de77172630e7c0c9167c3ab6;hb=8f83d8ec96c5dd1a1b9d17489d3a93bde3eacac2;hp=84baf1f98d707760051e0142bf35f067b7a2cce0;hpb=afe996bc7dfc8689ca356d00824fbfcd632f93a2;p=nageru diff --git a/midi_mapper.h b/midi_mapper.h index 84baf1f..445cc2e 100644 --- a/midi_mapper.h +++ b/midi_mapper.h @@ -39,6 +39,10 @@ public: virtual void toggle_auto_gain_staging(unsigned bus_idx) = 0; virtual void toggle_compressor(unsigned bus_idx) = 0; virtual void clear_peak(unsigned bus_idx) = 0; + + // Raw events; used for the editor dialog only. + virtual void controller_changed(unsigned controller) = 0; + virtual void note_on(unsigned note) = 0; }; class MIDIMapper { @@ -49,6 +53,9 @@ public: void start_thread(); const MIDIMappingProto &get_current_mapping() const; + // Overwrites and returns the previous value. + ControllerReceiver *set_receiver(ControllerReceiver *new_receiver); + private: void thread_func(); void handle_event(snd_seq_t *seq, snd_seq_event_t *event); @@ -57,11 +64,11 @@ private: void match_button(int note, int field_number, int bank_field_number, std::function func); bool bank_mismatch(int bank_field_number); - ControllerReceiver *receiver; std::atomic should_quit{false}; int should_quit_fd; mutable std::mutex mapping_mu; + ControllerReceiver *receiver; // Under . std::unique_ptr mapping_proto; // Under . int num_controller_banks; // Under . std::atomic current_controller_bank{0}; @@ -70,5 +77,6 @@ private: }; bool load_midi_mapping_from_file(const std::string &filename, MIDIMappingProto *new_mapping); +bool save_midi_mapping_to_file(const MIDIMappingProto &mapping_proto, const std::string &filename); #endif // !defined(_MIDI_MAPPER_H)