hello everyone, i am trying to figure out how to receive midi from my DAW inside of my Faustcode for a couple of days now.
i have this event handler running:
void mySynth::ProcessMidiMsg(const IMidiMsg& msg)
{
int status = msg.StatusMsg();
switch (status)
{
case IMidiMsg::kNoteOn:
{
SendMidiMsg(msg);
break;
}
case IMidiMsg::kNoteOff:
{
SendMidiMsg(msg);
break;
}
…
on faust’s side i have this code:
declare options “[midi:on]”;
frequency = hslider("frequency",500,30,12000,0.01);
gate = checkbox("h:gate");
osc = os.osc(frequency);
process = osc*gate;
but i miss the link inbetween. how can i send the midi on and off messages to the “gate” ?
Since the gate is a parameter of the Faust dsp in your above example, you can use mFaustProcessor.SetParameterValue("gate", 1.) to set it high when there is a note on message.
related news…
Stéphane Letz, one of the Faust developers has added support for faust’s own poly dsp midi handling, so you can now make a polysynth in faust like this (see IPlugFaustDSP example)