1 |
capela |
103 |
// common.h |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
|
|
liblscp - LinuxSampler Control Protocol API |
5 |
|
|
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
|
7 |
|
|
This library is free software; you can redistribute it and/or |
8 |
|
|
modify it under the terms of the GNU Lesser General Public |
9 |
|
|
License as published by the Free Software Foundation; either |
10 |
|
|
version 2.1 of the License, or (at your option) any later version. |
11 |
|
|
|
12 |
|
|
This library is distributed in the hope that it will be useful, |
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 |
|
|
Lesser General Public License for more details. |
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU Lesser General Public |
18 |
|
|
License along with this library; if not, write to the Free Software |
19 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
|
|
|
21 |
|
|
*****************************************************************************/ |
22 |
|
|
|
23 |
|
|
#ifndef __LSCP_COMMON_H |
24 |
|
|
#define __LSCP_COMMON_H |
25 |
|
|
|
26 |
|
|
#include "lscp/client.h" |
27 |
|
|
#include "lscp/device.h" |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
// Case unsensitive comparison substitutes. |
31 |
|
|
#if defined(WIN32) |
32 |
|
|
#define strcasecmp stricmp |
33 |
|
|
#define strncasecmp strnicmp |
34 |
|
|
#endif |
35 |
|
|
|
36 |
|
|
//------------------------------------------------------------------------- |
37 |
|
|
// Client opaque descriptor struct. |
38 |
|
|
|
39 |
|
|
struct _lscp_client_t |
40 |
|
|
{ |
41 |
|
|
// Client socket stuff. |
42 |
|
|
lscp_client_proc_t pfnCallback; |
43 |
|
|
void * pvData; |
44 |
|
|
lscp_socket_agent_t tcp; |
45 |
|
|
lscp_socket_agent_t udp; |
46 |
|
|
// Session identifier. |
47 |
|
|
char * sessid; |
48 |
|
|
// Client struct persistent caches. |
49 |
|
|
char ** audio_drivers; |
50 |
|
|
char ** midi_drivers; |
51 |
|
|
char ** engines; |
52 |
|
|
// Client struct volatile caches. |
53 |
|
|
lscp_driver_info_t audio_info; |
54 |
|
|
lscp_driver_info_t midi_info; |
55 |
|
|
lscp_engine_info_t engine_info; |
56 |
|
|
lscp_channel_info_t channel_info; |
57 |
|
|
// Result and error status. |
58 |
|
|
char * pszResult; |
59 |
|
|
int iErrno; |
60 |
|
|
// Stream buffers status. |
61 |
|
|
lscp_buffer_fill_t *buffer_fill; |
62 |
|
|
int iStreamCount; |
63 |
|
|
// Transaction call timeout (msecs). |
64 |
|
|
int iTimeout; |
65 |
|
|
lscp_mutex_t mutex; |
66 |
|
|
}; |
67 |
|
|
|
68 |
|
|
|
69 |
|
|
//------------------------------------------------------------------------- |
70 |
|
|
// General utility function prototypes. |
71 |
|
|
|
72 |
|
|
char * lscp_strtok (char *pchBuffer, const char *pszSeps, char **ppch); |
73 |
|
|
char * lscp_ltrim (char *psz); |
74 |
|
|
char * lscp_unquote (char **ppsz, int dup); |
75 |
|
|
|
76 |
|
|
char ** lscp_szsplit_create (const char *pszCsv, const char *pszSeps); |
77 |
|
|
void lscp_szsplit_destroy (char **ppszSplit); |
78 |
|
|
#ifdef LSCP_SZSPLIT_COUNT |
79 |
|
|
int lscp_szsplit_count (char **ppszSplit); |
80 |
|
|
int lscp_szsplit_size (char **ppszSplit); |
81 |
|
|
#endif |
82 |
|
|
|
83 |
|
|
|
84 |
|
|
//------------------------------------------------------------------------- |
85 |
|
|
// Engine struct helper functions. |
86 |
|
|
|
87 |
|
|
void lscp_engine_info_init (lscp_engine_info_t *pEngineInfo); |
88 |
|
|
void lscp_engine_info_reset (lscp_engine_info_t *pEngineInfo); |
89 |
|
|
|
90 |
|
|
//------------------------------------------------------------------------- |
91 |
|
|
// Channel struct helper functions. |
92 |
|
|
|
93 |
|
|
void lscp_channel_info_init (lscp_channel_info_t *pChannelInfo); |
94 |
|
|
void lscp_channel_info_reset (lscp_channel_info_t *pChannelInfo); |
95 |
|
|
|
96 |
|
|
//------------------------------------------------------------------------- |
97 |
|
|
// Driver struct helper functions. |
98 |
|
|
|
99 |
|
|
void lscp_driver_info_init (lscp_driver_info_t *pDriverInfo); |
100 |
|
|
void lscp_driver_info_reset (lscp_driver_info_t *pDriverInfo); |
101 |
|
|
|
102 |
|
|
|
103 |
|
|
#endif // __LSCP_COMMON_H |
104 |
|
|
|
105 |
|
|
// end of common.h |