Difference between revisions of "Component: USB MIDI (Comms: USB)"
From Flowcode Help
Jump to navigationJump to searchLine 17: | Line 17: | ||
==Component Source Code== | ==Component Source Code== | ||
− | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/ | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_temp/USBMIDI.fcfx FC_Comp_Source_temp/USBMIDI.fcfx] |
− | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/ | + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_temp/USBMIDI.fcfx FC_Comp_Source_temp/USBMIDI.fcfx] |
==Detailed description== | ==Detailed description== | ||
Line 77: | Line 77: | ||
''<span style="color:red;">No additional examples</span>'' | ''<span style="color:red;">No additional examples</span>'' | ||
+ | |||
+ | |||
Line 85: | Line 87: | ||
==Macro reference== | ==Macro reference== | ||
− | === | + | ===Initialise=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Starts up the USB communications and attempts to enumerate. Returns 0 for a successful startup or 255 for a enumeration timeout. |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE |
− | | width="90%" | | + | | width="90%" style="border-top: 2px solid #000;" | ''Return'' |
+ | |} | ||
+ | |||
+ | |||
+ | ===ReadData=== | ||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
− | | | + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] |
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadData''' | ||
|- | |- | ||
− | | | + | | colspan="2" | Reads a byte from the last received MIDI message |
− | |||
|- | |- | ||
− | |||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Idx |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Byte to read 0-3 |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===ReceiveMIDI=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveMIDI''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Waits for the time specified in the timeout parameter for an incoming MIDI message. Returns 0 to indicate a timeout, otherwise returns the first value from the MIDI message. |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Timeout |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
|- | |- | ||
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===SendChannelPressure=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendChannelPressure''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
|- | |- | ||
|- | |- | ||
Line 153: | Line 154: | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Pressure |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
Line 196: | Line 192: | ||
− | === | + | ===SendMIDI=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendMIDI''' |
|- | |- | ||
− | | colspan="2" | Sends a | + | | colspan="2" | Sends a MIDI packet consisting of up to three bytes of information, |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Status |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | MIDI Status Byte - Used for commands such as NoteOn, NoteOff etc. |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Data1 |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | MIDI Data Byte - Used as a parameter specific to the specified command |
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Data2 |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | MIDI Data Byte - Used as a parameter specific to the specified command |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 225: | Line 221: | ||
− | === | + | ===SendNoteOff=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendNoteOff''' |
+ | |- | ||
+ | | colspan="2" | Sends a note off command using the channel, note and velocity specified. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Channel | ||
+ | |- | ||
+ | | colspan="2" | | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
+ | | width="90%" | Note | ||
|- | |- | ||
+ | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Velocity |
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===SendNoteOn=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendNoteOn''' |
|- | |- | ||
− | | colspan="2" | Sends a note | + | | colspan="2" | Sends a note on command using the channel, note and velocity specified. |
|- | |- | ||
|- | |- | ||
Line 264: | Line 270: | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Velocity |
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
Line 273: | Line 279: | ||
− | === | + | ===SendPatch=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendPatch''' |
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
+ | | width="90%" | Channel | ||
|- | |- | ||
+ | | colspan="2" | | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
− | | width="90%" | | + | | width="90%" | Instrument |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===SendPitchChange=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendPitchChange''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Sends out a pitch change command on the specified channel. |
|- | |- | ||
|- | |- | ||
Line 304: | Line 315: | ||
| width="90%" | Channel | | width="90%" | Channel | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Channel to send the pitch change to |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9- | + | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT |
− | | width="90%" | | + | | width="90%" | Pitch_Change |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | New pitch value to use, Default 0x2000 |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 316: | Line 327: | ||
− | === | + | ===SendPolyPressure=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendPolyPressure''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Sends a note press with an associated polyphonic pressure value. |
|- | |- | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| width="90%" | Channel | | width="90%" | Channel | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Note | ||
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
Line 336: | Line 352: | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} |
Revision as of 12:03, 3 February 2023
Author | Matrix Ltd. |
Version | 1.3 |
Category | Comms: USB |
Contents
USB MIDI component
Component to create and communicate using a standard MIDI connection. Compatible with simulation and USB enabled microcontroller devices. Currently only compatible with the 16-bit PIC range of devices.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_temp/USBMIDI.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_temp/USBMIDI.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
Initialise
Initialise | |
Starts up the USB communications and attempts to enumerate. Returns 0 for a successful startup or 255 for a enumeration timeout. | |
- BYTE | Return |
ReadData
ReadData | |
Reads a byte from the last received MIDI message | |
- BYTE | Idx |
Byte to read 0-3 | |
- BYTE | Return |
ReceiveMIDI
SendChannelPressure
SendChannelPressure | |
- BYTE | Channel |
- BYTE | Pressure |
- VOID | Return |
SendControl
SendControl | |
Sends a control command using the channel, controller and value specified. | |
- BYTE | Channel |
- BYTE | Controller |
- BYTE | Value |
- VOID | Return |
SendMIDI
SendNoteOff
SendNoteOff | |
Sends a note off command using the channel, note and velocity specified. | |
- BYTE | Channel |
- BYTE | Note |
- BYTE | Velocity |
- VOID | Return |
SendNoteOn
SendNoteOn | |
Sends a note on command using the channel, note and velocity specified. | |
- BYTE | Channel |
- BYTE | Note |
- BYTE | Velocity |
- VOID | Return |
SendPatch
SendPatch | |
- BYTE | Channel |
- BYTE | Instrument |
- VOID | Return |
SendPitchChange
SendPitchChange | |
Sends out a pitch change command on the specified channel. | |
- BYTE | Channel |
Channel to send the pitch change to | |
- UINT | Pitch_Change |
New pitch value to use, Default 0x2000 | |
- VOID | Return |
SendPolyPressure
SendPolyPressure | |
Sends a note press with an associated polyphonic pressure value. | |
- BYTE | Channel |
- BYTE | Note |
- BYTE | Pressure |
- VOID | Return |