Skip to content

Commit

Permalink
Adds parameter MIDI mapping support
Browse files Browse the repository at this point in the history
  • Loading branch information
azeno committed Oct 28, 2024
1 parent 8651c7d commit 0b35a01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ From https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentat
- IPlugView - sizing yes, keyboard handling no
- Multiple Dynamic I/O Support - no
- Silence flags - no
- Parameter MIDI Mapping - only checking for pitch bend, but should be easy to extend
- Parameter MIDI Mapping - yes
- Parameter Finder - no
- Audio Presentation Latency - no
- Dirty State, Open Editor Request and UI Group Editing Support - no
Expand Down
13 changes: 12 additions & 1 deletion src/EffectHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ public void Update()

private void HandleMidiMessage(IMidiMessage message)
{
var midiMapping = controller as IMidiMapping;
if (message is ChannelMessage channelMessage)
{
// TODO: Midi Stop All see https://forums.steinberg.net/t/vst3-velocity-clarification/908883
Expand All @@ -295,9 +296,19 @@ private void HandleMidiMessage(IMidiMessage message)
noteId: channelMessage.Data1);
inputEventQueue.Add(Event.New(e, busIndex: 0, sampleOffset: 0, ppqPosition: 0, isLive: false));
}
else if (channelMessage.Command == ChannelCommand.Controller)
{
if (midiMapping is null)
return;

if (midiMapping.getMidiControllerAssignment(0, (short)channelMessage.MidiChannel, (ControllerNumbers)channelMessage.Data1, out var paramId))
{
var value = MessageUtils.MidiIntToFloat(channelMessage.Data2);
synchronizationContext?.Post(s => SetParameter(paramId, value), null);
}
}
else if (channelMessage.Command == ChannelCommand.PitchWheel)
{
var midiMapping = controller as IMidiMapping;
if (midiMapping is null)
return;

Expand Down

0 comments on commit 0b35a01

Please sign in to comment.