-
Notifications
You must be signed in to change notification settings - Fork 1
Internal native API
This native interface expresses the Web MIDI API surface on top of React Native's JavaScript bridge machinery. It is then consumed by JavaScript code which implements the actual Web MIDI API.
// Java/Android:
private static final String EVENT_MIDIACCESS_ONSTATECHANGE = "com.motiz88.rctmidi.webmidi.MIDIAccess#statechange";
statechange
events from the MIDIAccess
singleton are emitted with this event name.
// Java/Android:
private static final String EVENT_MIDIPORT_ONSTATECHANGE = "com.motiz88.rctmidi.webmidi.MIDIPort#statechange&id=";
statechange
events from a MIDIPort
are emitted with this event name, followed directly by the port's ID.
// Java/Android:
private static final String EVENT_MIDIINPUT_ONMIDIMESSAGE = "com.motiz88.rctmidi.webmidi.MIDIInput#midimessage&id=";
midimessage
events from a MIDIInput
are emitted with this event name, followed directly by the port's ID.
// Java/Android:
@ReactMethod public void requestMIDIAccess(ReadableMap options, Promise promise)
Initializes the MIDIAccess
singleton and asynchronously returns its data fields as a WritableMap
to the JS thread, where it is expected they will be merged into the existing object instance.
// Java/Android:
@ReactMethod public void MIDIAccess_get_data(Promise promise)
Asynchronously returns the MIDIAccess
singleton's data fields as a WritableMap
to the JS thread, where it is expected they will be merged into the existing object instance.
// Java/Android:
@ReactMethod public void MIDIAccess_setOnStateChange(final boolean attach, Promise promise)
Start or stop sending statechange
events to the JS thread from the MIDIAccess
singleton.
// Java/Android:
@ReactMethod public void MIDIPort_open(String id, Promise promise)
Opens a MIDIPort
and asynchronously returns its data fields as a WritableMap
to the JS thread, where it is expected they will be merged into the existing object instance.
// Java/Android:
@ReactMethod public void MIDIPort_close(String id, Promise promise)
Closes a MIDIPort
and asynchronously returns its data fields as a WritableMap
to the JS thread, where it is expected they will be merged into the existing object instance.
// Java/Android:
@ReactMethod public void MIDIPort_setOnStateChange(String id, final boolean attach, Promise promise)
Start or stop sending statechange
events to the JS thread from a MIDIPort
specified by ID.
// Java/Android:
@ReactMethod public void MIDIInput_setOnMidiMessage(String id, final boolean attach, Promise promise)
Start or stop sending midimessage
events to the JS thread from a MIDIInput
specified by ID.
// Java/Android:
@ReactMethod public void MIDIOutput_send(String id, ReadableArray data, double timestamp, Promise promise)
Send the specified MIDI message to a MIDIOutput
specified by ID.