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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 946 - (hide annotations) (download) (as text)
Mon Nov 27 18:33:02 2006 UTC (17 years, 4 months ago) by capela
File MIME type: text/x-c++hdr
File size: 8333 byte(s)
* As of the LSCP 1.2 working draft document, added
  some missing client interface functions:
    lscp_get_total_voice_count();
    lscp_get_total_voice_count_max();
  and for the new MIDI instrument mapping features:
    lscp_map_midi_instrument();
    lscp_unmap_midi_instrument();
    lscp_get_midi_instruments();
    lscp_get_midi_instrument_info();
    lscp_clear_midi_instruments();

1 capela 103 // common.h
2     //
3     /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API
5 capela 869 Copyright (C) 2004-2006, 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     // Client socket stuff.
42     lscp_client_proc_t pfnCallback;
43     void * pvData;
44 capela 132 lscp_socket_agent_t cmd;
45     lscp_socket_agent_t evt;
46 capela 144 // Subscribed events.
47     lscp_event_t events;
48 capela 103 // Client struct persistent caches.
49     char ** audio_drivers;
50     char ** midi_drivers;
51 capela 125 int * audio_devices;
52     int * midi_devices;
53 capela 103 char ** engines;
54 capela 125 int * channels;
55 capela 103 // Client struct volatile caches.
56 capela 171 lscp_driver_info_t audio_driver_info;
57     lscp_driver_info_t midi_driver_info;
58     lscp_device_info_t audio_device_info;
59     lscp_device_info_t midi_device_info;
60 capela 163 lscp_param_info_t audio_param_info;
61     lscp_param_info_t midi_param_info;
62 capela 171 lscp_device_port_info_t audio_channel_info;
63     lscp_device_port_info_t midi_port_info;
64     lscp_param_info_t audio_channel_param_info;
65     lscp_param_info_t midi_port_param_info;
66 capela 564 lscp_server_info_t server_info;
67 capela 103 lscp_engine_info_t engine_info;
68     lscp_channel_info_t channel_info;
69 capela 946 lscp_midi_instrument_info_t midi_instrument_info;
70 capela 103 // Result and error status.
71     char * pszResult;
72     int iErrno;
73     // Stream buffers status.
74     lscp_buffer_fill_t *buffer_fill;
75     int iStreamCount;
76     // Transaction call timeout (msecs).
77     int iTimeout;
78     lscp_mutex_t mutex;
79 capela 177 lscp_cond_t cond;
80 capela 623 // Flag last transaction timedout.
81 capela 626 int iTimeoutCount;
82 capela 103 };
83    
84    
85     //-------------------------------------------------------------------------
86 capela 132 // Local client request executive.
87    
88 capela 253 lscp_status_t lscp_client_recv (lscp_client_t *pClient, char *pchBuffer, int *pcchBuffer, int iTimeout);
89 capela 132 lscp_status_t lscp_client_call (lscp_client_t *pClient, const char *pszQuery);
90     void lscp_client_set_result (lscp_client_t *pClient, char *pszResult, int iErrno);
91    
92     //-------------------------------------------------------------------------
93 capela 103 // General utility function prototypes.
94    
95 capela 132 char * lscp_strtok (char *pchBuffer, const char *pszSeps, char **ppch);
96     char * lscp_ltrim (char *psz);
97     char * lscp_unquote (char **ppsz, int dup);
98 capela 180 void lscp_unquote_dup (char **ppszDst, char **ppszSrc);
99 capela 103
100 capela 132 char ** lscp_szsplit_create (const char *pszCsv, const char *pszSeps);
101     void lscp_szsplit_destroy (char **ppszSplit);
102 capela 103 #ifdef LSCP_SZSPLIT_COUNT
103 capela 132 int lscp_szsplit_count (char **ppszSplit);
104     int lscp_szsplit_size (char **ppszSplit);
105 capela 103 #endif
106    
107 capela 132 int * lscp_isplit_create (const char *pszCsv, const char *pszSeps);
108 capela 158 void lscp_isplit_destroy (int *piSplit);
109 capela 125 #ifdef LSCP_ISPLIT_COUNT
110 capela 158 int lscp_isplit_count (int *piSplit);
111     int lscp_isplit_size (int *piSplit);
112 capela 125 #endif
113 capela 103
114 capela 158 lscp_param_t * lscp_psplit_create (const char *pszCsv, const char *pszSep1, const char *pszSep2);
115     void lscp_psplit_destroy (lscp_param_t *ppSplit);
116     #ifdef LSCP_PSPLIT_COUNT
117     int lscp_psplit_count (lscp_param_t *ppSplit);
118     int lscp_psplit_size (lscp_param_t *ppSplit);
119     #endif
120    
121 capela 171 void lscp_plist_alloc (lscp_param_t **ppList);
122     void lscp_plist_free (lscp_param_t **ppList);
123     void lscp_plist_append (lscp_param_t **ppList, const char *pszKey, const char *pszValue);
124     #ifdef LSCP_PLIST_COUNT
125     int lscp_plist_count (lscp_param_t **ppList);
126     int lscp_plist_size (lscp_param_t **ppList);
127     #endif
128    
129 capela 103 //-------------------------------------------------------------------------
130 capela 564 // Server struct helper functions.
131    
132     void lscp_server_info_init (lscp_server_info_t *pServerInfo);
133     void lscp_server_info_free (lscp_server_info_t *pServerInfo);
134     void lscp_server_info_reset (lscp_server_info_t *pServerInfo);
135    
136     //-------------------------------------------------------------------------
137 capela 103 // Engine struct helper functions.
138    
139 capela 132 void lscp_engine_info_init (lscp_engine_info_t *pEngineInfo);
140 capela 179 void lscp_engine_info_free (lscp_engine_info_t *pEngineInfo);
141 capela 132 void lscp_engine_info_reset (lscp_engine_info_t *pEngineInfo);
142 capela 103
143     //-------------------------------------------------------------------------
144     // Channel struct helper functions.
145    
146 capela 132 void lscp_channel_info_init (lscp_channel_info_t *pChannelInfo);
147 capela 179 void lscp_channel_info_free (lscp_channel_info_t *pChannelInfo);
148 capela 132 void lscp_channel_info_reset (lscp_channel_info_t *pChannelInfo);
149 capela 103
150     //-------------------------------------------------------------------------
151     // Driver struct helper functions.
152    
153 capela 132 void lscp_driver_info_init (lscp_driver_info_t *pDriverInfo);
154 capela 179 void lscp_driver_info_free (lscp_driver_info_t *pDriverInfo);
155 capela 132 void lscp_driver_info_reset (lscp_driver_info_t *pDriverInfo);
156 capela 103
157 capela 163 //-------------------------------------------------------------------------
158 capela 171 // Device struct helper functions.
159    
160     void lscp_device_info_init (lscp_device_info_t *pDeviceInfo);
161 capela 179 void lscp_device_info_free (lscp_device_info_t *pDeviceInfo);
162 capela 171 void lscp_device_info_reset (lscp_device_info_t *pDeviceInfo);
163    
164     //-------------------------------------------------------------------------
165     // Device channel/port struct helper functions.
166    
167     void lscp_device_port_info_init (lscp_device_port_info_t *pDevicePortInfo);
168 capela 179 void lscp_device_port_info_free (lscp_device_port_info_t *pDevicePortInfo);
169 capela 171 void lscp_device_port_info_reset (lscp_device_port_info_t *pDevicePortInfo);
170    
171     //-------------------------------------------------------------------------
172 capela 163 // Parameter struct helper functions.
173 capela 103
174 capela 163 void lscp_param_info_init (lscp_param_info_t *pParamInfo);
175 capela 179 void lscp_param_info_free (lscp_param_info_t *pParamInfo);
176 capela 163 void lscp_param_info_reset (lscp_param_info_t *pParamInfo);
177    
178     //-------------------------------------------------------------------------
179     // Concatenate a parameter list (key='value'...) into a string.
180    
181     int lscp_param_concat (char *pszBuffer, int cchMaxBuffer, lscp_param_t *pParams);
182    
183 capela 946 //-------------------------------------------------------------------------
184     // MIDI instrument info struct helper functions.
185 capela 163
186 capela 946 void lscp_midi_instrument_info_init (lscp_midi_instrument_info_t *pInstrInfo);
187     void lscp_midi_instrument_info_free (lscp_midi_instrument_info_t *pInstrInfo);
188     void lscp_midi_instrument_info_reset (lscp_midi_instrument_info_t *pInstrInfo);
189    
190    
191 capela 103 #endif // __LSCP_COMMON_H
192    
193     // end of common.h

  ViewVC Help
Powered by ViewVC