Skip to content

Commit

Permalink
VST3 Velocity
Browse files Browse the repository at this point in the history
In VST3 NoteOnEvent::velocity is a float between 0 and 1.
Why? Who knows. But in every other midi thing it is a
char between 0 and 127. So when passed to surge directly
in VST3 it doesn't work. This change simply multiplies the velocity
and casts it to a char.

addresses parts of issues surge-synthesizer#389 and surge-synthesizer#26 but not all of them
  • Loading branch information
baconpaul committed Mar 4, 2019
1 parent 888f648 commit f7d2e4a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vst3/SurgeVst3Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ void SurgeVst3Processor::processEvent(const Event& e)
}
else
{
getSurge()->playNote(e.noteOn.channel, e.noteOn.pitch, e.noteOn.velocity, e.noteOn.tuning);
char cVel = (char)(e.noteOn.velocity * 127.0); // Why oh why is this a float in VST3?
getSurge()->playNote(e.noteOn.channel, e.noteOn.pitch, cVel, e.noteOn.tuning);
}
break;

Expand Down

0 comments on commit f7d2e4a

Please sign in to comment.