summaryrefslogtreecommitdiff
path: root/src/midimapper.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-08-08 10:34:54 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-08-08 10:34:54 +0200
commitf43935b5c873676a632b23cbfcef45a4431b233d (patch)
treead1473fa34f3da5292e3344a99ed447261d99584 /src/midimapper.h
parenta2483a839264369482fff135d33f007ded266d3c (diff)
Add support for a single midi note that plays multiple instruments.
Diffstat (limited to 'src/midimapper.h')
-rw-r--r--src/midimapper.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/midimapper.h b/src/midimapper.h
index 4673e33..94781d4 100644
--- a/src/midimapper.h
+++ b/src/midimapper.h
@@ -29,16 +29,22 @@
#include <map>
#include <string>
#include <mutex>
+#include <vector>
-typedef std::map<int, std::string> midimap_t;
-typedef std::map<std::string, int> instrmap_t;
+struct MidimapEntry
+{
+ int note_id;
+ std::string instrument_name;
+};
+
+using midimap_t = std::vector<MidimapEntry>;
+using instrmap_t = std::map<std::string, int>;
class MidiMapper
{
public:
- //! Lookup note in map and return its index.
- //! \returns -1 if not found or the note index.
- int lookup(int note);
+ //! Lookup note in map and returns the corresponding instrument index list.
+ std::vector<int> lookup(int note_id);
//! Set new map sets.
void swap(instrmap_t& instrmap, midimap_t& midimap);