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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 107 by capela, Fri Jun 4 21:06:59 2004 UTC revision 3664 by schoenebeck, Sun Dec 22 12:53:26 2019 UTC
# Line 2  Line 2 
2  //  //
3  /****************************************************************************  /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API     liblscp - LinuxSampler Control Protocol API
5     Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.
6    
7     This library is free software; you can redistribute it and/or     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Lesser General Public     modify it under the terms of the GNU Lesser General Public
# Line 14  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15     Lesser General Public License for more details.     Lesser General Public License for more details.
16    
17     You should have received a copy of the GNU Lesser General Public     You should have received a copy of the GNU General Public License along
18     License along with this library; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation, Inc.,
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20    
21  *****************************************************************************/  *****************************************************************************/
22    
# Line 24  Line 24 
24  #define __LSCP_CLIENT_H  #define __LSCP_CLIENT_H
25    
26  #include "lscp/socket.h"  #include "lscp/socket.h"
27    #include "lscp/event.h"
28    #include <stdbool.h>
29    
30  #if defined(__cplusplus)  #if defined(__cplusplus)
31  extern "C" {  extern "C" {
32  #endif  #endif
33    
34    //-------------------------------------------------------------------------
35    // MIDI channel omni mode.
36    
37    #define LSCP_MIDI_CHANNEL_ALL   16
38    
39    
40  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
41  // Client data structures.  // Client data structures.
42    
43    /** Server info cache struct. */
44    typedef struct _lscp_server_info_t
45    {
46            char *        description;
47            char *        version;
48            char *        protocol_version;
49    
50    } lscp_server_info_t;
51    
52    
53  /** Engine info cache struct. */  /** Engine info cache struct. */
54  typedef struct _lscp_engine_info_t  typedef struct _lscp_engine_info_t
55  {  {
56      char *        description;          char *        description;
57      char *        version;          char *        version;
58    
59  } lscp_engine_info_t;  } lscp_engine_info_t;
60    
# Line 45  typedef struct _lscp_engine_info_t Line 62  typedef struct _lscp_engine_info_t
62  /** Channel info cache struct. */  /** Channel info cache struct. */
63  typedef struct _lscp_channel_info_t  typedef struct _lscp_channel_info_t
64  {  {
65      char *        engine_name;          char *        engine_name;
66      int           audio_device;          int           audio_device;
67      int           audio_channels;          int           audio_channels;
68      char **       audio_routing;          int  *        audio_routing;
69      char *        instrument_file;          char *        instrument_file;
70      int           instrument_nr;          int           instrument_nr;
71      int           midi_device;          char *        instrument_name;
72      int           midi_port;          int           instrument_status;
73      int           midi_channel;          int           midi_device;
74      float         volume;          int           midi_port;
75            int           midi_channel;
76            int           midi_map;
77            float         volume;
78            int           mute;
79            int           solo;
80    
81  } lscp_channel_info_t;  } lscp_channel_info_t;
82    
# Line 62  typedef struct _lscp_channel_info_t Line 84  typedef struct _lscp_channel_info_t
84  /** Buffer fill cache struct. */  /** Buffer fill cache struct. */
85  typedef struct _lscp_buffer_fill_t  typedef struct _lscp_buffer_fill_t
86  {  {
87      unsigned int  stream_id;          unsigned int  stream_id;
88      unsigned long stream_usage;          unsigned long stream_usage;
89    
90  } lscp_buffer_fill_t;  } lscp_buffer_fill_t;
91    
# Line 71  typedef struct _lscp_buffer_fill_t Line 93  typedef struct _lscp_buffer_fill_t
93  /** Buffer fill stream usage types. */  /** Buffer fill stream usage types. */
94  typedef enum _lscp_usage_t  typedef enum _lscp_usage_t
95  {  {
96      LSCP_USAGE_BYTES = 0,          LSCP_USAGE_BYTES = 0,
97      LSCP_USAGE_PERCENTAGE          LSCP_USAGE_PERCENTAGE
98    
99  } lscp_usage_t;  } lscp_usage_t;
100    
101    
102    /** Effect send info cache struct. */
103    typedef struct _lscp_fxsend_info_t
104    {
105            char *        name;
106            int           midi_controller;
107            int *         audio_routing;
108            float         level;
109    
110    } lscp_fxsend_info_t;
111    
112    
113    /** MIDI instrument parameter struct. */
114    typedef struct _lscp_midi_instrument_t
115    {
116            int           map;
117            int           bank;
118            int           prog;
119    
120    } lscp_midi_instrument_t;
121    
122    
123    /** MIDI instrument load mode. */
124    typedef enum _lscp_load_mode_t
125    {
126            LSCP_LOAD_DEFAULT = 0,
127            LSCP_LOAD_ON_DEMAND,
128            LSCP_LOAD_ON_DEMAND_HOLD,
129            LSCP_LOAD_PERSISTENT
130    
131    } lscp_load_mode_t;
132    
133    
134    /** MIDI instrument info cache struct. */
135    typedef struct _lscp_midi_instrument_info_t
136    {
137            char *           name;
138            char *           engine_name;
139            char *           instrument_file;
140            int              instrument_nr;
141            char *           instrument_name;
142            lscp_load_mode_t load_mode;
143            float            volume;
144    
145    } lscp_midi_instrument_info_t;
146    
147    
148    /** MIDI instrument map mode. */
149    typedef enum _lscp_midi_map_mode_t
150    {
151            LSCP_MIDI_MAP_NONE = -1,
152            LSCP_MIDI_MAP_DEFAULT = -2,
153            LSCP_MIDI_MAP_ALL = -3
154    
155    } lscp_midi_map_mode_t;
156    
157    
158  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
159  // Client socket main structure.  // Client socket main structure.
160    
161  /** Client opaque descriptor struct. */  /** Client opaque descriptor struct. */
162  typedef struct _lscp_client_t lscp_client_t;  typedef struct _lscp_client_t lscp_client_t;
163    
164  /** Client callback procedure prototype. */  /** Client event callback procedure prototype. */
165  typedef lscp_status_t (*lscp_client_proc_t)  typedef lscp_status_t (*lscp_client_proc_t)
166  (  (
167      struct _lscp_client_t *pClient,          struct _lscp_client_t *pClient,
168      const char *pchBuffer,          lscp_event_t event,
169      int cchBuffer,          const char *pchData,
170      void *pvData          int cchData,
171            void *pvData
172  );  );
173    
174  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
175  // Client versioning teller fuunction.  // Client versioning teller function.
176    
177  const char *            lscp_client_package             (void);  const char *            lscp_client_package             (void);
178  const char *            lscp_client_version             (void);  const char *            lscp_client_version             (void);
# Line 108  lscp_status_t           lscp_client_dest Line 187  lscp_status_t           lscp_client_dest
187    
188  lscp_status_t           lscp_client_set_timeout         (lscp_client_t *pClient, int iTimeout);  lscp_status_t           lscp_client_set_timeout         (lscp_client_t *pClient, int iTimeout);
189  int                     lscp_client_get_timeout         (lscp_client_t *pClient);  int                     lscp_client_get_timeout         (lscp_client_t *pClient);
190    bool                    lscp_client_connection_lost     (lscp_client_t *pClient);
191    
192  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
193  // Client common protocol functions.  // Client common protocol functions.
# Line 119  int                     lscp_client_get_ Line 199  int                     lscp_client_get_
199  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
200  // Client registration protocol functions.  // Client registration protocol functions.
201    
202  lscp_status_t           lscp_client_subscribe           (lscp_client_t *pClient);  lscp_status_t           lscp_client_subscribe           (lscp_client_t *pClient, lscp_event_t events);
203  lscp_status_t           lscp_client_unsubscribe         (lscp_client_t *pClient);  lscp_status_t           lscp_client_unsubscribe         (lscp_client_t *pClient, lscp_event_t events);
204    
205    lscp_event_t            lscp_client_get_events          (lscp_client_t *pClient);
206    
207  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
208  // Client command protocol functions.  // Client command protocol functions.
209    
210  lscp_status_t           lscp_load_instrument            (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);  lscp_status_t           lscp_load_instrument            (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
211    lscp_status_t           lscp_load_instrument_non_modal  (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
212  lscp_status_t           lscp_load_engine                (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel);  lscp_status_t           lscp_load_engine                (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel);
213  int                     lscp_get_channels               (lscp_client_t *pClient);  int                     lscp_get_channels               (lscp_client_t *pClient);
214    int *                   lscp_list_channels              (lscp_client_t *pClient);
215  int                     lscp_add_channel                (lscp_client_t *pClient);  int                     lscp_add_channel                (lscp_client_t *pClient);
216  lscp_status_t           lscp_remove_channel             (lscp_client_t *pClient, int iSamplerChannel);  lscp_status_t           lscp_remove_channel             (lscp_client_t *pClient, int iSamplerChannel);
217  const char **           lscp_get_available_engines      (lscp_client_t *pClient);  
218    int                     lscp_get_available_engines      (lscp_client_t *pClient);
219    const char **           lscp_list_available_engines     (lscp_client_t *pClient);
220    
221  lscp_engine_info_t *    lscp_get_engine_info            (lscp_client_t *pClient, const char *pszEngineName);  lscp_engine_info_t *    lscp_get_engine_info            (lscp_client_t *pClient, const char *pszEngineName);
222  lscp_channel_info_t *   lscp_get_channel_info           (lscp_client_t *pClient, int iSamplerChannel);  lscp_channel_info_t *   lscp_get_channel_info           (lscp_client_t *pClient, int iSamplerChannel);
223    
224  int                     lscp_get_channel_voice_count    (lscp_client_t *pClient, int iSamplerChannel);  int                     lscp_get_channel_voice_count    (lscp_client_t *pClient, int iSamplerChannel);
225  int                     lscp_get_channel_stream_count   (lscp_client_t *pClient, int iSamplerChannel);  int                     lscp_get_channel_stream_count   (lscp_client_t *pClient, int iSamplerChannel);
226    int                     lscp_get_channel_stream_usage   (lscp_client_t *pClient, int iSamplerChannel);
227    
228  lscp_buffer_fill_t *    lscp_get_channel_buffer_fill    (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel);  lscp_buffer_fill_t *    lscp_get_channel_buffer_fill    (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel);
229    
230  lscp_status_t           lscp_set_channel_audio_type     (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType);  lscp_status_t           lscp_set_channel_audio_type     (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType);
231    lscp_status_t           lscp_set_channel_audio_device   (lscp_client_t *pClient, int iSamplerChannel, int iAudioDevice);
232  lscp_status_t           lscp_set_channel_audio_channel  (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn);  lscp_status_t           lscp_set_channel_audio_channel  (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn);
233    
234  lscp_status_t           lscp_set_channel_midi_type      (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType);  lscp_status_t           lscp_set_channel_midi_type      (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType);
235    lscp_status_t           lscp_set_channel_midi_device    (lscp_client_t *pClient, int iSamplerChannel, int iMidiDevice);
236  lscp_status_t           lscp_set_channel_midi_port      (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort);  lscp_status_t           lscp_set_channel_midi_port      (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort);
237  lscp_status_t           lscp_set_channel_midi_channel   (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel);  lscp_status_t           lscp_set_channel_midi_channel   (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel);
238    lscp_status_t           lscp_set_channel_midi_map       (lscp_client_t *pClient, int iSamplerChannel, int iMidiMap);
239    
240  lscp_status_t           lscp_set_channel_volume         (lscp_client_t *pClient, int iSamplerChannel, float fVolume);  lscp_status_t           lscp_set_channel_volume         (lscp_client_t *pClient, int iSamplerChannel, float fVolume);
241    
242    lscp_status_t           lscp_set_channel_mute           (lscp_client_t *pClient, int iSamplerChannel, int iMute);
243    lscp_status_t           lscp_set_channel_solo           (lscp_client_t *pClient, int iSamplerChannel, int iSolo);
244    
245  lscp_status_t           lscp_reset_channel              (lscp_client_t *pClient, int iSamplerChannel);  lscp_status_t           lscp_reset_channel              (lscp_client_t *pClient, int iSamplerChannel);
246    
247    lscp_status_t           lscp_reset_sampler              (lscp_client_t *pClient);
248    
249    lscp_server_info_t *    lscp_get_server_info            (lscp_client_t *pClient);
250    
251    int                     lscp_get_total_voice_count      (lscp_client_t *pClient);
252    int                     lscp_get_total_voice_count_max  (lscp_client_t *pClient);
253    
254    float                   lscp_get_volume                 (lscp_client_t *pClient);
255    lscp_status_t           lscp_set_volume                 (lscp_client_t *pClient, float fVolume);
256    
257    int                     lscp_get_voices                 (lscp_client_t *pClient);
258    lscp_status_t           lscp_set_voices                 (lscp_client_t *pClient, int iMaxVoices);
259    
260    int                     lscp_get_streams                (lscp_client_t *pClient);
261    lscp_status_t           lscp_set_streams                (lscp_client_t *pClient, int iMaxStreams);
262    
263    //-------------------------------------------------------------------------
264    // Effect sends control functions.
265    
266    int                     lscp_create_fxsend              (lscp_client_t *pClient, int iSamplerChannel, int iMidiController, const char *pszFxName);
267    lscp_status_t           lscp_destroy_fxsend             (lscp_client_t *pClient, int iSamplerChannel, int iFxSend);
268    
269    int                     lscp_get_fxsends                (lscp_client_t *pClient, int iSamplerChannel);
270    int *                   lscp_list_fxsends               (lscp_client_t *pClient, int iSamplerChannel);
271    
272    lscp_fxsend_info_t *    lscp_get_fxsend_info            (lscp_client_t *pClient, int iSamplerChannel, int iFxSend);
273    
274    lscp_status_t           lscp_set_fxsend_name            (lscp_client_t *pClient, int iSamplerChannel, int iFxSend, const char *pszFxName);
275    lscp_status_t           lscp_set_fxsend_audio_channel   (lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iAudioSrc, int iAudioDst);
276    lscp_status_t           lscp_set_fxsend_midi_controller (lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iMidiController);
277    lscp_status_t           lscp_set_fxsend_level           (lscp_client_t *pClient, int iSamplerChannel, int iFxSend, float fLevel);
278    
279    //-------------------------------------------------------------------------
280    // MIDI instrument mapping control functions.
281    
282    int                     lscp_add_midi_instrument_map    (lscp_client_t *pClient, const char *pszMapName);
283    lscp_status_t           lscp_remove_midi_instrument_map (lscp_client_t *pClient, int iMidiMap);
284    
285    int                     lscp_get_midi_instrument_maps   (lscp_client_t *pClient);
286    int *                   lscp_list_midi_instrument_maps  (lscp_client_t *pClient);
287    
288    const char *            lscp_get_midi_instrument_map_name (lscp_client_t *pClient, int iMidiMap);
289    lscp_status_t           lscp_set_midi_instrument_map_name (lscp_client_t *pClient, int iMidiMap, const char *pszMapName);
290    
291    lscp_status_t           lscp_map_midi_instrument        (lscp_client_t *pClient, lscp_midi_instrument_t *pMidiInstr, const char *pszEngineName, const char *pszFileName, int iInstrIndex, float fVolume, lscp_load_mode_t load_mode, const char *pszName);
292    lscp_status_t           lscp_unmap_midi_instrument      (lscp_client_t *pClient, lscp_midi_instrument_t *pMidiInstr);
293    
294    int                     lscp_get_midi_instruments       (lscp_client_t *pClient, int iMidiMap);
295    lscp_midi_instrument_t *lscp_list_midi_instruments      (lscp_client_t *pClient, int iMidiMap);
296    
297    lscp_midi_instrument_info_t *lscp_get_midi_instrument_info(lscp_client_t *pClient, lscp_midi_instrument_t *pMidiInstr);
298    
299    lscp_status_t           lscp_clear_midi_instruments     (lscp_client_t *pClient, int iMidiMap);
300    
301    //-------------------------------------------------------------------------
302    // Instrument editor functions.
303    
304    lscp_status_t           lscp_edit_channel_instrument    (lscp_client_t *pClient, int iSamplerChannel);
305    
306  #if defined(__cplusplus)  #if defined(__cplusplus)
307  }  }

Legend:
Removed from v.107  
changed lines
  Added in v.3664

  ViewVC Help
Powered by ViewVC