Midi
#include <AMidi.h>
Summary
Typedefs |
|
---|---|
AMidiDevice
|
typedefstruct AMidiDevice
|
AMidiDevice_Protocol
|
typedefenum AMidiDevice_Protocol
|
AMidiInputPort
|
typedefstruct AMidiInputPort
|
AMidiOutputPort
|
typedefstruct AMidiOutputPort
|
Functions |
|
---|---|
AMidiDevice_fromJava(JNIEnv *env, jobject midiDeviceObj, AMidiDevice **outDevicePtrPtr)
|
media_status_t AMIDI_API
Connects a native Midi Device object to the associated Java MidiDevice object.
|
AMidiDevice_getDefaultProtocol(const AMidiDevice *device)
|
AMidiDevice_Protocol AMIDI_API
Gets the MIDI device default protocol.
|
AMidiDevice_getNumInputPorts(const AMidiDevice *device)
|
ssize_t AMIDI_API
Gets the number of input (sending) ports available on the specified MIDI device.
|
AMidiDevice_getNumOutputPorts(const AMidiDevice *device)
|
ssize_t AMIDI_API
Gets the number of output (receiving) ports available on the specified MIDI device.
|
AMidiDevice_getType(const AMidiDevice *device)
|
int32_t AMIDI_API
Gets the MIDI device type.
|
AMidiDevice_release(const AMidiDevice *midiDevice)
|
media_status_t AMIDI_API
Disconnects the native Midi Device Object from the associated Java MidiDevice object.
|
AMidiInputPort_close(const AMidiInputPort *inputPort)
|
void AMIDI_API
Closes the input port.
|
AMidiInputPort_open(const AMidiDevice *device, int32_t portNumber, AMidiInputPort **outInputPortPtr)
|
media_status_t AMIDI_API
Opens the input port so that the client can send data to it.
|
AMidiInputPort_send(const AMidiInputPort *inputPort, const uint8_t *buffer, size_t numBytes)
|
ssize_t AMIDI_API
Sends data to the specified input port.
|
AMidiInputPort_sendFlush(const AMidiInputPort *inputPort)
|
media_status_t AMIDI_API
Sends a message with a 'MIDI flush command code' to the specified port.
|
AMidiInputPort_sendWithTimestamp(const AMidiInputPort *inputPort, const uint8_t *buffer, size_t numBytes, int64_t timestamp)
|
ssize_t AMIDI_API
Sends data to the specified input port with a timestamp.
|
AMidiOutputPort_close(const AMidiOutputPort *outputPort)
|
void AMIDI_API
Closes the output port.
|
AMidiOutputPort_open(const AMidiDevice *device, int32_t portNumber, AMidiOutputPort **outOutputPortPtr)
|
media_status_t AMIDI_API
Opens the output port so that the client can receive data from it.
|
AMidiOutputPort_receive(const AMidiOutputPort *outputPort, int32_t *opcodePtr, uint8_t *buffer, size_t maxBytes, size_t *numBytesReceivedPtr, int64_t *outTimestampPtr)
|
ssize_t AMIDI_API
Receives the next pending MIDI message.
|
Enumerations
Anonymous Enum 15
Anonymous Enum 15
AMidiDevice_Protocol
AMidiDevice_Protocol
Typedefs
AMidiDevice
struct AMidiDevice AMidiDevice
AMidiDevice_Protocol
enum AMidiDevice_Protocol AMidiDevice_Protocol
AMidiInputPort
struct AMidiInputPort AMidiInputPort
AMidiOutputPort
struct AMidiOutputPort AMidiOutputPort
Functions
AMidiDevice_fromJava
media_status_t AMIDI_API AMidiDevice_fromJava( JNIEnv *env, jobject midiDeviceObj, AMidiDevice **outDevicePtrPtr )
Connects a native Midi Device object to the associated Java MidiDevice object.
Use this AMidiDevice to access the rest of the native MIDI API. Use AMidiDevice_release() to disconnect from the Java object when not being used any more.
See also:AMEDIA_ERROR_INVALID_OBJECT - the midiDeviceObj is null or already connected to a native AMidiDevice See also:AMEDIA_ERROR_UNKNOWN - an unknown error occurred.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
AMEDIA_OK on success, or a negative error value:
|
AMidiDevice_getDefaultProtocol
AMidiDevice_Protocol AMIDI_API AMidiDevice_getDefaultProtocol( const AMidiDevice *device )
Gets the MIDI device default protocol.
Most devices should return PROTOCOL_UNKNOWN (-1). This is intentional as devices with default UMP support are not backwards compatible. When the device is null, return AMIDI_DEVICE_PROTOCOL_UNKNOWN.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The identifier of the MIDI device default protocol: AMIDI_DEVICE_PROTOCOL_UMP_USE_MIDI_CI AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS AMIDI_DEVICE_PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0 AMIDI_DEVICE_PROTOCOL_UMP_MIDI_2_0_AND_JRTS AMIDI_DEVICE_PROTOCOL_UNKNOWN
|
Available since API 33.
AMidiDevice_getNumInputPorts
ssize_t AMIDI_API AMidiDevice_getNumInputPorts( const AMidiDevice *device )
Gets the number of input (sending) ports available on the specified MIDI device.
See also:AMEDIA_ERROR_INVALID_PARAMETER - the device parameter is NULL. See also:AMEDIA_ERROR_UNKNOWN - couldn't retrieve the device info.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
If successful, returns the number of MIDI input (sending) ports available on the device. If an error occurs, returns a negative value indicating the error:
|
AMidiDevice_getNumOutputPorts
ssize_t AMIDI_API AMidiDevice_getNumOutputPorts( const AMidiDevice *device )
Gets the number of output (receiving) ports available on the specified MIDI device.
See also:AMEDIA_ERROR_INVALID_PARAMETER - the device parameter is NULL. See also:AMEDIA_ERROR_UNKNOWN - couldn't retrieve the device info.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
If successful, returns the number of MIDI output (receiving) ports available on the device. If an error occurs, returns a negative value indicating the error:
|
AMidiDevice_getType
int32_t AMIDI_API AMidiDevice_getType( const AMidiDevice *device )
Gets the MIDI device type.
See also:AMEDIA_ERROR_INVALID_PARAMETER - the device parameter is NULL. See also:AMEDIA_ERROR_UNKNOWN - Unknown error.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The identifier of the MIDI device type: AMIDI_DEVICE_TYPE_USB AMIDI_DEVICE_TYPE_VIRTUAL AMIDI_DEVICE_TYPE_BLUETOOTH or a negative error value:
|
AMidiDevice_release
media_status_t AMIDI_API AMidiDevice_release( const AMidiDevice *midiDevice )
Disconnects the native Midi Device Object from the associated Java MidiDevice object.
See also:AMEDIA_ERROR_INVALID_PARAMETER - the device parameter is NULL. See also:AMEDIA_ERROR_INVALID_OBJECT - the device is not consistent with the associated Java MidiDevice. See also:AMEDIA_ERROR_INVALID_OBJECT - the JNI interface initialization to the associated java MidiDevice failed. See also:AMEDIA_ERROR_UNKNOWN - couldn't retrieve the device info.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
AMEDIA_OK on success, or a negative error value:
|
AMidiInputPort_close
void AMIDI_API AMidiInputPort_close( const AMidiInputPort *inputPort )
Closes the input port.
Details | |||
---|---|---|---|
Parameters |
|
AMidiInputPort_open
media_status_t AMIDI_API AMidiInputPort_open( const AMidiDevice *device, int32_t portNumber, AMidiInputPort **outInputPortPtr )
Opens the input port so that the client can send data to it.
The port remains open and valid until AMidiInputPort_close() is called for the returned AMidiInputPort.
See also:AMEDIA_ERROR_UNKNOWN - Unknown Error.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
AMEDIA_OK, or a negative error code:
|
AMidiInputPort_send
ssize_t AMIDI_API AMidiInputPort_send( const AMidiInputPort *inputPort, const uint8_t *buffer, size_t numBytes )
Sends data to the specified input port.
See also:AMEDIA_ERROR_INVALID_PARAMETER - The specified port was NULL, the specified buffer was NULL.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
The number of bytes sent, which could be less than specified or a negative error code:
|
AMidiInputPort_sendFlush
media_status_t AMIDI_API AMidiInputPort_sendFlush( const AMidiInputPort *inputPort )
Sends a message with a 'MIDI flush command code' to the specified port.
This should cause a receiver to discard any pending MIDI data it may have accumulated and not processed.
See also:AMEDIA_OK if successful, otherwise a negative error code: See also:AMEDIA_ERROR_INVALID_PARAMETER - The specified port was NULLSee also:AMEDIA_ERROR_UNSUPPORTED - The FLUSH command couldn't be sent.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
AMidiInputPort_sendWithTimestamp
ssize_t AMIDI_API AMidiInputPort_sendWithTimestamp( const AMidiInputPort *inputPort, const uint8_t *buffer, size_t numBytes, int64_t timestamp )
Sends data to the specified input port with a timestamp.
See also:AMEDIA_ERROR_INVALID_PARAMETER - The specified port was NULL, the specified buffer was NULL.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Returns |
The number of bytes sent, which could be less than specified or a negative error code:
|
AMidiOutputPort_close
void AMIDI_API AMidiOutputPort_close( const AMidiOutputPort *outputPort )
Closes the output port.
Details | |||
---|---|---|---|
Parameters |
|
AMidiOutputPort_open
media_status_t AMIDI_API AMidiOutputPort_open( const AMidiDevice *device, int32_t portNumber, AMidiOutputPort **outOutputPortPtr )
Opens the output port so that the client can receive data from it.
The port remains open and valid until AMidiOutputPort_close() is called for the returned AMidiOutputPort.
See also:AMEDIA_ERROR_UNKNOWN - Unknown Error.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
AMEDIA_OK, or a negative error code:
|
AMidiOutputPort_receive
ssize_t AMIDI_API AMidiOutputPort_receive( const AMidiOutputPort *outputPort, int32_t *opcodePtr, uint8_t *buffer, size_t maxBytes, size_t *numBytesReceivedPtr, int64_t *outTimestampPtr )
Receives the next pending MIDI message.
To retrieve all pending messages, the client should repeatedly call this method until it returns 0.
Note that this is a non-blocking call. If there are no Midi messages are available, the function returns 0 immediately (for 0 messages received).
See also:AMEDIA_ERROR_UNKNOWN - Unknown Error.
Details | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||
Returns |
the number of messages received (either 0 or 1), or a negative error code:
|