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