1 |
capela |
103 |
// device.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_DEVICE_H |
24 |
|
|
#define __LSCP_DEVICE_H |
25 |
|
|
|
26 |
|
|
#include "lscp/client.h" |
27 |
|
|
|
28 |
|
|
#if defined(__cplusplus) |
29 |
|
|
extern "C" { |
30 |
|
|
#endif |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
//------------------------------------------------------------------------- |
34 |
|
|
// Device driver information structures. |
35 |
|
|
|
36 |
|
|
/** Parameter value type. */ |
37 |
|
|
typedef enum _lscp_type_t |
38 |
|
|
{ |
39 |
|
|
LSCP_TYPE_BOOL = 0, |
40 |
|
|
LSCP_TYPE_INT, |
41 |
|
|
LSCP_TYPE_FLOAT, |
42 |
|
|
LSCP_TYPE_STRING |
43 |
|
|
|
44 |
|
|
} lscp_type_t; |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
/** Parameter value union type. */ |
48 |
|
|
typedef union _lscp_value_t |
49 |
|
|
{ |
50 |
|
|
int i; |
51 |
|
|
float f; |
52 |
|
|
char *psz; |
53 |
|
|
|
54 |
|
|
} lscp_value_t; |
55 |
|
|
|
56 |
|
|
|
57 |
|
|
/** Common and simple key/value pair parameter tuple. */ |
58 |
|
|
typedef struct _lscp_param_t |
59 |
|
|
{ |
60 |
|
|
char * key; |
61 |
|
|
lscp_value_t value; |
62 |
|
|
|
63 |
|
|
} lscp_param_t; |
64 |
|
|
|
65 |
|
|
|
66 |
|
|
/** Common parameter info cache struct. */ |
67 |
|
|
typedef struct _lscp_param_info_t |
68 |
|
|
{ |
69 |
|
|
lscp_type_t type; |
70 |
|
|
char * description; |
71 |
|
|
int mandatory; |
72 |
|
|
int fix; |
73 |
|
|
int multiplicity; |
74 |
|
|
char ** depends; |
75 |
|
|
lscp_value_t defaultv; |
76 |
|
|
lscp_value_t range_min; |
77 |
|
|
lscp_value_t range_max; |
78 |
|
|
char ** possibilities; |
79 |
|
|
|
80 |
|
|
} lscp_param_info_t; |
81 |
|
|
|
82 |
|
|
|
83 |
|
|
/** Common driver type info cache struct. */ |
84 |
|
|
typedef struct _lscp_driver_info_t |
85 |
|
|
{ |
86 |
|
|
char * description; |
87 |
|
|
char * version; |
88 |
|
|
char ** parameters; |
89 |
|
|
|
90 |
|
|
} lscp_driver_info_t; |
91 |
|
|
|
92 |
|
|
|
93 |
|
|
/** Common device info cache struct. */ |
94 |
|
|
typedef struct _lscp_device_info_t |
95 |
|
|
{ |
96 |
|
|
char * driver; |
97 |
|
|
lscp_param_t *parameters; |
98 |
|
|
|
99 |
|
|
} lscp_device_info_t; |
100 |
|
|
|
101 |
|
|
|
102 |
|
|
/** Common device channel info cache struct. */ |
103 |
|
|
typedef struct _lscp_device_channel_info_t |
104 |
|
|
{ |
105 |
|
|
char * name; |
106 |
|
|
lscp_param_t *parameters; |
107 |
|
|
|
108 |
|
|
} lscp_device_channel_info_t; |
109 |
|
|
|
110 |
|
|
|
111 |
|
|
//------------------------------------------------------------------------- |
112 |
|
|
// Audio driver control functions. |
113 |
|
|
|
114 |
|
|
const char ** lscp_get_available_audio_drivers(lscp_client_t *pClient); |
115 |
|
|
|
116 |
|
|
lscp_driver_info_t * lscp_get_audio_driver_info (lscp_client_t *pClient, const char *pszAudioDriver); |
117 |
|
|
lscp_param_info_t * lscp_get_audio_driver_param_info(lscp_client_t *pClient, const char *pszAudioDriver, const char *pszParam, lscp_param_t *pDepList); |
118 |
|
|
|
119 |
|
|
//------------------------------------------------------------------------- |
120 |
|
|
// Audio device control functions. |
121 |
|
|
|
122 |
|
|
int lscp_create_audio_device (lscp_client_t *pClient, const char *pszAudioDriver, lscp_param_t *pParams); |
123 |
|
|
lscp_status_t lscp_destroy_audio_device (lscp_client_t *pClient, int iAudioDevice); |
124 |
|
|
|
125 |
capela |
125 |
int lscp_get_audio_devices (lscp_client_t *pClient); |
126 |
|
|
int * lscp_list_audio_devices (lscp_client_t *pClient); |
127 |
capela |
103 |
lscp_device_info_t * lscp_get_audio_device_info (lscp_client_t *pClient, int iAudioDevice); |
128 |
|
|
lscp_status_t lscp_set_audio_device_param (lscp_client_t *pClient, int iAudioDevice, lscp_param_t *pParam); |
129 |
|
|
|
130 |
|
|
lscp_device_channel_info_t *lscp_get_audio_channel_info (lscp_client_t *pClient, int iAudioDevice, int iAudioChannel ); |
131 |
|
|
|
132 |
|
|
lscp_param_info_t * lscp_get_audio_channel_param_info (lscp_client_t *pClient, int iAudioDevice, int iAudioChannel, const char *pszParam); |
133 |
|
|
lscp_status_t lscp_set_audio_channel_param (lscp_client_t *pClient, int iAudioDevice, int iAudioChannel, lscp_param_t *pParam); |
134 |
|
|
|
135 |
|
|
|
136 |
|
|
//------------------------------------------------------------------------- |
137 |
|
|
// MIDI driver control functions. |
138 |
|
|
|
139 |
|
|
const char ** lscp_get_available_midi_drivers (lscp_client_t *pClient); |
140 |
|
|
|
141 |
|
|
lscp_driver_info_t * lscp_get_midi_driver_info (lscp_client_t *pClient, const char *pszMidiDriver); |
142 |
|
|
lscp_param_info_t * lscp_get_midi_driver_param_info (lscp_client_t *pClient, const char *pszMidiDriver, const char *pszParam, lscp_param_t *pDepList); |
143 |
|
|
|
144 |
|
|
//------------------------------------------------------------------------- |
145 |
|
|
// MIDI device control functions. |
146 |
|
|
|
147 |
|
|
int lscp_create_midi_device (lscp_client_t *pClient, const char *pszMidiDriver, lscp_param_t *pParams); |
148 |
|
|
lscp_status_t lscp_destroy_midi_device (lscp_client_t *pClient, int iMidiDevice); |
149 |
|
|
|
150 |
capela |
125 |
int lscp_get_midi_devices (lscp_client_t *pClient); |
151 |
|
|
int * lscp_list_midi_devices (lscp_client_t *pClient); |
152 |
capela |
103 |
lscp_device_info_t * lscp_get_midi_device_info (lscp_client_t *pClient, int iMidiDevice); |
153 |
|
|
lscp_status_t lscp_set_midi_device_param (lscp_client_t *pClient, int iMidiDevice, lscp_param_t *pParam); |
154 |
|
|
|
155 |
|
|
lscp_device_channel_info_t *lscp_get_midi_port_info (lscp_client_t *pClient, int iMidiDevice, int iMidiPort); |
156 |
|
|
|
157 |
|
|
lscp_param_info_t * lscp_get_midi_port_param_info (lscp_client_t *pClient, int iMidiDevice, int iMidiPort, const char *pszParam); |
158 |
|
|
lscp_status_t lscp_set_midi_port_param (lscp_client_t *pClient, int iMidiDevice, int iMidiPort, lscp_param_t *pParam); |
159 |
|
|
|
160 |
|
|
|
161 |
|
|
#if defined(__cplusplus) |
162 |
|
|
} |
163 |
|
|
#endif |
164 |
|
|
|
165 |
|
|
#endif // __LSCP_DEVICE_H |
166 |
|
|
|
167 |
|
|
// end of device.h |