1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
// client.h
//
/****************************************************************************
liblscp - LinuxSampler Control Protocol API
Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
#ifndef __LSCP_CLIENT_H
#define __LSCP_CLIENT_H
#include "lscp/socket.h"
#include "lscp/event.h"
#if defined(__cplusplus)
extern "C" {
#endif
//-------------------------------------------------------------------------
// MIDI channel omni mode.
#define LSCP_MIDI_CHANNEL_ALL 16
//-------------------------------------------------------------------------
// Client data structures.
/** Server info cache struct. */
typedef struct _lscp_server_info_t
{
char * description;
char * version;
} lscp_server_info_t;
/** Engine info cache struct. */
typedef struct _lscp_engine_info_t
{
char * description;
char * version;
} lscp_engine_info_t;
/** Channel info cache struct. */
typedef struct _lscp_channel_info_t
{
char * engine_name;
int audio_device;
int audio_channels;
char ** audio_routing;
char * instrument_file;
int instrument_nr;
char * instrument_name;
int instrument_status;
int midi_device;
int midi_port;
int midi_channel;
float volume;
int mute;
int solo;
} lscp_channel_info_t;
/** Buffer fill cache struct. */
typedef struct _lscp_buffer_fill_t
{
unsigned int stream_id;
unsigned long stream_usage;
} lscp_buffer_fill_t;
/** Buffer fill stream usage types. */
typedef enum _lscp_usage_t
{
LSCP_USAGE_BYTES = 0,
LSCP_USAGE_PERCENTAGE
} lscp_usage_t;
//-------------------------------------------------------------------------
// Client socket main structure.
/** Client opaque descriptor struct. */
typedef struct _lscp_client_t lscp_client_t;
/** Client event callback procedure prototype. */
typedef lscp_status_t (*lscp_client_proc_t)
(
struct _lscp_client_t *pClient,
lscp_event_t event,
const char *pchData,
int cchData,
void *pvData
);
//-------------------------------------------------------------------------
// Client versioning teller fuunction.
const char * lscp_client_package (void);
const char * lscp_client_version (void);
const char * lscp_client_build (void);
//-------------------------------------------------------------------------
// Client socket functions.
lscp_client_t * lscp_client_create (const char *pszHost, int iPort, lscp_client_proc_t pfnCallback, void *pvData);
lscp_status_t lscp_client_join (lscp_client_t *pClient);
lscp_status_t lscp_client_destroy (lscp_client_t *pClient);
lscp_status_t lscp_client_set_timeout (lscp_client_t *pClient, int iTimeout);
int lscp_client_get_timeout (lscp_client_t *pClient);
//-------------------------------------------------------------------------
// Client common protocol functions.
lscp_status_t lscp_client_query (lscp_client_t *pClient, const char *pszQuery);
const char * lscp_client_get_result (lscp_client_t *pClient );
int lscp_client_get_errno (lscp_client_t *pClient );
//-------------------------------------------------------------------------
// Client registration protocol functions.
lscp_status_t lscp_client_subscribe (lscp_client_t *pClient, lscp_event_t events);
lscp_status_t lscp_client_unsubscribe (lscp_client_t *pClient, lscp_event_t events);
lscp_event_t lscp_client_get_events (lscp_client_t *pClient);
//-------------------------------------------------------------------------
// Client command protocol functions.
lscp_status_t lscp_load_instrument (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
lscp_status_t lscp_load_instrument_non_modal (lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel);
lscp_status_t lscp_load_engine (lscp_client_t *pClient, const char *pszEngineName, int iSamplerChannel);
int lscp_get_channels (lscp_client_t *pClient);
int * lscp_list_channels (lscp_client_t *pClient);
int lscp_add_channel (lscp_client_t *pClient);
lscp_status_t lscp_remove_channel (lscp_client_t *pClient, int iSamplerChannel);
int lscp_get_available_engines (lscp_client_t *pClient);
const char ** lscp_list_available_engines (lscp_client_t *pClient);
lscp_engine_info_t * lscp_get_engine_info (lscp_client_t *pClient, const char *pszEngineName);
lscp_channel_info_t * lscp_get_channel_info (lscp_client_t *pClient, int iSamplerChannel);
int lscp_get_channel_voice_count (lscp_client_t *pClient, int iSamplerChannel);
int lscp_get_channel_stream_count (lscp_client_t *pClient, int iSamplerChannel);
int lscp_get_channel_stream_usage (lscp_client_t *pClient, int iSamplerChannel);
lscp_buffer_fill_t * lscp_get_channel_buffer_fill (lscp_client_t *pClient, lscp_usage_t iUsageType, int iSamplerChannel);
lscp_status_t lscp_set_channel_audio_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioType);
lscp_status_t lscp_set_channel_audio_device (lscp_client_t *pClient, int iSamplerChannel, int iAudioDevice);
lscp_status_t lscp_set_channel_audio_channel (lscp_client_t *pClient, int iSamplerChannel, int iAudioOut, int iAudioIn);
lscp_status_t lscp_set_channel_midi_type (lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiType);
lscp_status_t lscp_set_channel_midi_device (lscp_client_t *pClient, int iSamplerChannel, int iMidiDevice);
lscp_status_t lscp_set_channel_midi_port (lscp_client_t *pClient, int iSamplerChannel, int iMidiPort);
lscp_status_t lscp_set_channel_midi_channel (lscp_client_t *pClient, int iSamplerChannel, int iMidiChannel);
lscp_status_t lscp_set_channel_volume (lscp_client_t *pClient, int iSamplerChannel, float fVolume);
lscp_status_t lscp_set_channel_mute (lscp_client_t *pClient, int iSamplerChannel, int iMute);
lscp_status_t lscp_set_channel_solo (lscp_client_t *pClient, int iSamplerChannel, int iSolo);
lscp_status_t lscp_reset_channel (lscp_client_t *pClient, int iSamplerChannel);
lscp_status_t lscp_reset_sampler (lscp_client_t *pClient);
lscp_server_info_t * lscp_get_server_info (lscp_client_t *pClient);
#if defined(__cplusplus)
}
#endif
#endif // __LSCP_CLIENT_H
// end of client.h
|