Skip to content

Commit

Permalink
VST3 Velocity (surge-synthesizer#719)
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 38145e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/vst3/SurgeVst3Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include "CScalableBitmap.h"

#include <algorithm>

using namespace Steinberg::Vst;

#define CHECK_INITIALIZED \
Expand Down Expand Up @@ -198,7 +200,8 @@ void SurgeVst3Processor::processEvent(const Event& e)
}
else
{
getSurge()->playNote(e.noteOn.channel, e.noteOn.pitch, e.noteOn.velocity, e.noteOn.tuning);
char cVel = std::min((char)(e.noteOn.velocity * 128.0), (char)127); // 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 38145e5

Please sign in to comment.