Perfect! Thank you for your quick anwser. I tried to find a way that it works also with all the settings (velocity, key- and velocitysplit) from the MidiInBlock.
Here is my result:
var MasterKeyboard : MidiInBlock
AutoSustain : AutoSustainer
AUTOSUSTAIN_ON_OFF : Widget
Initialization
AutoSustain.AutoSustainer_SetTarget(MasterKeyboard)
End
On NoteEvent (m : NoteMessage) from MasterKeyboard
var blockfilter : boolean
var velo : integer
velo = m.GetVelocity()
blockfilter = false
if (m.IsNoteOn()) then
// Block all notes lower than MIN note from the MidiBlock settings
if (GetNoteNumber(m) < MasterKeyboard.GetMinNoteFromMidiInBlock()) then blockfilter = true end
// Block all notes higher than MAN note from the MidiBlock settings
if (GetNoteNumber(m) > MasterKeyboard.GetMaxNoteFromMidiInBlock()) then blockfilter = true end
// Block all notes lower than Min Velocity from the MidiBlock settings
if (velo < ParamToMidi(MasterKeyboard.GetParameter(150)) && velo > 0) then blockfilter = true end
// Block all notes higher than Man Velocity from the MidiBlock settings
if (velo > ParamToMidi(MasterKeyboard.GetParameter(151))) then blockfilter = true end
end
if (blockfilter == false) then
if (m.IsNoteOn()) then
if (MasterKeyboard.GetParameter(154)==1) then
// Calculate the new veloctiy when the MidiBlock setting is Constrain
if (velo < ParamToMidi(MasterKeyboard.GetParameter(152))) then velo = ParamToMidi(MasterKeyboard.GetParameter(152)) end
if (velo > ParamToMidi(MasterKeyboard.GetParameter(153))) then velo = ParamToMidi(MasterKeyboard.GetParameter(153)) end
else
// Calculate the new veloctiy when the MidiBlock setting is Scale
velo = (Round(Scale (velo, 0, 127, ParamToMidi(MasterKeyboard.GetParameter(152)), ParamToMidi(MasterKeyboard.GetParameter(153)))))
end
end
if (GetWidgetValue(AUTOSUSTAIN_ON_OFF) > 0) then
// Sending out the notes with the new veloctiy and transpose setting from MidiBlock over AutoSustain
AutoSustain.AutoSustainer_Play(Transpose(WithVelocity(m,velo),MasterKeyboard.GetTransposeFromMidiInBlock()))
else
// Sending out the notes with the new veloctiy and transpose setting from MidiBlock without AutoSustain
MasterKeyboard.SendNow(Transpose(WithVelocity(m,velo),MasterKeyboard.GetTransposeFromMidiInBlock()))
end
end
End