/[svn]/liblscp/trunk/src/common.h
ViewVC logotype

Annotation of /liblscp/trunk/src/common.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3866 - (hide annotations) (download) (as text)
Sat Mar 27 12:17:51 2021 UTC (3 years ago) by capela
File MIME type: text/x-c++hdr
File size: 9021 byte(s)
* Switching to CMake build system as for packaging default.
1 capela 103 // common.h
2     //
3     /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API
5 capela 3866 Copyright (C) 2004-2021, rncbc aka Rui Nuno Capela. All rights reserved.
6 capela 103
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 capela 921 You should have received a copy of the GNU General Public License along
18     with this program; if not, write to the Free Software Foundation, Inc.,
19     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 capela 103
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 capela 952 // Client socket stuff.
42     lscp_client_proc_t pfnCallback;
43     void * pvData;
44     lscp_socket_agent_t cmd;
45     lscp_socket_agent_t evt;
46     // Subscribed events.
47     lscp_event_t events;
48     // Client struct persistent caches.
49     char ** audio_drivers;
50     char ** midi_drivers;
51     int * audio_devices;
52     int * midi_devices;
53     char ** engines;
54     int * channels;
55 capela 1019 int * fxsends;
56 capela 952 lscp_midi_instrument_t *midi_instruments;
57 capela 975 int * midi_maps;
58     char * midi_map_name;
59 capela 952 // Client struct volatile caches.
60     lscp_driver_info_t audio_driver_info;
61     lscp_driver_info_t midi_driver_info;
62     lscp_device_info_t audio_device_info;
63     lscp_device_info_t midi_device_info;
64     lscp_param_info_t audio_param_info;
65     lscp_param_info_t midi_param_info;
66     lscp_device_port_info_t audio_channel_info;
67     lscp_device_port_info_t midi_port_info;
68     lscp_param_info_t audio_channel_param_info;
69     lscp_param_info_t midi_port_param_info;
70     lscp_server_info_t server_info;
71     lscp_engine_info_t engine_info;
72     lscp_channel_info_t channel_info;
73 capela 1019 lscp_fxsend_info_t fxsend_info;
74 capela 952 lscp_midi_instrument_info_t midi_instrument_info;
75     // Result and error status.
76     char * pszResult;
77     int iErrno;
78     // Stream buffers status.
79     lscp_buffer_fill_t *buffer_fill;
80     int iStreamCount;
81     // Transaction call timeout (msecs).
82     int iTimeout;
83     lscp_mutex_t mutex;
84     lscp_cond_t cond;
85     // Flag last transaction timedout.
86     int iTimeoutCount;
87 capela 103 };
88    
89    
90     //-------------------------------------------------------------------------
91 capela 132 // Local client request executive.
92    
93 capela 253 lscp_status_t lscp_client_recv (lscp_client_t *pClient, char *pchBuffer, int *pcchBuffer, int iTimeout);
94 capela 948 lscp_status_t lscp_client_call (lscp_client_t *pClient, const char *pszQuery, int iResult);
95 capela 132 void lscp_client_set_result (lscp_client_t *pClient, char *pszResult, int iErrno);
96    
97     //-------------------------------------------------------------------------
98 capela 103 // General utility function prototypes.
99    
100 capela 948 char * lscp_strtok (char *pchBuffer, const char *pszSeps, char **ppch);
101     char * lscp_ltrim (char *psz);
102     char * lscp_unquote (char **ppsz, int dup);
103     void lscp_unquote_dup (char **ppszDst, char **ppszSrc);
104 capela 103
105 capela 948 char ** lscp_szsplit_create (const char *pszCsv, const char *pszSeps);
106     void lscp_szsplit_destroy (char **ppszSplit);
107 capela 103 #ifdef LSCP_SZSPLIT_COUNT
108 capela 948 int lscp_szsplit_count (char **ppszSplit);
109     int lscp_szsplit_size (char **ppszSplit);
110 capela 103 #endif
111    
112 capela 948 int * lscp_isplit_create (const char *pszCsv, const char *pszSeps);
113     void lscp_isplit_destroy (int *piSplit);
114 capela 125 #ifdef LSCP_ISPLIT_COUNT
115 capela 948 int lscp_isplit_count (int *piSplit);
116     int lscp_isplit_size (int *piSplit);
117 capela 125 #endif
118 capela 103
119 capela 948 lscp_param_t * lscp_psplit_create (const char *pszCsv, const char *pszSep1, const char *pszSep2);
120     void lscp_psplit_destroy (lscp_param_t *ppSplit);
121 capela 158 #ifdef LSCP_PSPLIT_COUNT
122 capela 948 int lscp_psplit_count (lscp_param_t *ppSplit);
123     int lscp_psplit_size (lscp_param_t *ppSplit);
124 capela 158 #endif
125    
126 capela 171 void lscp_plist_alloc (lscp_param_t **ppList);
127     void lscp_plist_free (lscp_param_t **ppList);
128     void lscp_plist_append (lscp_param_t **ppList, const char *pszKey, const char *pszValue);
129     #ifdef LSCP_PLIST_COUNT
130     int lscp_plist_count (lscp_param_t **ppList);
131     int lscp_plist_size (lscp_param_t **ppList);
132     #endif
133    
134 capela 948 lscp_midi_instrument_t *lscp_midi_instruments_create (const char *pszCsv);
135     void lscp_midi_instruments_destroy (lscp_midi_instrument_t *pInstrs);
136     #ifdef LSCP_MIDI_INSTRUMENTS_COUNT
137     int lscp_midi_instruments_count (lscp_midi_instrument_t *pInstrs);
138     int lscp_midi_instruments_size (lscp_midi_instrument_t *pInstrs);
139     #endif
140    
141    
142 capela 103 //-------------------------------------------------------------------------
143 capela 564 // Server struct helper functions.
144    
145     void lscp_server_info_init (lscp_server_info_t *pServerInfo);
146     void lscp_server_info_free (lscp_server_info_t *pServerInfo);
147     void lscp_server_info_reset (lscp_server_info_t *pServerInfo);
148    
149     //-------------------------------------------------------------------------
150 capela 103 // Engine struct helper functions.
151    
152 capela 132 void lscp_engine_info_init (lscp_engine_info_t *pEngineInfo);
153 capela 179 void lscp_engine_info_free (lscp_engine_info_t *pEngineInfo);
154 capela 132 void lscp_engine_info_reset (lscp_engine_info_t *pEngineInfo);
155 capela 103
156     //-------------------------------------------------------------------------
157     // Channel struct helper functions.
158    
159 capela 132 void lscp_channel_info_init (lscp_channel_info_t *pChannelInfo);
160 capela 179 void lscp_channel_info_free (lscp_channel_info_t *pChannelInfo);
161 capela 132 void lscp_channel_info_reset (lscp_channel_info_t *pChannelInfo);
162 capela 103
163     //-------------------------------------------------------------------------
164     // Driver struct helper functions.
165    
166 capela 132 void lscp_driver_info_init (lscp_driver_info_t *pDriverInfo);
167 capela 179 void lscp_driver_info_free (lscp_driver_info_t *pDriverInfo);
168 capela 132 void lscp_driver_info_reset (lscp_driver_info_t *pDriverInfo);
169 capela 103
170 capela 163 //-------------------------------------------------------------------------
171 capela 171 // Device struct helper functions.
172    
173     void lscp_device_info_init (lscp_device_info_t *pDeviceInfo);
174 capela 179 void lscp_device_info_free (lscp_device_info_t *pDeviceInfo);
175 capela 171 void lscp_device_info_reset (lscp_device_info_t *pDeviceInfo);
176    
177     //-------------------------------------------------------------------------
178     // Device channel/port struct helper functions.
179    
180     void lscp_device_port_info_init (lscp_device_port_info_t *pDevicePortInfo);
181 capela 179 void lscp_device_port_info_free (lscp_device_port_info_t *pDevicePortInfo);
182 capela 171 void lscp_device_port_info_reset (lscp_device_port_info_t *pDevicePortInfo);
183    
184     //-------------------------------------------------------------------------
185 capela 163 // Parameter struct helper functions.
186 capela 103
187 capela 163 void lscp_param_info_init (lscp_param_info_t *pParamInfo);
188 capela 179 void lscp_param_info_free (lscp_param_info_t *pParamInfo);
189 capela 163 void lscp_param_info_reset (lscp_param_info_t *pParamInfo);
190    
191     //-------------------------------------------------------------------------
192     // Concatenate a parameter list (key='value'...) into a string.
193    
194     int lscp_param_concat (char *pszBuffer, int cchMaxBuffer, lscp_param_t *pParams);
195    
196 capela 946 //-------------------------------------------------------------------------
197 capela 1019 // Effect struct helper functions.
198    
199     void lscp_fxsend_info_init (lscp_fxsend_info_t *pFxSendInfo);
200     void lscp_fxsend_info_free (lscp_fxsend_info_t *pFxSendInfo);
201     void lscp_fxsend_info_reset (lscp_fxsend_info_t *pFxSendInfo);
202    
203     //-------------------------------------------------------------------------
204 capela 946 // MIDI instrument info struct helper functions.
205 capela 163
206 capela 948 void lscp_midi_instrument_info_init (lscp_midi_instrument_info_t *pInstrInfo);
207     void lscp_midi_instrument_info_free (lscp_midi_instrument_info_t *pInstrInfo);
208     void lscp_midi_instrument_info_reset (lscp_midi_instrument_info_t *pInstrInfo);
209 capela 946
210    
211 capela 103 #endif // __LSCP_COMMON_H
212    
213     // end of common.h

  ViewVC Help
Powered by ViewVC