From c63bbf8fb59c09e60b76de1e6f75e2ec244fe425 Mon Sep 17 00:00:00 2001 From: sletz Date: Mon, 17 Mar 2008 19:51:32 +0000 Subject: [PATCH] MIDI API in wrapper lib. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2026 0c269be4-1314-0410-8aa9-9f06e86f4224 --- ChangeLog | 2 +- common/JackAPIWrapper.cpp | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 808677af..e2003340 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,7 +24,7 @@ Fernando Lopez-Lezcano * New jack_server_control client to test notifications when linked to the server library. * Correct JackClient::Activate so that first kGraphOrderCallback can be received by the client notification thread. - * MIDI API in wrapper lib (in progress). + * MIDI API in wrapper lib. 2008-03-16 Stephane Letz diff --git a/common/JackAPIWrapper.cpp b/common/JackAPIWrapper.cpp index 1397e895..c0cdd44c 100644 --- a/common/JackAPIWrapper.cpp +++ b/common/JackAPIWrapper.cpp @@ -1261,6 +1261,65 @@ EXPORT int jack_client_close(jack_client_t *client) } } +// MIDI + +typedef jack_nframes_t (*jack_midi_get_event_count_fun_def)(void* port_buffer); +static jack_midi_get_event_count_fun_def jack_midi_get_event_count_fun = 0; +EXPORT jack_nframes_t jack_midi_get_event_count(void* port_buffer) +{ + jack_log("jack_midi_get_event_count"); + return (*jack_midi_get_event_count_fun)(port_buffer); +} + +typedef int (*jack_midi_event_get_fun_def)(void* port_buffer); +static jack_midi_event_get_fun_def jack_midi_event_get_fun = 0; +EXPORT int jack_midi_event_get(void* port_buffer) +{ + jack_log("jack_midi_get_event_count"); + return (*jack_midi_event_get_fun)(port_buffer); +} + +typedef void (*jack_midi_clear_buffer_fun_def)(void* port_buffer); +static jack_midi_clear_buffer_fun_def jack_midi_clear_buffer_fun = 0; +EXPORT void jack_midi_clear_buffer(void* port_buffer) +{ + jack_log("jack_midi_clear_buffer"); + (*jack_midi_clear_buffer_fun)(port_buffer); +} + +typedef size_t (*jack_midi_max_event_size_fun_def)(void* port_buffer); +static jack_midi_max_event_size_fun_def jack_midi_max_event_size_fun = 0; +EXPORT size_t jack_midi_max_event_size(void* port_buffer) +{ + jack_log("jack_midi_max_event_size"); + return (*jack_midi_max_event_size_fun)(port_buffer); +} + +typedef jack_midi_data_t* (*jack_midi_event_reserve_fun_def)(void* port_buffer, jack_nframes_t time, size_t data_size); +static jack_midi_event_reserve_fun_def jack_midi_event_reserve_fun = 0; +EXPORT jack_midi_data_t* jack_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size) +{ + jack_log("jack_midi_event_reserve"); + return (*jack_midi_event_reserve_fun)(port_buffer, time, data_size); +} + +typedef int (*jack_midi_event_write_fun_def)(void* port_buffer, jack_nframes_t time, const jack_midi_data_t *data, size_t data_size); +static jack_midi_event_write_fun_def jack_midi_event_write_fun = 0; +EXPORT int jack_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t *data, size_t data_size) +{ + jack_log("jack_midi_event_write"); + return (*jack_midi_event_write_fun)(port_buffer, time, data, data_size); +} + +typedef jack_nframes_t (*jack_midi_get_lost_event_count_fun_def)(void *port_buffer); +static jack_midi_get_lost_event_count_fun_def jack_midi_get_lost_event_count_fun = 0; +EXPORT jack_nframes_t jack_midi_get_lost_event_count(void* port_buffer) +{ + jack_log("jack_midi_get_lost_event_count"); + return (*jack_midi_get_lost_event_count_fun)(port_buffer); +} + + // Library loader static bool get_jack_library_in_directory(const char* dir_name, const char* library_name, char* library_res_name) { @@ -1463,6 +1522,14 @@ static bool open_library() jack_internal_client_handle_fun = (jack_internal_client_handle_fun_def)dlsym(gLibrary, "jack_internal_client_handle"); jack_internal_client_load_aux_fun = (jack_internal_client_load_aux_fun_def)dlsym(gLibrary, "jack_internal_client_load_aux"); jack_internal_client_unload_fun = (jack_internal_client_unload_fun_def)dlsym(gLibrary, "jack_internal_client_unload"); + // MIDI + jack_midi_get_event_count_fun = (jack_midi_get_event_count_fun_def)dlsym(gLibrary, "jack_midi_get_event_count"); + jack_midi_event_get_fun = (jack_midi_event_get_fun_def)dlsym(gLibrary, "jack_midi_event_get"); + jack_midi_clear_buffer_fun = (jack_midi_clear_buffer_fun_def)dlsym(gLibrary, "jack_midi_clear_buffer"); + jack_midi_max_event_size_fun = (jack_midi_max_event_size_fun_def)dlsym(gLibrary, "jack_midi_max_event_size"); + jack_midi_event_reserve_fun = (jack_midi_event_reserve_fun_def)dlsym(gLibrary, "jack_midi_event_reserve"); + jack_midi_event_write_fun = (jack_midi_event_write_fun_def)dlsym(gLibrary, "jack_midi_event_write"); + jack_midi_get_lost_event_count_fun = (jack_midi_get_lost_event_count_fun_def)dlsym(gLibrary, "jack_midi_get_lost_event_count"); // Functions were kept... if (error_fun)