diff --git a/src/midi/MIDITrack.cpp b/src/midi/MIDITrack.cpp index e20227d..0f6768e 100644 --- a/src/midi/MIDITrack.cpp +++ b/src/midi/MIDITrack.cpp @@ -318,8 +318,10 @@ void MIDITrack::updateSets(const SetOptions & options){ note.set = int(note.channel); } else if(options.mode == SetMode::TRACK){ note.set = int(note.track); - } else if(options.mode == SetMode::KEY){ + } else if(options.mode == SetMode::SPLIT){ note.set = note.note < options.key ? 0 : 1; + } else if(options.mode == SetMode::KEY){ + note.set = noteShift[note.note%12]; } else { note.set = 0; } diff --git a/src/midi/MIDIUtils.h b/src/midi/MIDIUtils.h index 79f7eaf..0034ee2 100644 --- a/src/midi/MIDIUtils.h +++ b/src/midi/MIDIUtils.h @@ -11,7 +11,8 @@ enum class SetMode : int { CHANNEL = 0, TRACK = 1, - KEY = 2 + SPLIT = 2, + KEY = 3 }; struct SetOptions { diff --git a/src/rendering/Renderer.cpp b/src/rendering/Renderer.cpp index 9294017..781ee3e 100755 --- a/src/rendering/Renderer.cpp +++ b/src/rendering/Renderer.cpp @@ -1028,15 +1028,17 @@ void Renderer::showSets(){ if(ImGui::BeginPopup("Note sets options")){ ImGui::Text("Decide how notes should be grouped in multiple sets"); ImGui::Text("(to which you can assign different key/effects colors)."); - ImGui::Text("This can be based on the MIDI channel, the track or by"); + ImGui::Text("This can be based on the MIDI channel, the track, by key, or by"); ImGui::Text("separating notes that are lower or higher than a given key."); bool shouldUpdate = false; shouldUpdate = ImGui::RadioButton("Channel", (int*)(&_state.setOptions.mode), int(SetMode::CHANNEL)) || shouldUpdate; - ImGuiSameLine(120); + ImGuiSameLine(90); shouldUpdate = ImGui::RadioButton("Track", (int*)(&_state.setOptions.mode), int(SetMode::TRACK)) || shouldUpdate; - ImGuiSameLine(2*120); + ImGuiSameLine(2*90); shouldUpdate = ImGui::RadioButton("Key", (int*)(&_state.setOptions.mode), int(SetMode::KEY)) || shouldUpdate; + ImGuiSameLine(3*90); + shouldUpdate = ImGui::RadioButton("Split", (int*)(&_state.setOptions.mode), int(SetMode::SPLIT)) || shouldUpdate; ImGuiSameLine(); ImGuiPushItemWidth(100); diff --git a/src/rendering/State.cpp b/src/rendering/State.cpp index a9331c5..0af043d 100755 --- a/src/rendering/State.cpp +++ b/src/rendering/State.cpp @@ -148,7 +148,7 @@ void State::defineOptions(){ _sharedInfos["colors-per-set"].category = OptionInfos::Category::SETS; _sharedInfos["sets-mode"] = {"How should notes be grouped into sets", OptionInfos::Type::OTHER}; - _sharedInfos["sets-mode"].values = "per-channel: 0, per-track: 1, based on a key separator: 2"; + _sharedInfos["sets-mode"].values = "per-channel: 0, per-track: 1, split based on a key separator: 2, per-key: 3"; _sharedInfos["sets-mode"].category = OptionInfos::Category::SETS; _sharedInfos["sets-separator-key"] = {"If notes are grouped in two sets, defines the key where the split should happen", OptionInfos::Type::KEY, {0.0f, 127.0f}}; diff --git a/src/rendering/scene/MIDISceneLive.cpp b/src/rendering/scene/MIDISceneLive.cpp index 58b0c95..7b078a5 100755 --- a/src/rendering/scene/MIDISceneLive.cpp +++ b/src/rendering/scene/MIDISceneLive.cpp @@ -6,6 +6,7 @@ #include "../../helpers/ProgramUtilities.h" #include "../../helpers/ResourcesManager.h" +#include "../../midi/MIDIUtils.h" #include "MIDISceneLive.h" @@ -46,8 +47,10 @@ void MIDISceneLive::updateSet(GPUNote & note, int channel, const SetOptions & op if(options.mode == SetMode::CHANNEL){ // Restore channel from backup vector. note.set = float(int(channel) % CHANNELS_COUNT); + } else if(options.mode == SetMode::SPLIT){ + note.set = (int(note.note) < options.key ? 0.0f : 1.0f); } else if(options.mode == SetMode::KEY){ - note.set = (note.note < options.key ? 0.0f : 1.0f); + note.set = float(noteShift[int(note.note) % 12]); } else { note.set = 0.0f; }