diff options
author | André Nusser <andre.nusser@googlemail.com> | 2018-06-09 17:37:23 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-08-12 11:13:51 +0200 |
commit | 31dd927c43f72e76ecb61ea02a7832698b7a9496 (patch) | |
tree | c5edd7e3d698a95812e4b752c1a387899d6d1cd5 /plugingui/drumkittab.cc | |
parent | 873a12d313541e6c82ec9995473bb6f43e7667e8 (diff) |
Add map to get instrument name from colour.
Diffstat (limited to 'plugingui/drumkittab.cc')
-rw-r--r-- | plugingui/drumkittab.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/plugingui/drumkittab.cc b/plugingui/drumkittab.cc index 91fc801..1dccb52 100644 --- a/plugingui/drumkittab.cc +++ b/plugingui/drumkittab.cc @@ -88,14 +88,14 @@ void DrumkitTab::triggerAudition(int x, int y) { auto map_colour = map_image->getPixel(x, y); - // TODO: convert color to instrument - if (map_colour != Colour(0)) + auto it = colour_to_instrument.find(map_colour); + if (it == colour_to_instrument.end()) { return; } ++settings.audition_counter; - settings.audition_instrument = "Snare"; + settings.audition_instrument = it->second; settings.audition_velocity = current_velocity; } @@ -106,11 +106,18 @@ void DrumkitTab::updateVelocityLabel() velocity_label.setText("Velocity: " + stream.str()); } -// FIXME: this should actually be done somewhere else maybe? void DrumkitTab::loadImageFiles(std::string const& image_file, std::string const& map_file) { drumkit_image = std::make_unique<Image>(image_file); map_image = std::make_unique<Image>(map_file); + + // TODO: actually use mapping from drumkit file here + colour_to_instrument = { + {Colour(0), "Snare"}, + {Colour(255./255, 15./255, 55./255), "KdrumL"}, + {Colour(154./255, 153./255, 33./255), "HihatClosed"}, + {Colour(248./255, 221./255, 37./255), "Tom4"} + }; } } // GUI:: |