Midi
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
Declared inamidi/AMidi.h
Anonymous Enum 15
Anonymous Enum 16
Declared inamidi/AMidi.h
Anonymous Enum 16
AMidiDevice_Protocol
Declared inamidi/AMidi.h
AMidiDevice_Protocol
Typedefs
AMidiDevice
Declared inamidi/AMidi.h
struct AMidiDevice AMidiDevice
AMidiInputPort
Declared inamidi/AMidi.h
struct AMidiInputPort AMidiInputPort
AMidiOutputPort
Declared inamidi/AMidi.h
struct AMidiOutputPort AMidiOutputPort
Functions
AMidiDevice_fromJava
Declared inamidi/AMidi.h
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 |
env
Points to the Java Environment.
midiDeviceObj
The Java MidiDevice Object.
outDevicePtrPtr
Points to the pointer to receive the AMidiDevice
|
| Returns |
AMEDIA_OK on success, or a negative error value:
|
AMidiDevice_getDefaultProtocol
Declared inamidi/AMidi.h
AMidiDevice_Protocol AMIDI_APIAMidiDevice_getDefaultProtocol( constAMidiDevice*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 |
device
Specifies the MIDI device.
|
| 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
Declared inamidi/AMidi.h
ssize_tAMIDI_APIAMidiDevice_getNumInputPorts( constAMidiDevice*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 |
device
Specifies the MIDI device.
|
| 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
Declared inamidi/AMidi.h
ssize_tAMIDI_APIAMidiDevice_getNumOutputPorts( constAMidiDevice*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 |
device
Specifies the MIDI device.
|
| 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
Declared inamidi/AMidi.h
int32_tAMIDI_APIAMidiDevice_getType( constAMidiDevice*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 |
device
Specifies the MIDI device.
|
| 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
Declared inamidi/AMidi.h
media_status_t AMIDI_APIAMidiDevice_release( constAMidiDevice*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 |
midiDevice
Points to the native AMIDI_MidiDevice.
|
| Returns |
AMEDIA_OK on success, or a negative error value:
|
AMidiInputPort_close
Declared inamidi/AMidi.h
voidAMIDI_APIAMidiInputPort_close( constAMidiInputPort*inputPort )
Closes the input port.
| Details | |
|---|---|
| Parameters |
inputPort
Identifies the input (sending) port to close.
|
AMidiInputPort_open
Declared inamidi/AMidi.h
media_status_t AMIDI_APIAMidiInputPort_open( constAMidiDevice*device, int32_tportNumber, 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 |
device
Specifies the MIDI device.
portNumber
Specifies the zero-based port index on the device to open. This value ranges between 0 and one less than the number of input ports reported by the AMidiDevice_getNumInputPorts() function..
outInputPortPtr
Receives the native API port identifier of the opened port.
|
| Returns |
AMEDIA_OK, or a negative error code:
|
AMidiInputPort_send
Declared inamidi/AMidi.h
ssize_tAMIDI_APIAMidiInputPort_send( constAMidiInputPort*inputPort, constuint8_t*buffer, size_tnumBytes )
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 |
inputPort
The identifier of the port to send data to.
buffer
Points to the array of bytes containing the data to send.
numBytes
Specifies the number of bytes to write.
|
| Returns |
The number of bytes sent, which could be less than specified or a negative error code:
|
AMidiInputPort_sendFlush
Declared inamidi/AMidi.h
media_status_t AMIDI_APIAMidiInputPort_sendFlush( constAMidiInputPort*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 NULL See also:AMEDIA_ERROR_UNSUPPORTED - The FLUSH command couldn't be sent.
| Details | |
|---|---|
| Parameters |
inputPort
The identifier of the port to send the flush command to.
|
| Returns |
AMidiInputPort_sendWithTimestamp
Declared inamidi/AMidi.h
ssize_tAMIDI_APIAMidiInputPort_sendWithTimestamp( constAMidiInputPort*inputPort, constuint8_t*buffer, size_tnumBytes, int64_ttimestamp )
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 |
inputPort
The identifier of the port to send data to.
buffer
Points to the array of bytes containing the data to send.
numBytes
Specifies the number of bytes to write.
timestamp
The CLOCK_MONOTONIC time in nanoseconds to associate with the sent data.
|
| Returns |
The number of bytes sent, which could be less than specified or a negative error code:
|
AMidiOutputPort_close
Declared inamidi/AMidi.h
voidAMIDI_APIAMidiOutputPort_close( constAMidiOutputPort*outputPort )
Closes the output port.
| Details | |
|---|---|
| Parameters |
outputPort
The native API port identifier of the port.
|
AMidiOutputPort_open
Declared inamidi/AMidi.h
media_status_t AMIDI_APIAMidiOutputPort_open( constAMidiDevice*device, int32_tportNumber, 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 |
device
Specifies the MIDI device.
portNumber
Specifies the zero-based port index on the device to open. This value ranges between 0 and one less than the number of output ports reported by the AMidiDevice_getNumOutputPorts function.
outOutputPortPtr
Receives the native API port identifier of the opened port.
|
| Returns |
AMEDIA_OK, or a negative error code:
|
AMidiOutputPort_receive
Declared inamidi/AMidi.h
ssize_tAMIDI_APIAMidiOutputPort_receive( constAMidiOutputPort*outputPort, int32_t*opcodePtr, uint8_t*buffer, size_tmaxBytes, 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 |
outputPort
Identifies the port to receive messages from.
opcodePtr
Receives the message Op Code.
buffer
Points to the buffer to receive the message data bytes.
maxBytes
Specifies the size of the buffer pointed to by the buffer parameter.
numBytesReceivedPtr
On exit, receives the actual number of bytes stored in buffer.
outTimestampPtr
If non-NULL, receives the timestamp associated with the message. (the current value of the running Java Virtual Machine's high-resolution time source, in nanoseconds)
|
| Returns |
the number of messages received (either 0 or 1), or a negative error code:
|