client.h

Go to the documentation of this file.
00001 // client.h
00002 //
00003 /****************************************************************************
00004    liblscp - LinuxSampler Control Protocol API
00005    Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Lesser General Public
00009    License as published by the Free Software Foundation; either
00010    version 2.1 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015    Lesser General Public License for more details.
00016 
00017    You should have received a copy of the GNU Lesser General Public
00018    License along with this library; if not, write to the Free Software
00019    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00020 
00021 *****************************************************************************/
00022 
00023 #ifndef __LSCP_CLIENT_H
00024 #define __LSCP_CLIENT_H
00025 
00026 #include "lscp/socket.h"
00027 #include "lscp/event.h"
00028 
00029 #if defined(__cplusplus)
00030 extern "C" {
00031 #endif
00032 
00033 //-------------------------------------------------------------------------
00034 // MIDI channel omni mode.
00035 
00036 #define LSCP_MIDI_CHANNEL_ALL   16
00037 
00038 
00039 //-------------------------------------------------------------------------
00040 // Client data structures.
00041 
00043 typedef struct _lscp_server_info_t
00044 {
00045     char *        description;
00046     char *        version;
00047 
00048 } lscp_server_info_t;
00049 
00050 
00052 typedef struct _lscp_engine_info_t
00053 {
00054     char *        description;
00055     char *        version;
00056 
00057 } lscp_engine_info_t;
00058 
00059 
00061 typedef struct _lscp_channel_info_t
00062 {
00063     char *        engine_name;
00064     int           audio_device;
00065     int           audio_channels;
00066     char **       audio_routing;
00067     char *        instrument_file;
00068     int           instrument_nr;
00069     char *        instrument_name;
00070     int           instrument_status;
00071     int           midi_device;
00072     int           midi_port;
00073     int           midi_channel;
00074     float         volume;
00075     int           mute;
00076     int           solo;
00077 
00078 } lscp_channel_info_t;
00079 
00080 
00082 typedef struct _lscp_buffer_fill_t
00083 {
00084     unsigned int  stream_id;
00085     unsigned long stream_usage;
00086 
00087 } lscp_buffer_fill_t;
00088 
00089 
00091 typedef enum _lscp_usage_t
00092 {
00093     LSCP_USAGE_BYTES = 0,
00094     LSCP_USAGE_PERCENTAGE
00095 
00096 } lscp_usage_t;
00097 
00098 
00099 //-------------------------------------------------------------------------
00100 // Client socket main structure.
00101 
00103 typedef struct _lscp_client_t lscp_client_t;
00104 
00106 typedef lscp_status_t (*lscp_client_proc_t)
00107 (
00108     struct _lscp_client_t *pClient,
00109     lscp_event_t event,
00110     const char *pchData,
00111     int cchData,
00112     void *pvData
00113 );
00114 
00115 //-------------------------------------------------------------------------
00116 // Client versioning teller fuunction.
00117 
00118 const char *            lscp_client_package             (void);
00119 const char *            lscp_client_version             (void);
00120 const char *            lscp_client_build               (void);
00121 
00122 //-------------------------------------------------------------------------
00123 // Client socket functions.
00124 
00125 lscp_client_t *         lscp_client_create              (const char *pszHost, int iPort, lscp_client_proc_t pfnCallback, void *pvData);
00126 lscp_status_t           lscp_client_join                (lscp_client_t *pClient);
00127 lscp_status_t           lscp_client_destroy             (lscp_client_t *pClient);
00128 
00129 lscp_status_t           lscp_client_set_timeout         (lscp_client_t *pClient, int iTimeout);
00130 int                     lscp_client_get_timeout         (lscp_client_t *pClient);
00131 
00132 //-------------------------------------------------------------------------
00133 // Client common protocol functions.
00134 
00135 lscp_status_t           lscp_client_query               (lscp_client_t *pClient, const char *pszQuery);
00136 const char *            lscp_client_get_result          (lscp_client_t *pClient );
00137 int                     lscp_client_get_errno           (lscp_client_t *pClient );
00138 
00139 //-------------------------------------------------------------------------
00140 // Client registration protocol functions.
00141 
00142 lscp_status_t           lscp_client_subscribe           (lscp_client_t *pClient, lscp_event_t events);
00143 lscp_status_t           lscp_client_unsubscribe         (lscp_client_t *pClient, lscp_event_t events);
00144 
00145 lscp_event_t            lscp_client_get_events          (lscp_client_t *pClient);
00146 
00147 //-------------------------------------------------------------------------
00148 // Client command protocol functions.
00149 
00150 lscp_status_t           lscp_load_instrument            (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
00151 lscp_status_t           lscp_load_instrument_non_modal  (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
00152 lscp_status_t           lscp_load_engine                (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel);
00153 int                     lscp_get_channels               (lscp_client_t *pClient);
00154 int *                   lscp_list_channels              (lscp_client_t *pClient);
00155 int                     lscp_add_channel                (lscp_client_t *pClient);
00156 lscp_status_t           lscp_remove_channel             (lscp_client_t *pClient, int iSamplerChannel);
00157 
00158 int                     lscp_get_available_engines      (lscp_client_t *pClient);
00159 const char **           lscp_list_available_engines     (lscp_client_t *pClient);
00160 
00161 lscp_engine_info_t *    lscp_get_engine_info            (lscp_client_t *pClient, const char *pszEngineName);
00162 lscp_channel_info_t *   lscp_get_channel_info           (lscp_client_t *pClient, int iSamplerChannel);
00163 
00164 int                     lscp_get_channel_voice_count    (lscp_client_t *pClient, int iSamplerChannel);
00165 int                     lscp_get_channel_stream_count   (lscp_client_t *pClient, int iSamplerChannel);
00166 int                     lscp_get_channel_stream_usage   (lscp_client_t *pClient, int iSamplerChannel);
00167 
00168 lscp_buffer_fill_t *    lscp_get_channel_buffer_fill    (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel);
00169 
00170 lscp_status_t           lscp_set_channel_audio_type     (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType);
00171 lscp_status_t           lscp_set_channel_audio_device   (lscp_client_t *pClient, int iSamplerChannel, int iAudioDevice);
00172 lscp_status_t           lscp_set_channel_audio_channel  (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn);
00173 
00174 lscp_status_t           lscp_set_channel_midi_type      (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType);
00175 lscp_status_t           lscp_set_channel_midi_device    (lscp_client_t *pClient, int iSamplerChannel, int iMidiDevice);
00176 lscp_status_t           lscp_set_channel_midi_port      (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort);
00177 lscp_status_t           lscp_set_channel_midi_channel   (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel);
00178 lscp_status_t           lscp_set_channel_volume         (lscp_client_t *pClient, int iSamplerChannel, float fVolume);
00179 
00180 lscp_status_t           lscp_set_channel_mute           (lscp_client_t *pClient, int iSamplerChannel, int iMute);
00181 lscp_status_t           lscp_set_channel_solo           (lscp_client_t *pClient, int iSamplerChannel, int iSolo);
00182 
00183 lscp_status_t           lscp_reset_channel              (lscp_client_t *pClient, int iSamplerChannel);
00184 
00185 lscp_status_t           lscp_reset_sampler              (lscp_client_t *pClient);
00186 
00187 lscp_server_info_t *    lscp_get_server_info            (lscp_client_t *pClient);
00188 
00189 #if defined(__cplusplus)
00190 }
00191 #endif
00192 
00193 #endif // __LSCP_CLIENT_H
00194 
00195 // end of client.h

Generated on Wed Aug 24 16:30:54 2005 for liblscp by  doxygen 1.4.4