2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
liblscp - LinuxSampler Control Protocol API |
liblscp - LinuxSampler Control Protocol API |
5 |
Copyright (C) 2004-2008, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2013, 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 |
27 |
#define LSCP_TIMEOUT_MSECS 500 |
#define LSCP_TIMEOUT_MSECS 500 |
28 |
|
|
29 |
|
|
30 |
|
// Whether to use getaddrinfo() instead |
31 |
|
// of deprecated gethostbyname() |
32 |
|
#define USE_GETADDRINFO 1 |
33 |
|
|
34 |
|
|
35 |
// Local prototypes. |
// Local prototypes. |
36 |
|
|
37 |
static void _lscp_client_evt_proc (void *pvClient); |
static void _lscp_client_evt_proc (void *pvClient); |
38 |
|
|
39 |
static lscp_status_t _lscp_client_evt_connect (lscp_client_t *pClient); |
static lscp_status_t _lscp_client_evt_connect (lscp_client_t *pClient); |
40 |
static lscp_status_t _lscp_client_evt_request (lscp_client_t *pClient, int iSubscribe, lscp_event_t event); |
static lscp_status_t _lscp_client_evt_request (lscp_client_t *pClient, |
41 |
|
int iSubscribe, lscp_event_t event); |
42 |
|
|
43 |
|
|
44 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
92 |
char achBuffer[LSCP_BUFSIZ]; |
char achBuffer[LSCP_BUFSIZ]; |
93 |
int cchBuffer; |
int cchBuffer; |
94 |
const char *pszSeps = ":\r\n"; |
const char *pszSeps = ":\r\n"; |
95 |
char * pszToken; |
char *pszToken; |
96 |
char * pch; |
char *pch; |
97 |
int cchToken; |
int cchToken; |
98 |
|
|
99 |
lscp_event_t event; |
lscp_event_t event; |
100 |
|
|
101 |
#ifdef DEBUG |
#ifdef DEBUG |
192 |
} |
} |
193 |
|
|
194 |
#if defined(WIN32) |
#if defined(WIN32) |
195 |
if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR) |
if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, |
196 |
|
(char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR) |
197 |
lscp_socket_perror("lscp_client_evt_connect: setsockopt(SO_DONTLINGER)"); |
lscp_socket_perror("lscp_client_evt_connect: setsockopt(SO_DONTLINGER)"); |
198 |
#endif |
#endif |
199 |
|
|
221 |
|
|
222 |
|
|
223 |
// Subscribe to a single event. |
// Subscribe to a single event. |
224 |
static lscp_status_t _lscp_client_evt_request ( lscp_client_t *pClient, int iSubscribe, lscp_event_t event ) |
static lscp_status_t _lscp_client_evt_request ( lscp_client_t *pClient, |
225 |
|
int iSubscribe, lscp_event_t event ) |
226 |
{ |
{ |
227 |
const char *pszEvent; |
const char *pszEvent; |
228 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
237 |
return LSCP_FAILED; |
return LSCP_FAILED; |
238 |
|
|
239 |
// Build the query string... |
// Build the query string... |
240 |
cchQuery = sprintf(szQuery, "%sSUBSCRIBE %s\n\n", (iSubscribe == 0 ? "UN" : ""), pszEvent); |
cchQuery = sprintf(szQuery, "%sSUBSCRIBE %s\n\n", |
241 |
|
(iSubscribe == 0 ? "UN" : ""), pszEvent); |
242 |
// Just send data, forget result... |
// Just send data, forget result... |
243 |
if (send(pClient->evt.sock, szQuery, cchQuery, 0) < cchQuery) { |
if (send(pClient->evt.sock, szQuery, cchQuery, 0) < cchQuery) { |
244 |
lscp_socket_perror("_lscp_client_evt_request: send"); |
lscp_socket_perror("_lscp_client_evt_request: send"); |
289 |
* @returns The new client instance pointer if successfull, which shall be |
* @returns The new client instance pointer if successfull, which shall be |
290 |
* used on all subsequent client calls, NULL otherwise. |
* used on all subsequent client calls, NULL otherwise. |
291 |
*/ |
*/ |
292 |
lscp_client_t* lscp_client_create ( const char *pszHost, int iPort, lscp_client_proc_t pfnCallback, void *pvData ) |
lscp_client_t* lscp_client_create ( const char *pszHost, int iPort, |
293 |
|
lscp_client_proc_t pfnCallback, void *pvData ) |
294 |
{ |
{ |
295 |
lscp_client_t *pClient; |
lscp_client_t *pClient; |
296 |
|
#if defined(USE_GETADDRINFO) |
297 |
|
char szPort[33]; |
298 |
|
struct addrinfo hints; |
299 |
|
struct addrinfo *result, *res; |
300 |
|
#else |
301 |
struct hostent *pHost; |
struct hostent *pHost; |
|
lscp_socket_t sock; |
|
302 |
struct sockaddr_in addr; |
struct sockaddr_in addr; |
303 |
int cAddr; |
int cAddr; |
304 |
|
#endif /* !USE_GETADDRINFO */ |
305 |
|
lscp_socket_t sock; |
306 |
#if defined(WIN32) |
#if defined(WIN32) |
307 |
int iSockOpt = (-1); |
int iSockOpt = (-1); |
308 |
#endif |
#endif |
312 |
return NULL; |
return NULL; |
313 |
} |
} |
314 |
|
|
315 |
|
#if defined(USE_GETADDRINFO) |
316 |
|
|
317 |
|
// Convert port number to string/name... |
318 |
|
snprintf(szPort, sizeof(szPort), "%d", iPort); |
319 |
|
|
320 |
|
// Obtain address(es) matching host/port... |
321 |
|
memset(&hints, 0, sizeof(struct addrinfo)); |
322 |
|
hints.ai_family = AF_INET; |
323 |
|
hints.ai_socktype = SOCK_STREAM; |
324 |
|
|
325 |
|
result = NULL; |
326 |
|
|
327 |
|
if (getaddrinfo(pszHost, szPort, &hints, &result)) { |
328 |
|
lscp_socket_herror("lscp_client_create: getaddrinfo"); |
329 |
|
return NULL; |
330 |
|
} |
331 |
|
|
332 |
|
#else |
333 |
|
|
334 |
|
// Obtain host matching name... |
335 |
pHost = gethostbyname(pszHost); |
pHost = gethostbyname(pszHost); |
336 |
if (pHost == NULL) { |
if (pHost == NULL) { |
337 |
lscp_socket_herror("lscp_client_create: gethostbyname"); |
lscp_socket_herror("lscp_client_create: gethostbyname"); |
338 |
return NULL; |
return NULL; |
339 |
} |
} |
340 |
|
|
341 |
|
#endif /* !USE_GETADDRINFO */ |
342 |
|
|
343 |
// Allocate client descriptor... |
// Allocate client descriptor... |
344 |
|
|
345 |
pClient = (lscp_client_t *) malloc(sizeof(lscp_client_t)); |
pClient = (lscp_client_t *) malloc(sizeof(lscp_client_t)); |
353 |
pClient->pvData = pvData; |
pClient->pvData = pvData; |
354 |
|
|
355 |
#ifdef DEBUG |
#ifdef DEBUG |
356 |
fprintf(stderr, "lscp_client_create: pClient=%p: pszHost=%s iPort=%d.\n", pClient, pszHost, iPort); |
fprintf(stderr, |
357 |
|
"lscp_client_create: pClient=%p: pszHost=%s iPort=%d.\n", |
358 |
|
pClient, pszHost, iPort); |
359 |
#endif |
#endif |
360 |
|
|
361 |
// Prepare the command connection socket... |
// Prepare the command connection socket... |
362 |
|
|
363 |
|
#if defined(USE_GETADDRINFO) |
364 |
|
|
365 |
|
// getaddrinfo() returns a list of address structures; |
366 |
|
// try each address until we successfully connect(2); |
367 |
|
// if socket or connect fails, we close the socket and |
368 |
|
// try the next address... |
369 |
|
sock = INVALID_SOCKET; |
370 |
|
|
371 |
|
for (res = result; res; res = res->ai_next) { |
372 |
|
sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); |
373 |
|
if (sock == INVALID_SOCKET) |
374 |
|
continue; |
375 |
|
#if defined(WIN32) |
376 |
|
if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, |
377 |
|
(char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR) |
378 |
|
lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)"); |
379 |
|
#endif |
380 |
|
#ifdef DEBUG |
381 |
|
lscp_socket_getopts("lscp_client_create: cmd", sock); |
382 |
|
#endif |
383 |
|
if (connect(sock, res->ai_addr, res->ai_addrlen) != SOCKET_ERROR) |
384 |
|
break; |
385 |
|
closesocket(sock); |
386 |
|
} |
387 |
|
|
388 |
|
if (sock == INVALID_SOCKET) { |
389 |
|
lscp_socket_perror("lscp_client_create: cmd: socket"); |
390 |
|
free(pClient); |
391 |
|
return NULL; |
392 |
|
} |
393 |
|
|
394 |
|
if (res == NULL) { |
395 |
|
lscp_socket_perror("lscp_client_create: cmd: connect"); |
396 |
|
free(pClient); |
397 |
|
return NULL; |
398 |
|
} |
399 |
|
|
400 |
|
// Initialize the command socket agent struct... |
401 |
|
lscp_socket_agent_init(&(pClient->cmd), sock, |
402 |
|
(struct sockaddr_in *) res->ai_addr, res->ai_addrlen); |
403 |
|
|
404 |
|
// No longer needed... |
405 |
|
freeaddrinfo(result); |
406 |
|
|
407 |
|
#else |
408 |
|
|
409 |
sock = socket(AF_INET, SOCK_STREAM, 0); |
sock = socket(AF_INET, SOCK_STREAM, 0); |
410 |
if (sock == INVALID_SOCKET) { |
if (sock == INVALID_SOCKET) { |
411 |
lscp_socket_perror("lscp_client_create: cmd: socket"); |
lscp_socket_perror("lscp_client_create: cmd: socket"); |
414 |
} |
} |
415 |
|
|
416 |
#if defined(WIN32) |
#if defined(WIN32) |
417 |
if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR) |
if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, |
418 |
|
(char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR) |
419 |
lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)"); |
lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)"); |
420 |
#endif |
#endif |
421 |
|
|
439 |
// Initialize the command socket agent struct... |
// Initialize the command socket agent struct... |
440 |
lscp_socket_agent_init(&(pClient->cmd), sock, &addr, cAddr); |
lscp_socket_agent_init(&(pClient->cmd), sock, &addr, cAddr); |
441 |
|
|
442 |
|
#endif /* !USE_GETADDRINFO */ |
443 |
|
|
444 |
#ifdef DEBUG |
#ifdef DEBUG |
445 |
fprintf(stderr, "lscp_client_create: cmd: pClient=%p: sock=%d addr=%s port=%d.\n", pClient, pClient->cmd.sock, inet_ntoa(pClient->cmd.addr.sin_addr), ntohs(pClient->cmd.addr.sin_port)); |
fprintf(stderr, |
446 |
|
"lscp_client_create: cmd: pClient=%p: sock=%d addr=%s port=%d.\n", |
447 |
|
pClient, pClient->cmd.sock, |
448 |
|
inet_ntoa(pClient->cmd.addr.sin_addr), |
449 |
|
ntohs(pClient->cmd.addr.sin_port)); |
450 |
#endif |
#endif |
451 |
|
|
452 |
// Initialize the event service socket struct... |
// Initialize the event service socket struct... |
931 |
* |
* |
932 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
933 |
*/ |
*/ |
934 |
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, |
935 |
|
const char *pszFileName, int iInstrIndex, int iSamplerChannel ) |
936 |
{ |
{ |
937 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
938 |
|
|
939 |
if (pszFileName == NULL || iSamplerChannel < 0) |
if (pszFileName == NULL || iSamplerChannel < 0) |
940 |
return LSCP_FAILED; |
return LSCP_FAILED; |
941 |
|
|
942 |
sprintf(szQuery, "LOAD INSTRUMENT '%s' %d %d\r\n", pszFileName, iInstrIndex, iSamplerChannel); |
sprintf(szQuery, "LOAD INSTRUMENT '%s' %d %d\r\n", |
943 |
|
pszFileName, iInstrIndex, iSamplerChannel); |
944 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
945 |
} |
} |
946 |
|
|
956 |
* |
* |
957 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
958 |
*/ |
*/ |
959 |
lscp_status_t lscp_load_instrument_non_modal ( lscp_client_t *pClient, const char *pszFileName, int iInstrIndex, int iSamplerChannel ) |
lscp_status_t lscp_load_instrument_non_modal ( lscp_client_t *pClient, |
960 |
|
const char *pszFileName, int iInstrIndex, int iSamplerChannel ) |
961 |
{ |
{ |
962 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
963 |
|
|
964 |
if (pszFileName == NULL || iSamplerChannel < 0) |
if (pszFileName == NULL || iSamplerChannel < 0) |
965 |
return LSCP_FAILED; |
return LSCP_FAILED; |
966 |
|
|
967 |
sprintf(szQuery, "LOAD INSTRUMENT NON_MODAL '%s' %d %d\r\n", pszFileName, iInstrIndex, iSamplerChannel); |
sprintf(szQuery, "LOAD INSTRUMENT NON_MODAL '%s' %d %d\r\n", |
968 |
|
pszFileName, iInstrIndex, iSamplerChannel); |
969 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
970 |
} |
} |
971 |
|
|
987 |
if (pszEngineName == NULL || iSamplerChannel < 0) |
if (pszEngineName == NULL || iSamplerChannel < 0) |
988 |
return LSCP_FAILED; |
return LSCP_FAILED; |
989 |
|
|
990 |
sprintf(szQuery, "LOAD ENGINE %s %d\r\n", pszEngineName, iSamplerChannel); |
sprintf(szQuery, "LOAD ENGINE %s %d\r\n", |
991 |
|
pszEngineName, iSamplerChannel); |
992 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
993 |
} |
} |
994 |
|
|
1179 |
* @returns A pointer to a @ref lscp_engine_info_t structure, with all the |
* @returns A pointer to a @ref lscp_engine_info_t structure, with all the |
1180 |
* information of the given sampler engine, or NULL in case of failure. |
* information of the given sampler engine, or NULL in case of failure. |
1181 |
*/ |
*/ |
1182 |
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, |
1183 |
|
const char *pszEngineName ) |
1184 |
{ |
{ |
1185 |
lscp_engine_info_t *pEngineInfo; |
lscp_engine_info_t *pEngineInfo; |
1186 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1508 |
* information of the current disk stream buffer fill usage, for the given |
* information of the current disk stream buffer fill usage, for the given |
1509 |
* sampler channel, or NULL in case of failure. |
* sampler channel, or NULL in case of failure. |
1510 |
*/ |
*/ |
1511 |
lscp_buffer_fill_t *lscp_get_channel_buffer_fill ( lscp_client_t *pClient, lscp_usage_t usage_type, int iSamplerChannel ) |
lscp_buffer_fill_t *lscp_get_channel_buffer_fill ( lscp_client_t *pClient, |
1512 |
|
lscp_usage_t usage_type, int iSamplerChannel ) |
1513 |
{ |
{ |
1514 |
lscp_buffer_fill_t *pBufferFill; |
lscp_buffer_fill_t *pBufferFill; |
1515 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1582 |
* |
* |
1583 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1584 |
*/ |
*/ |
1585 |
lscp_status_t lscp_set_channel_audio_type ( lscp_client_t *pClient, int iSamplerChannel, const char *pszAudioDriver ) |
lscp_status_t lscp_set_channel_audio_type ( lscp_client_t *pClient, |
1586 |
|
int iSamplerChannel, const char *pszAudioDriver ) |
1587 |
{ |
{ |
1588 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1589 |
|
|
1590 |
if (iSamplerChannel < 0 || pszAudioDriver == NULL) |
if (iSamplerChannel < 0 || pszAudioDriver == NULL) |
1591 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1592 |
|
|
1593 |
sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_TYPE %d %s\r\n", iSamplerChannel, pszAudioDriver); |
sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_TYPE %d %s\r\n", |
1594 |
|
iSamplerChannel, pszAudioDriver); |
1595 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1596 |
} |
} |
1597 |
|
|
1606 |
* |
* |
1607 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1608 |
*/ |
*/ |
1609 |
lscp_status_t lscp_set_channel_audio_device ( lscp_client_t *pClient, int iSamplerChannel, int iAudioDevice ) |
lscp_status_t lscp_set_channel_audio_device ( lscp_client_t *pClient, |
1610 |
|
int iSamplerChannel, int iAudioDevice ) |
1611 |
{ |
{ |
1612 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1613 |
|
|
1614 |
if (iSamplerChannel < 0 || iAudioDevice < 0) |
if (iSamplerChannel < 0 || iAudioDevice < 0) |
1615 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1616 |
|
|
1617 |
sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_DEVICE %d %d\r\n", iSamplerChannel, iAudioDevice); |
sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_DEVICE %d %d\r\n", |
1618 |
|
iSamplerChannel, iAudioDevice); |
1619 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1620 |
} |
} |
1621 |
|
|
1631 |
* |
* |
1632 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1633 |
*/ |
*/ |
1634 |
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, |
1635 |
|
int iSamplerChannel, int iAudioOut, int iAudioIn ) |
1636 |
{ |
{ |
1637 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1638 |
|
|
1639 |
if (iSamplerChannel < 0 || iAudioOut < 0 || iAudioIn < 0) |
if (iSamplerChannel < 0 || iAudioOut < 0 || iAudioIn < 0) |
1640 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1641 |
|
|
1642 |
sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_CHANNEL %d %d %d\r\n", iSamplerChannel, iAudioOut, iAudioIn); |
sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_CHANNEL %d %d %d\r\n", |
1643 |
|
iSamplerChannel, iAudioOut, iAudioIn); |
1644 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1645 |
} |
} |
1646 |
|
|
1655 |
* |
* |
1656 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1657 |
*/ |
*/ |
1658 |
lscp_status_t lscp_set_channel_midi_type ( lscp_client_t *pClient, int iSamplerChannel, const char *pszMidiDriver ) |
lscp_status_t lscp_set_channel_midi_type ( lscp_client_t *pClient, |
1659 |
|
int iSamplerChannel, const char *pszMidiDriver ) |
1660 |
{ |
{ |
1661 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1662 |
|
|
1663 |
if (iSamplerChannel < 0 || pszMidiDriver == NULL) |
if (iSamplerChannel < 0 || pszMidiDriver == NULL) |
1664 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1665 |
|
|
1666 |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_TYPE %d %s\r\n", iSamplerChannel, pszMidiDriver); |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_TYPE %d %s\r\n", |
1667 |
|
iSamplerChannel, pszMidiDriver); |
1668 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1669 |
} |
} |
1670 |
|
|
1679 |
* |
* |
1680 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1681 |
*/ |
*/ |
1682 |
lscp_status_t lscp_set_channel_midi_device ( lscp_client_t *pClient, int iSamplerChannel, int iMidiDevice ) |
lscp_status_t lscp_set_channel_midi_device ( lscp_client_t *pClient, |
1683 |
|
int iSamplerChannel, int iMidiDevice ) |
1684 |
{ |
{ |
1685 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1686 |
|
|
1687 |
if (iSamplerChannel < 0 || iMidiDevice < 0) |
if (iSamplerChannel < 0 || iMidiDevice < 0) |
1688 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1689 |
|
|
1690 |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_DEVICE %d %d\r\n", iSamplerChannel, iMidiDevice); |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_DEVICE %d %d\r\n", |
1691 |
|
iSamplerChannel, iMidiDevice); |
1692 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1693 |
} |
} |
1694 |
|
|
1703 |
* |
* |
1704 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1705 |
*/ |
*/ |
1706 |
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, |
1707 |
|
int iSamplerChannel, int iMidiPort ) |
1708 |
{ |
{ |
1709 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1710 |
|
|
1711 |
if (iSamplerChannel < 0 || iMidiPort < 0) |
if (iSamplerChannel < 0 || iMidiPort < 0) |
1712 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1713 |
|
|
1714 |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_PORT %d %d\r\n", iSamplerChannel, iMidiPort); |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_PORT %d %d\r\n", |
1715 |
|
iSamplerChannel, iMidiPort); |
1716 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1717 |
} |
} |
1718 |
|
|
1728 |
* |
* |
1729 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1730 |
*/ |
*/ |
1731 |
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, |
1732 |
|
int iSamplerChannel, int iMidiChannel ) |
1733 |
{ |
{ |
1734 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1735 |
|
|
1737 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1738 |
|
|
1739 |
if (iMidiChannel == LSCP_MIDI_CHANNEL_ALL) |
if (iMidiChannel == LSCP_MIDI_CHANNEL_ALL) |
1740 |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n", iSamplerChannel); |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n", |
1741 |
|
iSamplerChannel); |
1742 |
else |
else |
1743 |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n", iSamplerChannel, iMidiChannel); |
sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n", |
1744 |
|
iSamplerChannel, iMidiChannel); |
1745 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1746 |
} |
} |
1747 |
|
|
1758 |
* |
* |
1759 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1760 |
*/ |
*/ |
1761 |
lscp_status_t lscp_set_channel_midi_map ( lscp_client_t *pClient, int iSamplerChannel, int iMidiMap ) |
lscp_status_t lscp_set_channel_midi_map ( lscp_client_t *pClient, |
1762 |
|
int iSamplerChannel, int iMidiMap ) |
1763 |
{ |
{ |
1764 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1765 |
|
|
1793 |
* |
* |
1794 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1795 |
*/ |
*/ |
1796 |
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, |
1797 |
|
int iSamplerChannel, float fVolume ) |
1798 |
{ |
{ |
1799 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1800 |
struct _locale_t locale; |
struct _locale_t locale; |
1803 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1804 |
|
|
1805 |
_save_and_set_c_locale(&locale); |
_save_and_set_c_locale(&locale); |
1806 |
sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n", iSamplerChannel, fVolume); |
sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n", |
1807 |
|
iSamplerChannel, fVolume); |
1808 |
_restore_locale(&locale); |
_restore_locale(&locale); |
1809 |
|
|
1810 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1823 |
* |
* |
1824 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1825 |
*/ |
*/ |
1826 |
lscp_status_t lscp_set_channel_mute ( lscp_client_t *pClient, int iSamplerChannel, int iMute ) |
lscp_status_t lscp_set_channel_mute ( lscp_client_t *pClient, |
1827 |
|
int iSamplerChannel, int iMute ) |
1828 |
{ |
{ |
1829 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1830 |
|
|
1831 |
if (iSamplerChannel < 0 || iMute < 0 || iMute > 1) |
if (iSamplerChannel < 0 || iMute < 0 || iMute > 1) |
1832 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1833 |
|
|
1834 |
sprintf(szQuery, "SET CHANNEL MUTE %d %d\r\n", iSamplerChannel, iMute); |
sprintf(szQuery, "SET CHANNEL MUTE %d %d\r\n", |
1835 |
|
iSamplerChannel, iMute); |
1836 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1837 |
} |
} |
1838 |
|
|
1849 |
* |
* |
1850 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1851 |
*/ |
*/ |
1852 |
lscp_status_t lscp_set_channel_solo ( lscp_client_t *pClient, int iSamplerChannel, int iSolo ) |
lscp_status_t lscp_set_channel_solo ( lscp_client_t *pClient, |
1853 |
|
int iSamplerChannel, int iSolo ) |
1854 |
{ |
{ |
1855 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1856 |
|
|
1857 |
if (iSamplerChannel < 0 || iSolo < 0 || iSolo > 1) |
if (iSamplerChannel < 0 || iSolo < 0 || iSolo > 1) |
1858 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1859 |
|
|
1860 |
sprintf(szQuery, "SET CHANNEL SOLO %d %d\r\n", iSamplerChannel, iSolo); |
sprintf(szQuery, "SET CHANNEL SOLO %d %d\r\n", |
1861 |
|
iSamplerChannel, iSolo); |
1862 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
1863 |
} |
} |
1864 |
|
|
2075 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2076 |
} |
} |
2077 |
|
|
2078 |
|
|
2079 |
/** |
/** |
2080 |
* Get global voice limit setting: |
* Get global voice limit setting: |
2081 |
* @code |
* @code |
2090 |
* negative value on error (e.g. if sampler doesn't support |
* negative value on error (e.g. if sampler doesn't support |
2091 |
* this command). |
* this command). |
2092 |
*/ |
*/ |
2093 |
int lscp_get_voices(lscp_client_t *pClient) |
int lscp_get_voices ( lscp_client_t *pClient ) |
2094 |
{ |
{ |
2095 |
int iVoices = -1; |
int iVoices = -1; |
2096 |
|
|
2109 |
return iVoices; |
return iVoices; |
2110 |
} |
} |
2111 |
|
|
2112 |
|
|
2113 |
/** |
/** |
2114 |
* Setting global voice limit setting: |
* Setting global voice limit setting: |
2115 |
* @code |
* @code |
2128 |
* |
* |
2129 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2130 |
*/ |
*/ |
2131 |
lscp_status_t lscp_set_voices(lscp_client_t *pClient, int iMaxVoices) |
lscp_status_t lscp_set_voices ( lscp_client_t *pClient, int iMaxVoices ) |
2132 |
{ |
{ |
2133 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2134 |
|
|
2139 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2140 |
} |
} |
2141 |
|
|
2142 |
|
|
2143 |
/** |
/** |
2144 |
* Get global disk streams limit setting: |
* Get global disk streams limit setting: |
2145 |
* @code |
* @code |
2154 |
* or a negative value on error (e.g. if sampler doesn't |
* or a negative value on error (e.g. if sampler doesn't |
2155 |
* support this command). |
* support this command). |
2156 |
*/ |
*/ |
2157 |
int lscp_get_streams(lscp_client_t *pClient) |
int lscp_get_streams ( lscp_client_t *pClient ) |
2158 |
{ |
{ |
2159 |
int iStreams = -1; |
int iStreams = -1; |
2160 |
|
|
2173 |
return iStreams; |
return iStreams; |
2174 |
} |
} |
2175 |
|
|
2176 |
|
|
2177 |
/** |
/** |
2178 |
* Setting global disk streams limit setting: |
* Setting global disk streams limit setting: |
2179 |
* @code |
* @code |
2192 |
* |
* |
2193 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2194 |
*/ |
*/ |
2195 |
lscp_status_t lscp_set_streams(lscp_client_t *pClient, int iMaxStreams) |
lscp_status_t lscp_set_streams ( lscp_client_t *pClient, int iMaxStreams ) |
2196 |
{ |
{ |
2197 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2198 |
|
|
2203 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2204 |
} |
} |
2205 |
|
|
2206 |
|
|
2207 |
/** |
/** |
2208 |
* Add an effect send to a sampler channel: |
* Add an effect send to a sampler channel: |
2209 |
* CREATE FX_SEND <sampler-channel> <midi-ctrl> [<name>] |
* CREATE FX_SEND <sampler-channel> <midi-ctrl> [<fx-name>] |
2210 |
* |
* |
2211 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2212 |
* @param iSamplerChannel Sampler channel number. |
* @param iSamplerChannel Sampler channel number. |
2213 |
* @param iMidiController MIDI controller used to alter the effect, |
* @param iMidiController MIDI controller used to alter the effect, |
2214 |
* usually a number between 0 and 127. |
* usually a number between 0 and 127. |
2215 |
* @param pszName Optional name for the effect send entity, |
* @param pszFxName Optional name for the effect send entity, |
2216 |
* does not have to be unique. |
* does not have to be unique. |
2217 |
* |
* |
2218 |
* @returns The new effect send number identifier, or -1 in case of failure. |
* @returns The new effect send number identifier, or -1 in case of failure. |
2219 |
*/ |
*/ |
2220 |
int lscp_create_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iMidiController, const char *pszFxName ) |
int lscp_create_fxsend ( lscp_client_t *pClient, |
2221 |
|
int iSamplerChannel, int iMidiController, const char *pszFxName ) |
2222 |
{ |
{ |
2223 |
int iFxSend = -1; |
int iFxSend = -1; |
2224 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2231 |
// Lock this section up. |
// Lock this section up. |
2232 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
2233 |
|
|
2234 |
sprintf(szQuery, "CREATE FX_SEND %d %d", iSamplerChannel, iMidiController); |
sprintf(szQuery, "CREATE FX_SEND %d %d", |
2235 |
|
iSamplerChannel, iMidiController); |
2236 |
|
|
2237 |
if (pszFxName) |
if (pszFxName) |
2238 |
sprintf(szQuery + strlen(szQuery), " '%s'", pszFxName); |
sprintf(szQuery + strlen(szQuery), " '%s'", pszFxName); |
2259 |
* |
* |
2260 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2261 |
*/ |
*/ |
2262 |
lscp_status_t lscp_destroy_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend ) |
lscp_status_t lscp_destroy_fxsend ( lscp_client_t *pClient, |
2263 |
|
int iSamplerChannel, int iFxSend ) |
2264 |
{ |
{ |
2265 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2266 |
|
|
2267 |
if (iSamplerChannel < 0 || iFxSend < 0) |
if (iSamplerChannel < 0 || iFxSend < 0) |
2268 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2269 |
|
|
2270 |
sprintf(szQuery, "DESTROY FX_SEND %d %d\r\n", iSamplerChannel, iFxSend); |
sprintf(szQuery, "DESTROY FX_SEND %d %d\r\n", |
2271 |
|
iSamplerChannel, iFxSend); |
2272 |
|
|
2273 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2274 |
} |
} |
2358 |
* @returns A pointer to a @ref lscp_fxsend_info_t structure, with the |
* @returns A pointer to a @ref lscp_fxsend_info_t structure, with the |
2359 |
* information of the given FX send, or NULL in case of failure. |
* information of the given FX send, or NULL in case of failure. |
2360 |
*/ |
*/ |
2361 |
lscp_fxsend_info_t *lscp_get_fxsend_info ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend ) |
lscp_fxsend_info_t *lscp_get_fxsend_info ( lscp_client_t *pClient, |
2362 |
|
int iSamplerChannel, int iFxSend ) |
2363 |
{ |
{ |
2364 |
lscp_fxsend_info_t *pFxSendInfo; |
lscp_fxsend_info_t *pFxSendInfo; |
2365 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2424 |
return pFxSendInfo; |
return pFxSendInfo; |
2425 |
} |
} |
2426 |
|
|
2427 |
|
|
2428 |
/** |
/** |
2429 |
* Alter effect send's name: |
* Alter effect send's name: |
2430 |
* @code |
* @code |
2438 |
* |
* |
2439 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2440 |
*/ |
*/ |
2441 |
lscp_status_t lscp_set_fxsend_name ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, const char *pszFxName ) |
lscp_status_t lscp_set_fxsend_name ( lscp_client_t *pClient, |
2442 |
|
int iSamplerChannel, int iFxSend, const char *pszFxName ) |
2443 |
{ |
{ |
2444 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2445 |
|
|
2446 |
if (!pClient || iSamplerChannel < 0 || iFxSend < 0 || !pszFxName) |
if (!pClient || iSamplerChannel < 0 || iFxSend < 0 || !pszFxName) |
2447 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2448 |
|
|
2449 |
snprintf(szQuery, LSCP_BUFSIZ, "SET FX_SEND NAME %d %d '%s'\r\n", iSamplerChannel, iFxSend, pszFxName); |
snprintf(szQuery, LSCP_BUFSIZ, "SET FX_SEND NAME %d %d '%s'\r\n", |
2450 |
|
iSamplerChannel, iFxSend, pszFxName); |
2451 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2452 |
} |
} |
2453 |
|
|
2454 |
|
|
2455 |
/** |
/** |
2456 |
* Alter effect send's audio routing: |
* Alter effect send's audio routing: |
2457 |
* SET FX_SEND AUDIO_OUTPUT_CHANNEL <sampler-chan> <fx-send-id> |
* SET FX_SEND AUDIO_OUTPUT_CHANNEL <sampler-chan> <fx-send-id> |
2465 |
* |
* |
2466 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2467 |
*/ |
*/ |
2468 |
lscp_status_t lscp_set_fxsend_audio_channel ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iAudioSrc, int iAudioDst ) |
lscp_status_t lscp_set_fxsend_audio_channel ( lscp_client_t *pClient, |
2469 |
|
int iSamplerChannel, int iFxSend, int iAudioSrc, int iAudioDst ) |
2470 |
{ |
{ |
2471 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2472 |
|
|
2473 |
if (iSamplerChannel < 0 || iFxSend < 0 || iAudioSrc < 0 || iAudioDst < 0) |
if (iSamplerChannel < 0 || iFxSend < 0 || iAudioSrc < 0 || iAudioDst < 0) |
2474 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2475 |
|
|
2476 |
sprintf(szQuery, "SET FX_SEND AUDIO_OUTPUT_CHANNEL %d %d %d %d\r\n", iSamplerChannel, iFxSend, iAudioSrc, iAudioDst); |
sprintf(szQuery, "SET FX_SEND AUDIO_OUTPUT_CHANNEL %d %d %d %d\r\n", |
2477 |
|
iSamplerChannel, iFxSend, iAudioSrc, iAudioDst); |
2478 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2479 |
} |
} |
2480 |
|
|
2491 |
* |
* |
2492 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2493 |
*/ |
*/ |
2494 |
lscp_status_t lscp_set_fxsend_midi_controller ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iMidiController ) |
lscp_status_t lscp_set_fxsend_midi_controller ( lscp_client_t *pClient, |
2495 |
|
int iSamplerChannel, int iFxSend, int iMidiController ) |
2496 |
{ |
{ |
2497 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2498 |
|
|
2499 |
if (iSamplerChannel < 0 || iFxSend < 0 || iMidiController < 0 || iMidiController > 127) |
if (iSamplerChannel < 0 || iFxSend < 0 || |
2500 |
|
iMidiController < 0 || iMidiController > 127) |
2501 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2502 |
|
|
2503 |
sprintf(szQuery, "SET FX_SEND MIDI_CONTROLLER %d %d %d\r\n", iSamplerChannel, iFxSend, iMidiController); |
sprintf(szQuery, "SET FX_SEND MIDI_CONTROLLER %d %d %d\r\n", |
2504 |
|
iSamplerChannel, iFxSend, iMidiController); |
2505 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2506 |
} |
} |
2507 |
|
|
2517 |
* |
* |
2518 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2519 |
*/ |
*/ |
2520 |
lscp_status_t lscp_set_fxsend_level ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, float fLevel ) |
lscp_status_t lscp_set_fxsend_level ( lscp_client_t *pClient, |
2521 |
|
int iSamplerChannel, int iFxSend, float fLevel ) |
2522 |
{ |
{ |
2523 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2524 |
struct _locale_t locale; |
struct _locale_t locale; |
2527 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2528 |
|
|
2529 |
_save_and_set_c_locale(&locale); |
_save_and_set_c_locale(&locale); |
2530 |
sprintf(szQuery, "SET FX_SEND LEVEL %d %d %f\r\n", iSamplerChannel, iFxSend, fLevel); |
sprintf(szQuery, "SET FX_SEND LEVEL %d %d %f\r\n", |
2531 |
|
iSamplerChannel, iFxSend, fLevel); |
2532 |
_restore_locale(&locale); |
_restore_locale(&locale); |
2533 |
|
|
2534 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2759 |
* |
* |
2760 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2761 |
*/ |
*/ |
2762 |
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 ) |
lscp_status_t lscp_map_midi_instrument ( lscp_client_t *pClient, |
2763 |
|
lscp_midi_instrument_t *pMidiInstr, const char *pszEngineName, |
2764 |
|
const char *pszFileName, int iInstrIndex, float fVolume, |
2765 |
|
lscp_load_mode_t load_mode, const char *pszName ) |
2766 |
{ |
{ |
2767 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2768 |
struct _locale_t locale; |
struct _locale_t locale; |
2818 |
* |
* |
2819 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2820 |
*/ |
*/ |
2821 |
lscp_status_t lscp_unmap_midi_instrument ( lscp_client_t *pClient, lscp_midi_instrument_t *pMidiInstr ) |
lscp_status_t lscp_unmap_midi_instrument ( lscp_client_t *pClient, |
2822 |
|
lscp_midi_instrument_t *pMidiInstr ) |
2823 |
{ |
{ |
2824 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2825 |
|
|
2912 |
strcat(szQuery, "\r\n"); |
strcat(szQuery, "\r\n"); |
2913 |
|
|
2914 |
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
2915 |
pClient->midi_instruments = lscp_midi_instruments_create(lscp_client_get_result(pClient)); |
pClient->midi_instruments = lscp_midi_instruments_create( |
2916 |
|
lscp_client_get_result(pClient)); |
2917 |
|
|
2918 |
// Unlock this section down. |
// Unlock this section down. |
2919 |
lscp_mutex_unlock(pClient->mutex); |
lscp_mutex_unlock(pClient->mutex); |
2933 |
* with all the information of the given MIDI instrument map entry, |
* with all the information of the given MIDI instrument map entry, |
2934 |
* or NULL in case of failure. |
* or NULL in case of failure. |
2935 |
*/ |
*/ |
2936 |
lscp_midi_instrument_info_t *lscp_get_midi_instrument_info ( lscp_client_t *pClient, lscp_midi_instrument_t *pMidiInstr ) |
lscp_midi_instrument_info_t *lscp_get_midi_instrument_info ( lscp_client_t *pClient, |
2937 |
|
lscp_midi_instrument_t *pMidiInstr ) |
2938 |
{ |
{ |
2939 |
lscp_midi_instrument_info_t *pInstrInfo; |
lscp_midi_instrument_info_t *pInstrInfo; |
2940 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
3053 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
3054 |
} |
} |
3055 |
|
|
3056 |
|
|
3057 |
/** |
/** |
3058 |
* Open an instrument editor application for the instrument |
* Open an instrument editor application for the instrument |
3059 |
* on the given sampler channel: |
* on the given sampler channel: |