From 0e59f90e2396190ec3e3a7195bac9c79e12fd6cc Mon Sep 17 00:00:00 2001 From: Sander Vocke Date: Tue, 23 Jul 2024 13:23:38 +0200 Subject: Add CC-controller openness parameter for hi-hats. --- src/midimapper.h | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'src/midimapper.h') diff --git a/src/midimapper.h b/src/midimapper.h index 94781d4..064f88a 100644 --- a/src/midimapper.h +++ b/src/midimapper.h @@ -31,10 +31,33 @@ #include #include +enum class MapFrom { + Note, + CC, + NoneOrAny +}; + +enum class MapTo { + PlayInstrument, + InstrumentState, + NoneOrAny +}; + +enum class InstrumentStateKind { + Position, + Openness, + NoneOrAny +}; + struct MidimapEntry { - int note_id; + MapFrom from_kind; + MapTo to_kind; + int from_id; // note or CC number std::string instrument_name; + InstrumentStateKind maybe_instrument_state_kind; + uint8_t state_min; // cc value mapping to state 0.0 + uint8_t state_max; // cc value mapping to state 1.0 }; using midimap_t = std::vector; @@ -43,8 +66,16 @@ using instrmap_t = std::map; class MidiMapper { public: - //! Lookup note in map and returns the corresponding instrument index list. - std::vector lookup(int note_id); + //! Lookup midi map entries matching the given query. + std::vector lookup( + int from_id = -1, // note or cc #. -1 matches all notes/cc's + MapFrom from_kind = MapFrom::NoneOrAny, // NoneOrAny will return both CC and note maps + MapTo to_kind = MapTo::NoneOrAny, // NoneOrAny will return both instrument hits and controls + InstrumentStateKind state_kind = InstrumentStateKind::NoneOrAny // NoneOrAny maps all state control kinds + ); + + int lookup_instrument(std::string name); + std::vector lookup_instruments(std::vector const& entries); //! Set new map sets. void swap(instrmap_t& instrmap, midimap_t& midimap); -- cgit v1.2.3