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 instrument_status; |
55 |
int midi_device; |
56 |
int midi_port; |
57 |
int midi_channel; |
58 |
float volume; |
59 |
|
60 |
} lscp_channel_info_t; |
61 |
|
62 |
|
63 |
/** Buffer fill cache struct. */ |
64 |
typedef struct _lscp_buffer_fill_t |
65 |
{ |
66 |
unsigned int stream_id; |
67 |
unsigned long stream_usage; |
68 |
|
69 |
} lscp_buffer_fill_t; |
70 |
|
71 |
|
72 |
/** Buffer fill stream usage types. */ |
73 |
typedef enum _lscp_usage_t |
74 |
{ |
75 |
LSCP_USAGE_BYTES = 0, |
76 |
LSCP_USAGE_PERCENTAGE |
77 |
|
78 |
} lscp_usage_t; |
79 |
|
80 |
|
81 |
//------------------------------------------------------------------------- |
82 |
// Client socket main structure. |
83 |
|
84 |
/** Client opaque descriptor struct. */ |
85 |
typedef struct _lscp_client_t lscp_client_t; |
86 |
|
87 |
/** Client callback procedure prototype. */ |
88 |
typedef lscp_status_t (*lscp_client_proc_t) |
89 |
( |
90 |
struct _lscp_client_t *pClient, |
91 |
const char *pchBuffer, |
92 |
int cchBuffer, |
93 |
void *pvData |
94 |
); |
95 |
|
96 |
//------------------------------------------------------------------------- |
97 |
// Client versioning teller fuunction. |
98 |
|
99 |
const char * lscp_client_package (void); |
100 |
const char * lscp_client_version (void); |
101 |
const char * lscp_client_build (void); |
102 |
|
103 |
//------------------------------------------------------------------------- |
104 |
// Client socket functions. |
105 |
|
106 |
lscp_client_t * lscp_client_create (const char *pszHost, int iPort, lscp_client_proc_t pfnCallback, void *pvData); |
107 |
lscp_status_t lscp_client_join (lscp_client_t *pClient); |
108 |
lscp_status_t lscp_client_destroy (lscp_client_t *pClient); |
109 |
|
110 |
lscp_status_t lscp_client_set_timeout (lscp_client_t *pClient, int iTimeout); |
111 |
int lscp_client_get_timeout (lscp_client_t *pClient); |
112 |
|
113 |
//------------------------------------------------------------------------- |
114 |
// Client common protocol functions. |
115 |
|
116 |
lscp_status_t lscp_client_query (lscp_client_t *pClient, const char *pszQuery); |
117 |
const char * lscp_client_get_result (lscp_client_t *pClient ); |
118 |
int lscp_client_get_errno (lscp_client_t *pClient ); |
119 |
|
120 |
//------------------------------------------------------------------------- |
121 |
// Client registration protocol functions. |
122 |
|
123 |
lscp_status_t lscp_client_subscribe (lscp_client_t *pClient); |
124 |
lscp_status_t lscp_client_unsubscribe (lscp_client_t *pClient); |
125 |
|
126 |
//------------------------------------------------------------------------- |
127 |
// Client command protocol functions. |
128 |
|
129 |
lscp_status_t lscp_load_instrument (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel); |
130 |
lscp_status_t lscp_load_engine (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel); |
131 |
int lscp_get_channels (lscp_client_t *pClient); |
132 |
int * lscp_list_channels (lscp_client_t *pClient); |
133 |
int lscp_add_channel (lscp_client_t *pClient); |
134 |
lscp_status_t lscp_remove_channel (lscp_client_t *pClient, int iSamplerChannel); |
135 |
const char ** lscp_get_available_engines (lscp_client_t *pClient); |
136 |
|
137 |
lscp_engine_info_t * lscp_get_engine_info (lscp_client_t *pClient, const char *pszEngineName); |
138 |
lscp_channel_info_t * lscp_get_channel_info (lscp_client_t *pClient, int iSamplerChannel); |
139 |
|
140 |
int lscp_get_channel_voice_count (lscp_client_t *pClient, int iSamplerChannel); |
141 |
int lscp_get_channel_stream_count (lscp_client_t *pClient, int iSamplerChannel); |
142 |
|
143 |
lscp_buffer_fill_t * lscp_get_channel_buffer_fill (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel); |
144 |
|
145 |
lscp_status_t lscp_set_channel_audio_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType); |
146 |
lscp_status_t lscp_set_channel_audio_channel (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn); |
147 |
|
148 |
lscp_status_t lscp_set_channel_midi_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType); |
149 |
lscp_status_t lscp_set_channel_midi_port (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort); |
150 |
lscp_status_t lscp_set_channel_midi_channel (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel); |
151 |
lscp_status_t lscp_set_channel_volume (lscp_client_t *pClient, int iSamplerChannel, float fVolume); |
152 |
|
153 |
lscp_status_t lscp_reset_channel (lscp_client_t *pClient, int iSamplerChannel); |
154 |
|
155 |
|
156 |
#if defined(__cplusplus) |
157 |
} |
158 |
#endif |
159 |
|
160 |
#endif // __LSCP_CLIENT_H |
161 |
|
162 |
// end of client.h |