/[svn]/liblscp/trunk/lscp/client.h
ViewVC logotype

Contents of /liblscp/trunk/lscp/client.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 975 - (show annotations) (download) (as text)
Sun Dec 17 00:59:40 2006 UTC (17 years, 3 months ago) by capela
File MIME type: text/x-c++hdr
File size: 10486 byte(s)
* MIDI instrument mapping, second round, according to
  LSCP 1.2 draft document as of December 15, 2006.

* New client interface functions:
     lscp_set_channel_midi_map();
     lscp_add_midi_instrument_map();
     lscp_remove_midi_instrument_map();
     lscp_get_midi_instrument_maps();
     lscp_list_midi_instrument_maps();
     lscp_get_midi_instrument_map_name();
     lscp_set_midi_instrument_map_name();

1 // client.h
2 //
3 /****************************************************************************
4 liblscp - LinuxSampler Control Protocol API
5 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
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
42 /** Server info cache struct. */
43 typedef struct _lscp_server_info_t
44 {
45 char * description;
46 char * version;
47
48 } lscp_server_info_t;
49
50
51 /** Engine info cache struct. */
52 typedef struct _lscp_engine_info_t
53 {
54 char * description;
55 char * version;
56
57 } lscp_engine_info_t;
58
59
60 /** Channel info cache struct. */
61 typedef struct _lscp_channel_info_t
62 {
63 char * engine_name;
64 int audio_device;
65 int audio_channels;
66 char ** audio_routing;
67 char * instrument_file;
68 int instrument_nr;
69 char * instrument_name;
70 int instrument_status;
71 int midi_device;
72 int midi_port;
73 int midi_channel;
74 int midi_map;
75 float volume;
76 int mute;
77 int solo;
78
79 } lscp_channel_info_t;
80
81
82 /** Buffer fill cache struct. */
83 typedef struct _lscp_buffer_fill_t
84 {
85 unsigned int stream_id;
86 unsigned long stream_usage;
87
88 } lscp_buffer_fill_t;
89
90
91 /** Buffer fill stream usage types. */
92 typedef enum _lscp_usage_t
93 {
94 LSCP_USAGE_BYTES = 0,
95 LSCP_USAGE_PERCENTAGE
96
97 } lscp_usage_t;
98
99
100 /** MIDI instrument parameter struct. */
101 typedef struct _lscp_midi_instrument_t
102 {
103 int map;
104 int bank;
105 int prog;
106
107 } lscp_midi_instrument_t;
108
109
110 /** MIDI instrument load mode. */
111 typedef enum _lscp_load_mode_t
112 {
113 LSCP_LOAD_DEFAULT = 0,
114 LSCP_LOAD_ON_DEMAND,
115 LSCP_LOAD_ON_DEMAND_HOLD,
116 LSCP_LOAD_PERSISTENT
117
118 } lscp_load_mode_t;
119
120
121 /** MIDI instrument info cache struct. */
122 typedef struct _lscp_midi_instrument_info_t
123 {
124 char * name;
125 char * engine_name;
126 char * instrument_file;
127 int instrument_nr;
128 char * instrument_name;
129 lscp_load_mode_t load_mode;
130 float volume;
131
132 } lscp_midi_instrument_info_t;
133
134
135 /** MIDI instrument map mode. */
136 typedef enum _lscp_midi_map_mode_t
137 {
138 LSCP_MIDI_MAP_NONE = -1,
139 LSCP_MIDI_MAP_DEFAULT = -2,
140 LSCP_MIDI_MAP_ALL = -3
141
142 } lscp_midi_map_mode_t;
143
144
145 //-------------------------------------------------------------------------
146 // Client socket main structure.
147
148 /** Client opaque descriptor struct. */
149 typedef struct _lscp_client_t lscp_client_t;
150
151 /** Client event callback procedure prototype. */
152 typedef lscp_status_t (*lscp_client_proc_t)
153 (
154 struct _lscp_client_t *pClient,
155 lscp_event_t event,
156 const char *pchData,
157 int cchData,
158 void *pvData
159 );
160
161 //-------------------------------------------------------------------------
162 // Client versioning teller fuunction.
163
164 const char * lscp_client_package (void);
165 const char * lscp_client_version (void);
166 const char * lscp_client_build (void);
167
168 //-------------------------------------------------------------------------
169 // Client socket functions.
170
171 lscp_client_t * lscp_client_create (const char *pszHost, int iPort, lscp_client_proc_t pfnCallback, void *pvData);
172 lscp_status_t lscp_client_join (lscp_client_t *pClient);
173 lscp_status_t lscp_client_destroy (lscp_client_t *pClient);
174
175 lscp_status_t lscp_client_set_timeout (lscp_client_t *pClient, int iTimeout);
176 int lscp_client_get_timeout (lscp_client_t *pClient);
177
178 //-------------------------------------------------------------------------
179 // Client common protocol functions.
180
181 lscp_status_t lscp_client_query (lscp_client_t *pClient, const char *pszQuery);
182 const char * lscp_client_get_result (lscp_client_t *pClient );
183 int lscp_client_get_errno (lscp_client_t *pClient );
184
185 //-------------------------------------------------------------------------
186 // Client registration protocol functions.
187
188 lscp_status_t lscp_client_subscribe (lscp_client_t *pClient, lscp_event_t events);
189 lscp_status_t lscp_client_unsubscribe (lscp_client_t *pClient, lscp_event_t events);
190
191 lscp_event_t lscp_client_get_events (lscp_client_t *pClient);
192
193 //-------------------------------------------------------------------------
194 // Client command protocol functions.
195
196 lscp_status_t lscp_load_instrument (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
197 lscp_status_t lscp_load_instrument_non_modal (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
198 lscp_status_t lscp_load_engine (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel);
199 int lscp_get_channels (lscp_client_t *pClient);
200 int * lscp_list_channels (lscp_client_t *pClient);
201 int lscp_add_channel (lscp_client_t *pClient);
202 lscp_status_t lscp_remove_channel (lscp_client_t *pClient, int iSamplerChannel);
203
204 int lscp_get_available_engines (lscp_client_t *pClient);
205 const char ** lscp_list_available_engines (lscp_client_t *pClient);
206
207 lscp_engine_info_t * lscp_get_engine_info (lscp_client_t *pClient, const char *pszEngineName);
208 lscp_channel_info_t * lscp_get_channel_info (lscp_client_t *pClient, int iSamplerChannel);
209
210 int lscp_get_channel_voice_count (lscp_client_t *pClient, int iSamplerChannel);
211 int lscp_get_channel_stream_count (lscp_client_t *pClient, int iSamplerChannel);
212 int lscp_get_channel_stream_usage (lscp_client_t *pClient, int iSamplerChannel);
213
214 lscp_buffer_fill_t * lscp_get_channel_buffer_fill (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel);
215
216 lscp_status_t lscp_set_channel_audio_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType);
217 lscp_status_t lscp_set_channel_audio_device (lscp_client_t *pClient, int iSamplerChannel, int iAudioDevice);
218 lscp_status_t lscp_set_channel_audio_channel (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn);
219
220 lscp_status_t lscp_set_channel_midi_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType);
221 lscp_status_t lscp_set_channel_midi_device (lscp_client_t *pClient, int iSamplerChannel, int iMidiDevice);
222 lscp_status_t lscp_set_channel_midi_port (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort);
223 lscp_status_t lscp_set_channel_midi_channel (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel);
224 lscp_status_t lscp_set_channel_midi_map (lscp_client_t *pClient, int iSamplerChannel, int iMidiMap);
225
226 lscp_status_t lscp_set_channel_volume (lscp_client_t *pClient, int iSamplerChannel, float fVolume);
227
228 lscp_status_t lscp_set_channel_mute (lscp_client_t *pClient, int iSamplerChannel, int iMute);
229 lscp_status_t lscp_set_channel_solo (lscp_client_t *pClient, int iSamplerChannel, int iSolo);
230
231 lscp_status_t lscp_reset_channel (lscp_client_t *pClient, int iSamplerChannel);
232
233 lscp_status_t lscp_reset_sampler (lscp_client_t *pClient);
234
235 lscp_server_info_t * lscp_get_server_info (lscp_client_t *pClient);
236
237 int lscp_get_total_voice_count (lscp_client_t *pClient);
238 int lscp_get_total_voice_count_max (lscp_client_t *pClient);
239
240 //-------------------------------------------------------------------------
241 // MIDI instrument mapping control functions.
242
243 int lscp_add_midi_instrument_map (lscp_client_t *pClient, const char *pszMapName);
244 lscp_status_t lscp_remove_midi_instrument_map (lscp_client_t *pClient, int iMidiMap);
245
246 int lscp_get_midi_instrument_maps (lscp_client_t *pClient);
247 int * lscp_list_midi_instrument_maps (lscp_client_t *pClient);
248
249 const char * lscp_get_midi_instrument_map_name (lscp_client_t *pClient, int iMidiMap);
250 lscp_status_t lscp_set_midi_instrument_map_name (lscp_client_t *pClient, int iMidiMap, const char *pszMapName);
251
252 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);
253 lscp_status_t lscp_unmap_midi_instrument (lscp_client_t *pClient, lscp_midi_instrument_t *pMidiInstr);
254
255 int lscp_get_midi_instruments (lscp_client_t *pClient, int iMidiMap);
256 lscp_midi_instrument_t *lscp_list_midi_instruments (lscp_client_t *pClient, int iMidiMap);
257
258 lscp_midi_instrument_info_t *lscp_get_midi_instrument_info(lscp_client_t *pClient, lscp_midi_instrument_t *pMidiInstr);
259
260 lscp_status_t lscp_clear_midi_instruments (lscp_client_t *pClient, int iMidiMap);
261
262
263 #if defined(__cplusplus)
264 }
265 #endif
266
267 #endif // __LSCP_CLIENT_H
268
269 // end of client.h

  ViewVC Help
Powered by ViewVC