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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 564 - (hide annotations) (download) (as text)
Sun May 22 22:02:00 2005 UTC (18 years, 10 months ago) by capela
File MIME type: text/x-c++hdr
File size: 7650 byte(s)
* Added support for the newest LSCP command: GET SERVER INFO.

1 capela 107 // client.h
2     //
3     /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API
5 capela 378 Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
6 capela 107
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 capela 146 #include "lscp/event.h"
28 capela 107
29     #if defined(__cplusplus)
30     extern "C" {
31     #endif
32    
33 capela 253 //-------------------------------------------------------------------------
34     // MIDI channel omni mode.
35 capela 107
36 capela 278 #define LSCP_MIDI_CHANNEL_ALL 16
37 capela 253
38    
39 capela 107 //-------------------------------------------------------------------------
40     // Client data structures.
41    
42 capela 564 /** 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 capela 107 /** 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 capela 378 char * instrument_name;
70 capela 132 int instrument_status;
71 capela 107 int midi_device;
72     int midi_port;
73     int midi_channel;
74     float volume;
75    
76     } lscp_channel_info_t;
77    
78    
79     /** Buffer fill cache struct. */
80     typedef struct _lscp_buffer_fill_t
81     {
82     unsigned int stream_id;
83     unsigned long stream_usage;
84    
85     } lscp_buffer_fill_t;
86    
87    
88     /** Buffer fill stream usage types. */
89     typedef enum _lscp_usage_t
90     {
91     LSCP_USAGE_BYTES = 0,
92     LSCP_USAGE_PERCENTAGE
93    
94     } lscp_usage_t;
95    
96    
97     //-------------------------------------------------------------------------
98     // Client socket main structure.
99    
100     /** Client opaque descriptor struct. */
101     typedef struct _lscp_client_t lscp_client_t;
102    
103 capela 144 /** Client event callback procedure prototype. */
104 capela 107 typedef lscp_status_t (*lscp_client_proc_t)
105     (
106     struct _lscp_client_t *pClient,
107 capela 144 lscp_event_t event,
108 capela 146 const char *pchData,
109     int cchData,
110 capela 107 void *pvData
111     );
112    
113     //-------------------------------------------------------------------------
114     // Client versioning teller fuunction.
115    
116     const char * lscp_client_package (void);
117     const char * lscp_client_version (void);
118     const char * lscp_client_build (void);
119    
120     //-------------------------------------------------------------------------
121     // Client socket functions.
122    
123     lscp_client_t * lscp_client_create (const char *pszHost, int iPort, lscp_client_proc_t pfnCallback, void *pvData);
124     lscp_status_t lscp_client_join (lscp_client_t *pClient);
125     lscp_status_t lscp_client_destroy (lscp_client_t *pClient);
126    
127     lscp_status_t lscp_client_set_timeout (lscp_client_t *pClient, int iTimeout);
128     int lscp_client_get_timeout (lscp_client_t *pClient);
129    
130     //-------------------------------------------------------------------------
131     // Client common protocol functions.
132    
133     lscp_status_t lscp_client_query (lscp_client_t *pClient, const char *pszQuery);
134     const char * lscp_client_get_result (lscp_client_t *pClient );
135     int lscp_client_get_errno (lscp_client_t *pClient );
136    
137     //-------------------------------------------------------------------------
138     // Client registration protocol functions.
139    
140 capela 144 lscp_status_t lscp_client_subscribe (lscp_client_t *pClient, lscp_event_t events);
141     lscp_status_t lscp_client_unsubscribe (lscp_client_t *pClient, lscp_event_t events);
142 capela 107
143 capela 213 lscp_event_t lscp_client_get_events (lscp_client_t *pClient);
144 capela 144
145 capela 107 //-------------------------------------------------------------------------
146     // Client command protocol functions.
147    
148     lscp_status_t lscp_load_instrument (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
149 capela 144 lscp_status_t lscp_load_instrument_non_modal (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
150 capela 107 lscp_status_t lscp_load_engine (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel);
151     int lscp_get_channels (lscp_client_t *pClient);
152 capela 125 int * lscp_list_channels (lscp_client_t *pClient);
153 capela 107 int lscp_add_channel (lscp_client_t *pClient);
154     lscp_status_t lscp_remove_channel (lscp_client_t *pClient, int iSamplerChannel);
155    
156 capela 523 int lscp_get_available_engines (lscp_client_t *pClient);
157     const char ** lscp_list_available_engines (lscp_client_t *pClient);
158    
159 capela 107 lscp_engine_info_t * lscp_get_engine_info (lscp_client_t *pClient, const char *pszEngineName);
160     lscp_channel_info_t * lscp_get_channel_info (lscp_client_t *pClient, int iSamplerChannel);
161    
162     int lscp_get_channel_voice_count (lscp_client_t *pClient, int iSamplerChannel);
163     int lscp_get_channel_stream_count (lscp_client_t *pClient, int iSamplerChannel);
164 capela 167 int lscp_get_channel_stream_usage (lscp_client_t *pClient, int iSamplerChannel);
165 capela 107
166     lscp_buffer_fill_t * lscp_get_channel_buffer_fill (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel);
167    
168     lscp_status_t lscp_set_channel_audio_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType);
169 capela 144 lscp_status_t lscp_set_channel_audio_device (lscp_client_t *pClient, int iSamplerChannel, int iAudioDevice);
170 capela 107 lscp_status_t lscp_set_channel_audio_channel (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn);
171    
172     lscp_status_t lscp_set_channel_midi_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType);
173 capela 144 lscp_status_t lscp_set_channel_midi_device (lscp_client_t *pClient, int iSamplerChannel, int iMidiDevice);
174 capela 107 lscp_status_t lscp_set_channel_midi_port (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort);
175     lscp_status_t lscp_set_channel_midi_channel (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel);
176     lscp_status_t lscp_set_channel_volume (lscp_client_t *pClient, int iSamplerChannel, float fVolume);
177    
178     lscp_status_t lscp_reset_channel (lscp_client_t *pClient, int iSamplerChannel);
179    
180 capela 213 lscp_status_t lscp_reset_sampler (lscp_client_t *pClient);
181 capela 107
182 capela 564 lscp_server_info_t * lscp_get_server_info (lscp_client_t *pClient);
183    
184 capela 107 #if defined(__cplusplus)
185     }
186     #endif
187    
188     #endif // __LSCP_CLIENT_H
189    
190     // end of client.h

  ViewVC Help
Powered by ViewVC