summaryrefslogtreecommitdiff
path: root/src/midimapper.h
diff options
context:
space:
mode:
authorSander Vocke <sandervocke@gmail.com>2024-07-23 12:22:30 +0200
committerSander Vocke <sandervocke@gmail.com>2024-07-23 12:22:30 +0200
commit23f625be77c925569dfea8700103aff89d513b50 (patch)
treee9e794b31b3314bafc856c8da9c6eb0733e10eb7 /src/midimapper.h
parentddd12cae8a21eba52a4d8fae9dced18878e0e055 (diff)
Add openness CC control for hi-hats.distance_openness
Diffstat (limited to 'src/midimapper.h')
-rw-r--r--src/midimapper.h37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/midimapper.h b/src/midimapper.h
index 94781d4..45a2a8a 100644
--- a/src/midimapper.h
+++ b/src/midimapper.h
@@ -31,10 +31,33 @@
#include <mutex>
#include <vector>
+enum class MapFrom {
+ Note,
+ CC,
+ None
+};
+
+enum class MapTo {
+ PlayInstrument,
+ InstrumentState,
+ None
+};
+
+enum class InstrumentStateKind {
+ Position,
+ Openness,
+ None
+};
+
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<MidimapEntry>;
@@ -43,8 +66,16 @@ using instrmap_t = std::map<std::string, int>;
class MidiMapper
{
public:
- //! Lookup note in map and returns the corresponding instrument index list.
- std::vector<int> lookup(int note_id);
+ //! Lookup midi map entries matching the given query.
+ std::vector<MidimapEntry> lookup(
+ int from_id = -1, // note or cc #. -1 matches all notes/cc's
+ MapFrom from_kind = MapFrom::None, // None will return both CC and note maps
+ MapTo to_kind = MapTo::None, // None will return both instrument hits and controls
+ InstrumentStateKind state_kind = InstrumentStateKind::None // None maps all state control kinds
+ );
+
+ int lookup_instrument(std::string name);
+ std::vector<int> lookup_instruments(std::vector<MidimapEntry> const& entries);
//! Set new map sets.
void swap(instrmap_t& instrmap, midimap_t& midimap);