liblscp  0.5.6
client.h
Go to the documentation of this file.
1 // client.h
2 //
3 /****************************************************************************
4  liblscp - LinuxSampler Control Protocol API
5  Copyright (C) 2004-2008, 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 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 
21 *****************************************************************************/
22 
23 #ifndef __LSCP_CLIENT_H
24 #define __LSCP_CLIENT_H
25 
26 #include "lscp/socket.h"
27 #include "lscp/event.h"
28 
29 #if defined(__cplusplus)
30 extern "C" {
31 #endif
32 
33 //-------------------------------------------------------------------------
34 // MIDI channel omni mode.
35 
36 #define LSCP_MIDI_CHANNEL_ALL 16
37 
38 
39 //-------------------------------------------------------------------------
40 // Client data structures.
41 
43 typedef struct _lscp_server_info_t
44 {
45  char * description;
46  char * version;
48 
50 
51 
53 typedef struct _lscp_engine_info_t
54 {
55  char * description;
56  char * version;
57 
59 
60 
62 typedef struct _lscp_channel_info_t
63 {
64  char * engine_name;
73  int midi_port;
75  int midi_map;
76  float volume;
77  int mute;
78  int solo;
79 
81 
82 
84 typedef struct _lscp_buffer_fill_t
85 {
86  unsigned int stream_id;
87  unsigned long stream_usage;
88 
90 
91 
93 typedef enum _lscp_usage_t
94 {
97 
98 } lscp_usage_t;
99 
100 
102 typedef struct _lscp_fxsend_info_t
103 {
104  char * name;
107  float level;
108 
110 
111 
114 {
115  int map;
116  int bank;
117  int prog;
118 
120 
121 
123 typedef enum _lscp_load_mode_t
124 {
129 
131 
132 
135 {
136  char * name;
137  char * engine_name;
142  float volume;
143 
145 
146 
149 {
153 
155 
156 
157 //-------------------------------------------------------------------------
158 // Client socket main structure.
159 
162 
165 (
166  struct _lscp_client_t *pClient,
167  lscp_event_t event,
168  const char *pchData,
169  int cchData,
170  void *pvData
171 );
172 
173 //-------------------------------------------------------------------------
174 // Client versioning teller function.
175 
176 const char * lscp_client_package (void);
177 const char * lscp_client_version (void);
178 const char * lscp_client_build (void);
179 
180 //-------------------------------------------------------------------------
181 // Client socket functions.
182 
183 lscp_client_t * lscp_client_create (const char *pszHost, int iPort, lscp_client_proc_t pfnCallback, void *pvData);
186 
189 
190 //-------------------------------------------------------------------------
191 // Client common protocol functions.
192 
193 lscp_status_t lscp_client_query (lscp_client_t *pClient, const char *pszQuery);
194 const char * lscp_client_get_result (lscp_client_t *pClient );
195 int lscp_client_get_errno (lscp_client_t *pClient );
196 
197 //-------------------------------------------------------------------------
198 // Client registration protocol functions.
199 
202 
204 
205 //-------------------------------------------------------------------------
206 // Client command protocol functions.
207 
208 lscp_status_t lscp_load_instrument (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
209 lscp_status_t lscp_load_instrument_non_modal (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
210 lscp_status_t lscp_load_engine (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel);
211 int lscp_get_channels (lscp_client_t *pClient);
212 int * lscp_list_channels (lscp_client_t *pClient);
213 int lscp_add_channel (lscp_client_t *pClient);
214 lscp_status_t lscp_remove_channel (lscp_client_t *pClient, int iSamplerChannel);
215 
217 const char ** lscp_list_available_engines (lscp_client_t *pClient);
218 
219 lscp_engine_info_t * lscp_get_engine_info (lscp_client_t *pClient, const char *pszEngineName);
220 lscp_channel_info_t * lscp_get_channel_info (lscp_client_t *pClient, int iSamplerChannel);
221 
222 int lscp_get_channel_voice_count (lscp_client_t *pClient, int iSamplerChannel);
223 int lscp_get_channel_stream_count (lscp_client_t *pClient, int iSamplerChannel);
224 int lscp_get_channel_stream_usage (lscp_client_t *pClient, int iSamplerChannel);
225 
226 lscp_buffer_fill_t * lscp_get_channel_buffer_fill (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel);
227 
228 lscp_status_t lscp_set_channel_audio_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType);
229 lscp_status_t lscp_set_channel_audio_device (lscp_client_t *pClient, int iSamplerChannel, int iAudioDevice);
230 lscp_status_t lscp_set_channel_audio_channel (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn);
231 
232 lscp_status_t lscp_set_channel_midi_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType);
233 lscp_status_t lscp_set_channel_midi_device (lscp_client_t *pClient, int iSamplerChannel, int iMidiDevice);
234 lscp_status_t lscp_set_channel_midi_port (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort);
235 lscp_status_t lscp_set_channel_midi_channel (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel);
236 lscp_status_t lscp_set_channel_midi_map (lscp_client_t *pClient, int iSamplerChannel, int iMidiMap);
237 
238 lscp_status_t lscp_set_channel_volume (lscp_client_t *pClient, int iSamplerChannel, float fVolume);
239 
240 lscp_status_t lscp_set_channel_mute (lscp_client_t *pClient, int iSamplerChannel, int iMute);
241 lscp_status_t lscp_set_channel_solo (lscp_client_t *pClient, int iSamplerChannel, int iSolo);
242 
243 lscp_status_t lscp_reset_channel (lscp_client_t *pClient, int iSamplerChannel);
244 
246 
248 
251 
252 float lscp_get_volume (lscp_client_t *pClient);
253 lscp_status_t lscp_set_volume (lscp_client_t *pClient, float fVolume);
254 
255 int lscp_get_voices (lscp_client_t *pClient);
256 lscp_status_t lscp_set_voices (lscp_client_t *pClient, int iMaxVoices);
257 
258 int lscp_get_streams (lscp_client_t *pClient);
259 lscp_status_t lscp_set_streams (lscp_client_t *pClient, int iMaxStreams);
260 
261 //-------------------------------------------------------------------------
262 // Effect sends control functions.
263 
264 int lscp_create_fxsend (lscp_client_t *pClient, int iSamplerChannel, int iMidiController, const char *pszFxName);
265 lscp_status_t lscp_destroy_fxsend (lscp_client_t *pClient, int iSamplerChannel, int iFxSend);
266 
267 int lscp_get_fxsends (lscp_client_t *pClient, int iSamplerChannel);
268 int * lscp_list_fxsends (lscp_client_t *pClient, int iSamplerChannel);
269 
270 lscp_fxsend_info_t * lscp_get_fxsend_info (lscp_client_t *pClient, int iSamplerChannel, int iFxSend);
271 
272 lscp_status_t lscp_set_fxsend_name (lscp_client_t *pClient, int iSamplerChannel, int iFxSend, const char *pszFxName);
273 lscp_status_t lscp_set_fxsend_audio_channel (lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iAudioSrc, int iAudioDst);
274 lscp_status_t lscp_set_fxsend_midi_controller (lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iMidiController);
275 lscp_status_t lscp_set_fxsend_level (lscp_client_t *pClient, int iSamplerChannel, int iFxSend, float fLevel);
276 
277 //-------------------------------------------------------------------------
278 // MIDI instrument mapping control functions.
279 
280 int lscp_add_midi_instrument_map (lscp_client_t *pClient, const char *pszMapName);
282 
285 
286 const char * lscp_get_midi_instrument_map_name (lscp_client_t *pClient, int iMidiMap);
287 lscp_status_t lscp_set_midi_instrument_map_name (lscp_client_t *pClient, int iMidiMap, const char *pszMapName);
288 
289 lscp_status_t lscp_map_midi_instrument (lscp_client_t *pClient, lscp_midi_instrument_t *pMidiInstr, const char *pszEngineName, const char *pszFileName, int iInstrIndex, float fVolume, lscp_load_mode_t load_mode, const char *pszName);
291 
292 int lscp_get_midi_instruments (lscp_client_t *pClient, int iMidiMap);
294 
296 
298 
299 //-------------------------------------------------------------------------
300 // Instrument editor functions.
301 
302 lscp_status_t lscp_edit_channel_instrument (lscp_client_t *pClient, int iSamplerChannel);
303 
304 #if defined(__cplusplus)
305 }
306 #endif
307 
308 #endif // __LSCP_CLIENT_H
309 
310 // end of client.h