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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 107 - (show annotations) (download) (as text)
Fri Jun 4 21:06:59 2004 UTC (16 years, 6 months ago) by capela
File MIME type: text/x-c++hdr
File size: 6286 byte(s)
Initial alpha release.

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

  ViewVC Help
Powered by ViewVC