MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / SendNote

Method SendNote

Source/MidiDevice.cpp:190–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void MidiDevice::SendNote(double time, int pitch, int velocity, bool forceNoteOn, int channel)
191{
192 if (mMidiOut)
193 {
194 if (channel == -1)
195 channel = mOutputChannel;
196
197 int sampleNumber = (time - gTime) * gSampleRateMs;
198
199 juce::MidiBuffer midiBuffer;
200
201 if (velocity > 0 || forceNoteOn)
202 midiBuffer.addEvent(MidiMessage::noteOn(channel, pitch, (uint8)velocity), sampleNumber);
203 else
204 midiBuffer.addEvent(MidiMessage::noteOff(channel, pitch), sampleNumber);
205
206 mMidiOut->sendBlockOfMessages(midiBuffer, Time::getMillisecondCounter(), gSampleRate);
207 }
208}
209
210void MidiDevice::SendCC(int ctl, int value, int channel /* = -1*/)
211{

Callers 7

SetLedMethod · 0.45
SetLightDirectMethod · 0.45
PlayNoteMethod · 0.45
UpdateLightsMethod · 0.45
UpdateLightsMethod · 0.45
ResetLaunchpadMethod · 0.45
OnMidiNoteMethod · 0.45

Calls

no outgoing calls

Tested by 1

UpdateLightsMethod · 0.36