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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 523 - (show annotations) (download) (as text)
Mon May 9 10:17:12 2005 UTC (16 years, 1 month ago) by capela
File MIME type: text/x-c++hdr
File size: 7414 byte(s)
* [bug #9] Fixed for a LSCP command syntax convention
consistency, regarding the enumeration of available
sampler engines, Audio and MIDI drivers; this has
affected the signature of the following functions:
  lscp_get_available_engines();
  lscp_get_available_audio_drivers();
  lscp_get_available_midi_drivers();
which are now returning an integer count of engines
and drivers, respectively, while the following
functions are now being introduced:
  lscp_list_available_engines();
  lscp_list_available_audio_drivers();
  lscp_list_available_midi_drivers();
taking on the previous functionality, returning
a comma separated list of names.

1 // client.h
2 //
3 /****************************************************************************
4 liblscp - LinuxSampler Control Protocol API
5 Copyright (C) 2004-2005, 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_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 /** Engine info cache struct. */
43 typedef struct _lscp_engine_info_t
44 {
45 char * description;
46 char * version;
47
48 } lscp_engine_info_t;
49
50
51 /** Channel info cache struct. */
52 typedef struct _lscp_channel_info_t
53 {
54 char * engine_name;
55 int audio_device;
56 int audio_channels;
57 char ** audio_routing;
58 char * instrument_file;
59 int instrument_nr;
60 char * instrument_name;
61 int instrument_status;
62 int midi_device;
63 int midi_port;
64 int midi_channel;
65 float volume;
66
67 } lscp_channel_info_t;
68
69
70 /** Buffer fill cache struct. */
71 typedef struct _lscp_buffer_fill_t
72 {
73 unsigned int stream_id;
74 unsigned long stream_usage;
75
76 } lscp_buffer_fill_t;
77
78
79 /** Buffer fill stream usage types. */
80 typedef enum _lscp_usage_t
81 {
82 LSCP_USAGE_BYTES = 0,
83 LSCP_USAGE_PERCENTAGE
84
85 } lscp_usage_t;
86
87
88 //-------------------------------------------------------------------------
89 // Client socket main structure.
90
91 /** Client opaque descriptor struct. */
92 typedef struct _lscp_client_t lscp_client_t;
93
94 /** Client event callback procedure prototype. */
95 typedef lscp_status_t (*lscp_client_proc_t)
96 (
97 struct _lscp_client_t *pClient,
98 lscp_event_t event,
99 const char *pchData,
100 int cchData,
101 void *pvData
102 );
103
104 //-------------------------------------------------------------------------
105 // Client versioning teller fuunction.
106
107 const char * lscp_client_package (void);
108 const char * lscp_client_version (void);
109 const char * lscp_client_build (void);
110
111 //-------------------------------------------------------------------------
112 // Client socket functions.
113
114 lscp_client_t * lscp_client_create (const char *pszHost, int iPort, lscp_client_proc_t pfnCallback, void *pvData);
115 lscp_status_t lscp_client_join (lscp_client_t *pClient);
116 lscp_status_t lscp_client_destroy (lscp_client_t *pClient);
117
118 lscp_status_t lscp_client_set_timeout (lscp_client_t *pClient, int iTimeout);
119 int lscp_client_get_timeout (lscp_client_t *pClient);
120
121 //-------------------------------------------------------------------------
122 // Client common protocol functions.
123
124 lscp_status_t lscp_client_query (lscp_client_t *pClient, const char *pszQuery);
125 const char * lscp_client_get_result (lscp_client_t *pClient );
126 int lscp_client_get_errno (lscp_client_t *pClient );
127
128 //-------------------------------------------------------------------------
129 // Client registration protocol functions.
130
131 lscp_status_t lscp_client_subscribe (lscp_client_t *pClient, lscp_event_t events);
132 lscp_status_t lscp_client_unsubscribe (lscp_client_t *pClient, lscp_event_t events);
133
134 lscp_event_t lscp_client_get_events (lscp_client_t *pClient);
135
136 //-------------------------------------------------------------------------
137 // Client command protocol functions.
138
139 lscp_status_t lscp_load_instrument (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
140 lscp_status_t lscp_load_instrument_non_modal (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
141 lscp_status_t lscp_load_engine (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel);
142 int lscp_get_channels (lscp_client_t *pClient);
143 int * lscp_list_channels (lscp_client_t *pClient);
144 int lscp_add_channel (lscp_client_t *pClient);
145 lscp_status_t lscp_remove_channel (lscp_client_t *pClient, int iSamplerChannel);
146
147 int lscp_get_available_engines (lscp_client_t *pClient);
148 const char ** lscp_list_available_engines (lscp_client_t *pClient);
149
150 lscp_engine_info_t * lscp_get_engine_info (lscp_client_t *pClient, const char *pszEngineName);
151 lscp_channel_info_t * lscp_get_channel_info (lscp_client_t *pClient, int iSamplerChannel);
152
153 int lscp_get_channel_voice_count (lscp_client_t *pClient, int iSamplerChannel);
154 int lscp_get_channel_stream_count (lscp_client_t *pClient, int iSamplerChannel);
155 int lscp_get_channel_stream_usage (lscp_client_t *pClient, int iSamplerChannel);
156
157 lscp_buffer_fill_t * lscp_get_channel_buffer_fill (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel);
158
159 lscp_status_t lscp_set_channel_audio_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType);
160 lscp_status_t lscp_set_channel_audio_device (lscp_client_t *pClient, int iSamplerChannel, int iAudioDevice);
161 lscp_status_t lscp_set_channel_audio_channel (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn);
162
163 lscp_status_t lscp_set_channel_midi_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType);
164 lscp_status_t lscp_set_channel_midi_device (lscp_client_t *pClient, int iSamplerChannel, int iMidiDevice);
165 lscp_status_t lscp_set_channel_midi_port (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort);
166 lscp_status_t lscp_set_channel_midi_channel (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel);
167 lscp_status_t lscp_set_channel_volume (lscp_client_t *pClient, int iSamplerChannel, float fVolume);
168
169 lscp_status_t lscp_reset_channel (lscp_client_t *pClient, int iSamplerChannel);
170
171 lscp_status_t lscp_reset_sampler (lscp_client_t *pClient);
172
173 #if defined(__cplusplus)
174 }
175 #endif
176
177 #endif // __LSCP_CLIENT_H
178
179 // end of client.h

  ViewVC Help
Powered by ViewVC