Workbench Library
0.1b
|
MIDI system initialization, deinitialization, and processing for Workbench applications. More...
Typedefs | |
typedef int(* | MidiCallback) (const void *, void *, unsigned long, void *) |
Type definition for MIDI callback functions. More... | |
Functions | |
void | midi_init () |
Initializes the MIDI system. More... | |
void | midi_deinit () |
Deinitializes the MIDI system. More... | |
MIDI system initialization, deinitialization, and processing for Workbench applications.
This header file defines functions and macros for managing MIDI input and output using the PortMidi library. It includes type definitions for MIDI callback functions and a comprehensive set of MIDI message constants.
The midi_init
function sets up the MIDI input and output streams, while the midi_deinit
function closes the streams and terminates the MIDI system. The __midi_callback
function processes incoming MIDI messages, and the process_midi
function handles MIDI message parsing and logging.
typedef int(* MidiCallback) (const void *, void *, unsigned long, void *) |
Type definition for MIDI callback functions.
A MidiCallback
function is called to handle incoming and outgoing MIDI messages. It takes the following parameters:
input_buffer
: A pointer to the input MIDI buffer.output_buffer
: A pointer to the output MIDI buffer.block_size
: The number of MIDI events in the buffer.user_data
: A pointer to user-defined data passed to the callback function.Example usage:
void midi_deinit | ( | ) |
Deinitializes the MIDI system.
This function stops the MIDI system, frees allocated buffers, and terminates the PortMidi library. It logs any errors that occur during the deinitialization process.
void midi_init | ( | ) |
Initializes the MIDI system.
This function initializes the PortMidi library, sets up the MIDI input and output devices based on the configuration settings, and allocates buffers for MIDI events. It also starts the MIDI input and output streams if they are enabled in the configuration.
If an error occurs during initialization, it logs the error message and deinitializes the MIDI system.