RetroArch
Public Attributes | List of all members
midi_driver Struct Reference

#include <midi_driver.h>

Public Attributes

const char * ident
 
bool(* get_avail_inputs )(struct string_list *inputs)
 
bool(* get_avail_outputs )(struct string_list *outputs)
 
void *(* init )(const char *input, const char *output)
 
void(* free )(void *p)
 
bool(* set_input )(void *p, const char *input)
 
bool(* set_output )(void *p, const char *output)
 
bool(* read )(void *p, midi_event_t *event)
 
bool(* write )(void *p, const midi_event_t *event)
 
bool(* flush )(void *p)
 

Member Data Documentation

◆ flush

bool(* midi_driver::flush) (void *p)

flush: This function is used for transferring events previously stored by the 'write' function.

: Driver specific data pointer previously returned by the 'init' function. This argument will never be NULL.

Returns: True if successful, false otherwise.

Remarks: On error, drivers should keep the events (don't drop them).

◆ free

void(* midi_driver::free) (void *p)

free: Stops I/O and releases any resources used by the driver.

: Driver specific data pointer previously returned by the 'init' function. This argument will never be NULL.

◆ get_avail_inputs

bool(* midi_driver::get_avail_inputs) (struct string_list *inputs)

get_avail_inputs: Populates provided list with currently available inputs (if any).

: List of available inputs (visible in the menu). This argument will never be NULL.

Returns: True if successful (even if there are no inputs available), false otherwise.

Remarks: Before this function is called the list will already contain one member ("Off") which can be used by the user to disable input.

If the driver supports input but underlying API don't offers this list, driver should/must provide some "fake" name(s) here, otherwise user will only see "Off" option in the menu.

◆ get_avail_outputs

bool(* midi_driver::get_avail_outputs) (struct string_list *outputs)

get_avail_outputs: Populates provided list with currently available outputs (if any).

: List of available outputs (visible in the menu). This argument will never be NULL.

Returns: True if successful (even if there are no outputs available), false otherwise.

Remarks: Before this function is called the list will already contain one member ("Off") which can be used by the user to disable output.

If the driver supports output but underlying API don't offers this list, driver should/must provide some "fake" name(s) here, otherwise user will only see "Off" option in the menu.

◆ ident

const char* midi_driver::ident

ident: Driver name (visible in the menu). Must be unique among the MIDI drivers.

◆ init

void*(* midi_driver::init) (const char *input, const char *output)

init: Initializes driver and starts input (if 'input' argument is non NULL) and starts output (if 'output' argument is non NULL).

: One of the input names previously returned by the 'get_avail_inputs' function or NULL which means don't initialize input. : One of the output names previously returned by the 'get_avail_outputs' function or NULL which means don't initialize output.

Returns: Driver specific data pointer if successful, NULL otherwise.

Remarks: If requested input/output is unavailable driver should return NULL (don't implement "fallback" mechanism).

◆ read

bool(* midi_driver::read) (void *p, midi_event_t *event)

read: This function is used for reading received data. When called, 'data_size' member of the 'event' argument will hold max data size (in bytes) that event can hold. After successful read driver should set this member to actual data size that is returned, and 'delta_time' member should be set to time (in microseconds) between previous event and this one (if this is the first event set 'delta_time' to 0).

: Driver specific data pointer previously returned by the 'init' function. This argument will never be NULL. : Address of the event structure. This argument will never be NULL, 'data' member will never be NULL and 'data_size' member will never be 0.

Returns: True if event was available and read successfully, false otherwise.

Remarks: If the driver can't supply timing info 'delta_time' member of the 'event' argument should be set to 0.

◆ set_input

bool(* midi_driver::set_input) (void *p, const char *input)

set_input: This function is used for changing/disabling input.

: Driver specific data pointer previously returned by the 'init' function. This argument will never be NULL. : One of the input names previously returned by the 'get_avail_inputs' function or NULL which means disable input.

Returns: True if successful, false otherwise.

Remarks: On error, driver should leave the current input as is (if possible).

◆ set_output

bool(* midi_driver::set_output) (void *p, const char *output)

set_output: This function is used for changing/disabling output.

: Driver specific data pointer previously returned by the 'init' function. This argument will never be NULL. : One of the output names previously returned by the 'get_avail_outputs' function or NULL which means disable output.

Returns: True if successful, false otherwise.

Remarks: On error, driver should leave the current output as is (if possible).

◆ write

bool(* midi_driver::write) (void *p, const midi_event_t *event)

write: This function is used for writing events.

: Driver specific data pointer previously returned by the 'init' function. This argument will never be NULL. : Address of the event structure. This argument will never be NULL, 'data' member will never be NULL and 'data_size' member will never be 0.

Returns: True if event was written successfully, false otherwise.

Remarks: This event should be buffered by the driver and sent later when 'flush' function is called.

If the underlying API don't support event scheduling 'delta_time' member of the 'event' argument may be ignored by the driver.


The documentation for this struct was generated from the following file: