| 1 | | /* |
|---|
| 2 | | Copyright (C) 2009 Grame |
|---|
| 3 | | |
|---|
| 4 | | This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | it under the terms of the GNU Lesser General Public License as published by |
|---|
| 6 | | the Free Software Foundation; either version 2.1 of the License, or |
|---|
| 7 | | (at your option) any later version. |
|---|
| 8 | | |
|---|
| 9 | | This program is distributed in the hope that it will be useful, |
|---|
| 10 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | GNU Lesser General Public License for more details. |
|---|
| 13 | | |
|---|
| 14 | | You should have received a copy of the GNU Lesser General Public License |
|---|
| 15 | | along with this program; if not, write to the Free Software |
|---|
| 16 | | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 17 | | |
|---|
| 18 | | */ |
|---|
| 19 | | |
|---|
| 20 | | /* |
|---|
| 21 | | Completed from Julien Pommier (PianoTeq : http://www.pianoteq.com/) code. |
|---|
| 22 | | */ |
|---|
| | 1 | //============================================================================= |
|---|
| | 2 | // MuseScore |
|---|
| | 3 | // Linux Music Score Editor |
|---|
| | 4 | // $Id: |
|---|
| | 5 | // |
|---|
| | 6 | // jackWeakAPI based on code from Stéphane Letz (Grame) |
|---|
| | 7 | // partly based on Julien Pommier (PianoTeq : http://www.pianoteq.com/) code. |
|---|
| | 8 | // |
|---|
| | 9 | // Copyright (C) 2002-2007 Werner Schweer and others |
|---|
| | 10 | // Copyright (C) 2009 Grame |
|---|
| | 11 | |
|---|
| | 12 | // This program is free software; you can redistribute it and/or modify |
|---|
| | 13 | // it under the terms of the GNU Lesser General Public License as published by |
|---|
| | 14 | // the Free Software Foundation; either version 2.1 of the License, or |
|---|
| | 15 | // (at your option) any later version. |
|---|
| | 16 | |
|---|
| | 17 | // This program is distributed in the hope that it will be useful, |
|---|
| | 18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| | 19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| | 20 | // GNU Lesser General Public License for more details. |
|---|
| | 21 | |
|---|
| | 22 | // You should have received a copy of the GNU Lesser General Public License |
|---|
| | 23 | // along with this program; if not, write to the Free Software |
|---|
| | 24 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 79 | | std::cerr << "could not dlsym(" << libjack_handle << "), " << dlerror() << "\n"; |
|---|
| | 82 | #ifdef WIN32 |
|---|
| | 83 | char* lpMsgBuf; |
|---|
| | 84 | FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPTSTR) &lpMsgBuf,0,NULL ); |
|---|
| | 85 | fprintf (stderr, "could not GetProcAddress( %s ), %s \n", fn_name, lpMsgBuf) ; |
|---|
| | 86 | #else |
|---|
| | 87 | fprintf (stderr, "could not dlsym( %s ), %s \n", fn_name, dlerror()) ; |
|---|
| | 88 | #endif |
|---|
| | 102 | #define DECL_FUNCTION_NULL(return_type, fn_name, arguments_types, arguments) \ |
|---|
| | 103 | typedef return_type (*fn_name##_ptr_t)arguments_types; \ |
|---|
| | 104 | return_type fn_name arguments_types { \ |
|---|
| | 105 | static fn_name##_ptr_t fn = 0; \ |
|---|
| | 106 | if (fn == 0) { fn = (fn_name##_ptr_t)load_jack_function(#fn_name); } \ |
|---|
| | 107 | if (fn) return (*fn)arguments; \ |
|---|
| | 108 | else return (return_type)0; \ |
|---|
| | 109 | } |
|---|
| | 110 | |
|---|
| 102 | | DECL_FUNCTION(const char *, jack_get_version_string, (), ()); |
|---|
| 103 | | DECL_FUNCTION(jack_client_t *, jack_client_open, (const char *client_name, jack_options_t options, jack_status_t *status, ...), |
|---|
| | 121 | DECL_FUNCTION_NULL(const char *, jack_get_version_string, (), ()); |
|---|
| | 122 | DECL_FUNCTION_NULL(jack_client_t *, jack_client_open, (const char *client_name, jack_options_t options, jack_status_t *status, ...), |
|---|
| 165 | | DECL_FUNCTION(void *, jack_port_get_buffer, (jack_port_t *port, jack_nframes_t nframes), (port, nframes)); |
|---|
| 166 | | DECL_FUNCTION(const char*, jack_port_name, (const jack_port_t *port), (port)); |
|---|
| 167 | | DECL_FUNCTION(const char*, jack_port_short_name, (const jack_port_t *port), (port)); |
|---|
| | 184 | DECL_FUNCTION_NULL(void *, jack_port_get_buffer, (jack_port_t *port, jack_nframes_t nframes), (port, nframes)); |
|---|
| | 185 | DECL_FUNCTION_NULL(const char*, jack_port_name, (const jack_port_t *port), (port)); |
|---|
| | 186 | DECL_FUNCTION_NULL(const char*, jack_port_short_name, (const jack_port_t *port), (port)); |
|---|
| 170 | 189 | DECL_FUNCTION(jack_port_type_id_t, jack_port_type_id, (const jack_port_t *port), (port)); |
|---|
| 171 | 190 | DECL_FUNCTION(int, jack_port_is_mine, (const jack_client_t *client, const jack_port_t* port), (client, port)); |
|---|
| 172 | 191 | DECL_FUNCTION(int, jack_port_connected, (const jack_port_t *port), (port)); |
|---|
| 173 | 192 | DECL_FUNCTION(int, jack_port_connected_to, (const jack_port_t *port, const char *port_name), (port, port_name)); |
|---|
| 174 | | DECL_FUNCTION(const char**, jack_port_get_connections, (const jack_port_t *port), (port)); |
|---|
| 175 | | DECL_FUNCTION(const char**, jack_port_get_all_connections, (const jack_client_t *client,const jack_port_t *port), (client, port)); |
|---|
| | 193 | DECL_FUNCTION_NULL(const char**, jack_port_get_connections, (const jack_port_t *port), (port)); |
|---|
| | 194 | DECL_FUNCTION_NULL(const char**, jack_port_get_all_connections, (const jack_client_t *client,const jack_port_t *port), (client, port)); |
|---|
| 202 | | DECL_FUNCTION(jack_port_t *, jack_port_by_name, (jack_client_t * client, const char *port_name), (client, port_name)); |
|---|
| 203 | | DECL_FUNCTION(jack_port_t *, jack_port_by_id, (jack_client_t *client, jack_port_id_t port_id), (client, port_id)); |
|---|
| | 221 | DECL_FUNCTION_NULL(jack_port_t *, jack_port_by_name, (jack_client_t * client, const char *port_name), (client, port_name)); |
|---|
| | 222 | DECL_FUNCTION_NULL(jack_port_t *, jack_port_by_id, (jack_client_t *client, jack_port_id_t port_id), (client, port_id)); |
|---|
| 271 | | DECL_FUNCTION(jack_midi_data_t*, jack_midi_event_reserve, (void* port_buffer, jack_nframes_t time, size_t data_size), (port_buffer, time, data_size)); |
|---|
| | 290 | DECL_FUNCTION_NULL(jack_midi_data_t*, jack_midi_event_reserve, (void* port_buffer, jack_nframes_t time, size_t data_size), (port_buffer, time, data_size)); |
|---|