MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / midiMessageExfromString

Function midiMessageExfromString

Source/Core/CtrlrUtilities.cpp:200–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200const CtrlrMidiMessageEx midiMessageExfromString (const String &str, const int ch, const int number, const int value)
201{
202 CtrlrMidiMessageEx ret;
203 StringArray tokens;
204
205 tokens.addTokens (str, ",", "\"\'");
206
207 if (tokens.size() >= 5)
208 {
209 ret.indirectNumberFlag = indirectFromString (tokens[1]);
210 ret.indirectValueFlag = indirectFromString (tokens[2]);
211 ret.overrideNumber = tokens[3].getIntValue();
212 ret.overrideValue = tokens[4].getIntValue();
213
214 if (tokens[0] == "CC")
215 ret.m = MidiMessage::controllerEvent (ch,number,value);
216 if (tokens[0] == "Aftertouch")
217 ret.m = MidiMessage::aftertouchChange (ch,number,value);
218 if (tokens[0] == "NoteOn")
219 ret.m = MidiMessage::noteOn (ch,number,(uint8)value);
220 if (tokens[0] == "NoteOff")
221 ret.m = MidiMessage::noteOff (ch,number,(uint8)value);
222 if (tokens[0] == "ChannelPressure")
223 ret.m = MidiMessage::channelPressureChange (ch,value);
224 if (tokens[0] == "ProgramChange")
225 ret.m = MidiMessage::programChange(ch,value);
226
227 if (tokens[0] == "SysEx")
228 {
229 return (CtrlrSysexProcessor::sysexMessageFromString(tokens[5], value, ch));
230 }
231
232 ret.setNumber(number);
233 ret.setValue(value);
234 return (ret);
235 }
236 else
237 {
238 jassertfalse; // Looks like there is not enough tokens to create a CtrlrMidiMessageEx object
239 return (CtrlrMidiMessageEx());
240 }
241}
242
243const String extractVendorId (const CtrlrMidiMessage &message)
244{

Callers 1

Calls 9

indirectFromStringFunction · 0.85
noteOnFunction · 0.85
addTokensMethod · 0.80
CtrlrMidiMessageExClass · 0.70
noteOffFunction · 0.50
sizeMethod · 0.45
getIntValueMethod · 0.45
setNumberMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected