2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
liblscp - LinuxSampler Control Protocol API |
liblscp - LinuxSampler Control Protocol API |
5 |
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
7 |
This library is free software; you can redistribute it and/or |
This library is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU Lesser General Public |
modify it under the terms of the GNU Lesser General Public |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 |
Lesser General Public License for more details. |
Lesser General Public License for more details. |
16 |
|
|
17 |
You should have received a copy of the GNU Lesser General Public |
You should have received a copy of the GNU General Public License along |
18 |
License along with this library; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
38 |
|
|
39 |
struct _lscp_client_t |
struct _lscp_client_t |
40 |
{ |
{ |
41 |
// Client socket stuff. |
// Client socket stuff. |
42 |
lscp_client_proc_t pfnCallback; |
lscp_client_proc_t pfnCallback; |
43 |
void * pvData; |
void * pvData; |
44 |
lscp_socket_agent_t cmd; |
lscp_socket_agent_t cmd; |
45 |
lscp_socket_agent_t evt; |
lscp_socket_agent_t evt; |
46 |
// Subscribed events. |
// Subscribed events. |
47 |
lscp_event_t events; |
lscp_event_t events; |
48 |
// Client struct persistent caches. |
// Client struct persistent caches. |
49 |
char ** audio_drivers; |
char ** audio_drivers; |
50 |
char ** midi_drivers; |
char ** midi_drivers; |
51 |
int * audio_devices; |
int * audio_devices; |
52 |
int * midi_devices; |
int * midi_devices; |
53 |
char ** engines; |
char ** engines; |
54 |
int * channels; |
int * channels; |
55 |
// Client struct volatile caches. |
lscp_midi_instrument_t *midi_instruments; |
56 |
lscp_driver_info_t audio_driver_info; |
int * midi_maps; |
57 |
lscp_driver_info_t midi_driver_info; |
char * midi_map_name; |
58 |
lscp_device_info_t audio_device_info; |
// Client struct volatile caches. |
59 |
lscp_device_info_t midi_device_info; |
lscp_driver_info_t audio_driver_info; |
60 |
lscp_param_info_t audio_param_info; |
lscp_driver_info_t midi_driver_info; |
61 |
lscp_param_info_t midi_param_info; |
lscp_device_info_t audio_device_info; |
62 |
lscp_device_port_info_t audio_channel_info; |
lscp_device_info_t midi_device_info; |
63 |
lscp_device_port_info_t midi_port_info; |
lscp_param_info_t audio_param_info; |
64 |
lscp_param_info_t audio_channel_param_info; |
lscp_param_info_t midi_param_info; |
65 |
lscp_param_info_t midi_port_param_info; |
lscp_device_port_info_t audio_channel_info; |
66 |
lscp_engine_info_t engine_info; |
lscp_device_port_info_t midi_port_info; |
67 |
lscp_channel_info_t channel_info; |
lscp_param_info_t audio_channel_param_info; |
68 |
// Result and error status. |
lscp_param_info_t midi_port_param_info; |
69 |
char * pszResult; |
lscp_server_info_t server_info; |
70 |
int iErrno; |
lscp_engine_info_t engine_info; |
71 |
// Stream buffers status. |
lscp_channel_info_t channel_info; |
72 |
lscp_buffer_fill_t *buffer_fill; |
lscp_midi_instrument_info_t midi_instrument_info; |
73 |
int iStreamCount; |
// Result and error status. |
74 |
// Transaction call timeout (msecs). |
char * pszResult; |
75 |
int iTimeout; |
int iErrno; |
76 |
lscp_mutex_t mutex; |
// Stream buffers status. |
77 |
lscp_cond_t cond; |
lscp_buffer_fill_t *buffer_fill; |
78 |
|
int iStreamCount; |
79 |
|
// Transaction call timeout (msecs). |
80 |
|
int iTimeout; |
81 |
|
lscp_mutex_t mutex; |
82 |
|
lscp_cond_t cond; |
83 |
|
// Flag last transaction timedout. |
84 |
|
int iTimeoutCount; |
85 |
}; |
}; |
86 |
|
|
87 |
|
|
89 |
// Local client request executive. |
// Local client request executive. |
90 |
|
|
91 |
lscp_status_t lscp_client_recv (lscp_client_t *pClient, char *pchBuffer, int *pcchBuffer, int iTimeout); |
lscp_status_t lscp_client_recv (lscp_client_t *pClient, char *pchBuffer, int *pcchBuffer, int iTimeout); |
92 |
lscp_status_t lscp_client_call (lscp_client_t *pClient, const char *pszQuery); |
lscp_status_t lscp_client_call (lscp_client_t *pClient, const char *pszQuery, int iResult); |
93 |
void lscp_client_set_result (lscp_client_t *pClient, char *pszResult, int iErrno); |
void lscp_client_set_result (lscp_client_t *pClient, char *pszResult, int iErrno); |
94 |
|
|
95 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
96 |
// General utility function prototypes. |
// General utility function prototypes. |
97 |
|
|
98 |
char * lscp_strtok (char *pchBuffer, const char *pszSeps, char **ppch); |
char * lscp_strtok (char *pchBuffer, const char *pszSeps, char **ppch); |
99 |
char * lscp_ltrim (char *psz); |
char * lscp_ltrim (char *psz); |
100 |
char * lscp_unquote (char **ppsz, int dup); |
char * lscp_unquote (char **ppsz, int dup); |
101 |
void lscp_unquote_dup (char **ppszDst, char **ppszSrc); |
void lscp_unquote_dup (char **ppszDst, char **ppszSrc); |
102 |
|
|
103 |
char ** lscp_szsplit_create (const char *pszCsv, const char *pszSeps); |
char ** lscp_szsplit_create (const char *pszCsv, const char *pszSeps); |
104 |
void lscp_szsplit_destroy (char **ppszSplit); |
void lscp_szsplit_destroy (char **ppszSplit); |
105 |
#ifdef LSCP_SZSPLIT_COUNT |
#ifdef LSCP_SZSPLIT_COUNT |
106 |
int lscp_szsplit_count (char **ppszSplit); |
int lscp_szsplit_count (char **ppszSplit); |
107 |
int lscp_szsplit_size (char **ppszSplit); |
int lscp_szsplit_size (char **ppszSplit); |
108 |
#endif |
#endif |
109 |
|
|
110 |
int * lscp_isplit_create (const char *pszCsv, const char *pszSeps); |
int * lscp_isplit_create (const char *pszCsv, const char *pszSeps); |
111 |
void lscp_isplit_destroy (int *piSplit); |
void lscp_isplit_destroy (int *piSplit); |
112 |
#ifdef LSCP_ISPLIT_COUNT |
#ifdef LSCP_ISPLIT_COUNT |
113 |
int lscp_isplit_count (int *piSplit); |
int lscp_isplit_count (int *piSplit); |
114 |
int lscp_isplit_size (int *piSplit); |
int lscp_isplit_size (int *piSplit); |
115 |
#endif |
#endif |
116 |
|
|
117 |
lscp_param_t * lscp_psplit_create (const char *pszCsv, const char *pszSep1, const char *pszSep2); |
lscp_param_t * lscp_psplit_create (const char *pszCsv, const char *pszSep1, const char *pszSep2); |
118 |
void lscp_psplit_destroy (lscp_param_t *ppSplit); |
void lscp_psplit_destroy (lscp_param_t *ppSplit); |
119 |
#ifdef LSCP_PSPLIT_COUNT |
#ifdef LSCP_PSPLIT_COUNT |
120 |
int lscp_psplit_count (lscp_param_t *ppSplit); |
int lscp_psplit_count (lscp_param_t *ppSplit); |
121 |
int lscp_psplit_size (lscp_param_t *ppSplit); |
int lscp_psplit_size (lscp_param_t *ppSplit); |
122 |
#endif |
#endif |
123 |
|
|
124 |
void lscp_plist_alloc (lscp_param_t **ppList); |
void lscp_plist_alloc (lscp_param_t **ppList); |
129 |
int lscp_plist_size (lscp_param_t **ppList); |
int lscp_plist_size (lscp_param_t **ppList); |
130 |
#endif |
#endif |
131 |
|
|
132 |
|
lscp_midi_instrument_t *lscp_midi_instruments_create (const char *pszCsv); |
133 |
|
void lscp_midi_instruments_destroy (lscp_midi_instrument_t *pInstrs); |
134 |
|
#ifdef LSCP_MIDI_INSTRUMENTS_COUNT |
135 |
|
int lscp_midi_instruments_count (lscp_midi_instrument_t *pInstrs); |
136 |
|
int lscp_midi_instruments_size (lscp_midi_instrument_t *pInstrs); |
137 |
|
#endif |
138 |
|
|
139 |
|
|
140 |
|
//------------------------------------------------------------------------- |
141 |
|
// Server struct helper functions. |
142 |
|
|
143 |
|
void lscp_server_info_init (lscp_server_info_t *pServerInfo); |
144 |
|
void lscp_server_info_free (lscp_server_info_t *pServerInfo); |
145 |
|
void lscp_server_info_reset (lscp_server_info_t *pServerInfo); |
146 |
|
|
147 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
148 |
// Engine struct helper functions. |
// Engine struct helper functions. |
149 |
|
|
191 |
|
|
192 |
int lscp_param_concat (char *pszBuffer, int cchMaxBuffer, lscp_param_t *pParams); |
int lscp_param_concat (char *pszBuffer, int cchMaxBuffer, lscp_param_t *pParams); |
193 |
|
|
194 |
|
//------------------------------------------------------------------------- |
195 |
|
// MIDI instrument info struct helper functions. |
196 |
|
|
197 |
|
void lscp_midi_instrument_info_init (lscp_midi_instrument_info_t *pInstrInfo); |
198 |
|
void lscp_midi_instrument_info_free (lscp_midi_instrument_info_t *pInstrInfo); |
199 |
|
void lscp_midi_instrument_info_reset (lscp_midi_instrument_info_t *pInstrInfo); |
200 |
|
|
201 |
|
|
202 |
#endif // __LSCP_COMMON_H |
#endif // __LSCP_COMMON_H |
203 |
|
|