/[svn]/liblscp/trunk/src/client.c
ViewVC logotype

Diff of /liblscp/trunk/src/client.c

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

revision 1806 by schoenebeck, Thu Dec 11 01:28:42 2008 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-2008, 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 22  Line 22 
22    
23  #include <locale.h>  #include <locale.h>
24  #include "common.h"  #include "common.h"
25    #include <sys/time.h>
26    #include <sys/errno.h>
27    
28  // Default timeout value (in milliseconds).  // Default timeout value (in milliseconds).
29  #define LSCP_TIMEOUT_MSECS  500  #define LSCP_TIMEOUT_MSECS  500
30    
31    
32    // Whether to use getaddrinfo() instead
33    // of deprecated gethostbyname()
34    #if !defined(WIN32)
35    #define USE_GETADDRINFO 1
36    #endif
37    
38    
39  // Local prototypes.  // Local prototypes.
40    
41  static void             _lscp_client_evt_proc       (void *pvClient);  static void _lscp_client_evt_proc (void *pvClient);
42    
43  static lscp_status_t    _lscp_client_evt_connect    (lscp_client_t *pClient);  static lscp_status_t _lscp_client_evt_connect (lscp_client_t *pClient);
44  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,
45            int iSubscribe, lscp_event_t event);
46    
47    
48  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 86  static void _lscp_client_evt_proc ( void Line 96  static void _lscp_client_evt_proc ( void
96          char   achBuffer[LSCP_BUFSIZ];          char   achBuffer[LSCP_BUFSIZ];
97          int    cchBuffer;          int    cchBuffer;
98          const char *pszSeps = ":\r\n";          const char *pszSeps = ":\r\n";
99          char * pszToken;          char  *pszToken;
100          char * pch;          char  *pch;
101          int     cchToken;          int    cchToken;
102    
103          lscp_event_t event;          lscp_event_t event;
104    
105  #ifdef DEBUG  #ifdef DEBUG
# Line 147  static void _lscp_client_evt_proc ( void Line 158  static void _lscp_client_evt_proc ( void
158                          } else {                          } else {
159                                  lscp_socket_perror("_lscp_client_evt_proc: recv");                                  lscp_socket_perror("_lscp_client_evt_proc: recv");
160                                  pClient->evt.iState = 0;                                  pClient->evt.iState = 0;
161                                    pClient->iErrno = -errno;
162                          }                          }
163                  }   // Check if select has in error.                  }   // Check if select has in error.
164                  else if (iSelect < 0) {                  else if (iSelect < 0) {
165                          lscp_socket_perror("_lscp_client_evt_proc: select");                          lscp_socket_perror("_lscp_client_evt_proc: select");
166                          pClient->evt.iState = 0;                          pClient->evt.iState = 0;
167                            pClient->iErrno = -errno;
168                  }                  }
169    
170                  // Finally, always signal the event.                  // Finally, always signal the event.
# Line 185  static lscp_status_t _lscp_client_evt_co Line 198  static lscp_status_t _lscp_client_evt_co
198          }          }
199    
200  #if defined(WIN32)  #if defined(WIN32)
201          if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)          if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER,
202                            (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)
203                  lscp_socket_perror("lscp_client_evt_connect: setsockopt(SO_DONTLINGER)");                  lscp_socket_perror("lscp_client_evt_connect: setsockopt(SO_DONTLINGER)");
204  #endif  #endif
205    
# Line 213  static lscp_status_t _lscp_client_evt_co Line 227  static lscp_status_t _lscp_client_evt_co
227    
228    
229  // Subscribe to a single event.  // Subscribe to a single event.
230  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,
231            int iSubscribe, lscp_event_t event )
232  {  {
233          const char *pszEvent;          const char *pszEvent;
234          char  szQuery[LSCP_BUFSIZ];          char  szQuery[LSCP_BUFSIZ];
# Line 228  static lscp_status_t _lscp_client_evt_re Line 243  static lscp_status_t _lscp_client_evt_re
243                  return LSCP_FAILED;                  return LSCP_FAILED;
244    
245          // Build the query string...          // Build the query string...
246          cchQuery = sprintf(szQuery, "%sSUBSCRIBE %s\n\n", (iSubscribe == 0 ? "UN" : ""), pszEvent);          cchQuery = sprintf(szQuery, "%sSUBSCRIBE %s\n\n",
247                    (iSubscribe == 0 ? "UN" : ""), pszEvent);
248          // Just send data, forget result...          // Just send data, forget result...
249          if (send(pClient->evt.sock, szQuery, cchQuery, 0) < cchQuery) {          if (send(pClient->evt.sock, szQuery, cchQuery, 0) < cchQuery) {
250                  lscp_socket_perror("_lscp_client_evt_request: send");                  lscp_socket_perror("_lscp_client_evt_request: send");
# Line 258  const char* lscp_client_package (void) { Line 274  const char* lscp_client_package (void) {
274  /** Retrieve the current client library version string. */  /** Retrieve the current client library version string. */
275  const char* lscp_client_version (void) { return LSCP_VERSION; }  const char* lscp_client_version (void) { return LSCP_VERSION; }
276    
277  /** Retrieve the current client library build timestamp string. */  /** Retrieve the current client library build string. */
278  const char* lscp_client_build   (void) { return __DATE__ " " __TIME__; }  const char* lscp_client_build   (void) { return LSCP_BUILD; }
279    
280    
281  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 279  const char* lscp_client_build   (void) { Line 295  const char* lscp_client_build   (void) {
295   *  @returns The new client instance pointer if successfull, which shall be   *  @returns The new client instance pointer if successfull, which shall be
296   *  used on all subsequent client calls, NULL otherwise.   *  used on all subsequent client calls, NULL otherwise.
297   */   */
298  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,
299            lscp_client_proc_t pfnCallback, void *pvData )
300  {  {
301          lscp_client_t  *pClient;          lscp_client_t  *pClient;
302    #if defined(USE_GETADDRINFO)
303            char szPort[33];
304            struct addrinfo hints;
305            struct addrinfo *result, *res;
306    #else
307          struct hostent *pHost;          struct hostent *pHost;
         lscp_socket_t sock;  
308          struct sockaddr_in addr;          struct sockaddr_in addr;
309          int cAddr;          int cAddr;
310    #endif  /* !USE_GETADDRINFO */
311            lscp_socket_t sock;
312  #if defined(WIN32)  #if defined(WIN32)
313          int iSockOpt = (-1);          int iSockOpt = (-1);
314  #endif  #endif
# Line 295  lscp_client_t* lscp_client_create ( cons Line 318  lscp_client_t* lscp_client_create ( cons
318                  return NULL;                  return NULL;
319          }          }
320    
321    #if defined(USE_GETADDRINFO)
322    
323            // Convert port number to string/name...
324            snprintf(szPort, sizeof(szPort), "%d", iPort);
325    
326            // Obtain address(es) matching host/port...
327            memset(&hints, 0, sizeof(struct addrinfo));
328            hints.ai_family = AF_INET;
329            hints.ai_socktype = SOCK_STREAM;
330    
331            result = NULL;
332    
333            if (getaddrinfo(pszHost, szPort, &hints, &result)) {
334                    lscp_socket_herror("lscp_client_create: getaddrinfo");
335                    return NULL;
336            }
337    
338    #else
339    
340            // Obtain host matching name...
341          pHost = gethostbyname(pszHost);          pHost = gethostbyname(pszHost);
342          if (pHost == NULL) {          if (pHost == NULL) {
343                  lscp_socket_herror("lscp_client_create: gethostbyname");                  lscp_socket_herror("lscp_client_create: gethostbyname");
344                  return NULL;                  return NULL;
345          }          }
346    
347    #endif  /* !USE_GETADDRINFO */
348    
349          // Allocate client descriptor...          // Allocate client descriptor...
350    
351          pClient = (lscp_client_t *) malloc(sizeof(lscp_client_t));          pClient = (lscp_client_t *) malloc(sizeof(lscp_client_t));
# Line 314  lscp_client_t* lscp_client_create ( cons Line 359  lscp_client_t* lscp_client_create ( cons
359          pClient->pvData = pvData;          pClient->pvData = pvData;
360    
361  #ifdef DEBUG  #ifdef DEBUG
362          fprintf(stderr, "lscp_client_create: pClient=%p: pszHost=%s iPort=%d.\n", pClient, pszHost, iPort);          fprintf(stderr,
363                    "lscp_client_create: pClient=%p: pszHost=%s iPort=%d.\n",
364                     pClient, pszHost, iPort);
365  #endif  #endif
366    
367          // Prepare the command connection socket...          // Prepare the command connection socket...
368    
369    #if defined(USE_GETADDRINFO)
370    
371            // getaddrinfo() returns a list of address structures;
372            // try each address until we successfully connect(2);
373            // if socket or connect fails, we close the socket and
374            // try the next address...
375            sock = INVALID_SOCKET;
376    
377            for (res = result; res; res = res->ai_next) {
378                    sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
379                    if (sock == INVALID_SOCKET)
380                            continue;
381            #if defined(WIN32)
382                    if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER,
383                                    (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)
384                            lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)");
385            #endif
386            #ifdef DEBUG
387                    lscp_socket_getopts("lscp_client_create: cmd", sock);
388            #endif
389                    if (connect(sock, res->ai_addr, res->ai_addrlen) != SOCKET_ERROR)
390                            break;
391                    closesocket(sock);
392            }
393    
394            if (sock == INVALID_SOCKET) {
395                    lscp_socket_perror("lscp_client_create: cmd: socket");
396                    free(pClient);
397                    return NULL;
398            }
399    
400            if (res == NULL) {
401                    lscp_socket_perror("lscp_client_create: cmd: connect");
402                    free(pClient);
403                    return NULL;
404            }
405    
406            // Initialize the command socket agent struct...
407            lscp_socket_agent_init(&(pClient->cmd), sock,
408                    (struct sockaddr_in *) res->ai_addr, res->ai_addrlen);
409    
410            // No longer needed...
411            freeaddrinfo(result);
412    
413    #else
414    
415          sock = socket(AF_INET, SOCK_STREAM, 0);          sock = socket(AF_INET, SOCK_STREAM, 0);
416          if (sock == INVALID_SOCKET) {          if (sock == INVALID_SOCKET) {
417                  lscp_socket_perror("lscp_client_create: cmd: socket");                  lscp_socket_perror("lscp_client_create: cmd: socket");
# Line 327  lscp_client_t* lscp_client_create ( cons Line 420  lscp_client_t* lscp_client_create ( cons
420          }          }
421    
422  #if defined(WIN32)  #if defined(WIN32)
423          if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)          if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER,
424                            (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)
425                  lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)");                  lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)");
426  #endif  #endif
427    
# Line 351  lscp_client_t* lscp_client_create ( cons Line 445  lscp_client_t* lscp_client_create ( cons
445          // Initialize the command socket agent struct...          // Initialize the command socket agent struct...
446          lscp_socket_agent_init(&(pClient->cmd), sock, &addr, cAddr);          lscp_socket_agent_init(&(pClient->cmd), sock, &addr, cAddr);
447    
448    #endif  /* !USE_GETADDRINFO */
449    
450  #ifdef DEBUG  #ifdef DEBUG
451          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,
452                    "lscp_client_create: cmd: pClient=%p: sock=%d addr=%s port=%d.\n",
453                    pClient, pClient->cmd.sock,
454                    inet_ntoa(pClient->cmd.addr.sin_addr),
455                    ntohs(pClient->cmd.addr.sin_port));
456  #endif  #endif
457    
458          // Initialize the event service socket struct...          // Initialize the event service socket struct...
# Line 542  int lscp_client_get_timeout ( lscp_clien Line 642  int lscp_client_get_timeout ( lscp_clien
642          return pClient->iTimeout;          return pClient->iTimeout;
643  }  }
644    
645    /**
646     *  Check whether connection to server is lost.
647     *
648     *  @param pClient  Pointer to client instance structure.
649     *
650     *  @returns @c true if client lost connection to server, @c false otherwise.
651     */
652    bool lscp_client_connection_lost ( lscp_client_t *pClient )
653    {
654        int err = lscp_client_get_errno(pClient);
655        if (err >= 0) return false;
656        return err == -EPIPE || err == -ECONNRESET || err == -ECONNABORTED;
657    }
658    
659    
660  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
661  // Client common protocol functions.  // Client common protocol functions.
# Line 837  lscp_event_t lscp_client_get_events ( ls Line 951  lscp_event_t lscp_client_get_events ( ls
951   *   *
952   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
953   */   */
954  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,
955            const char *pszFileName, int iInstrIndex, int iSamplerChannel )
956  {  {
957          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
958    
959          if (pszFileName == NULL || iSamplerChannel < 0)          if (pszFileName == NULL || iSamplerChannel < 0)
960                  return LSCP_FAILED;                  return LSCP_FAILED;
961    
962          sprintf(szQuery, "LOAD INSTRUMENT '%s' %d %d\r\n", pszFileName, iInstrIndex, iSamplerChannel);          sprintf(szQuery, "LOAD INSTRUMENT '%s' %d %d\r\n",
963                    pszFileName, iInstrIndex, iSamplerChannel);
964          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
965  }  }
966    
# Line 860  lscp_status_t lscp_load_instrument ( lsc Line 976  lscp_status_t lscp_load_instrument ( lsc
976   *   *
977   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
978   */   */
979  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,
980            const char *pszFileName, int iInstrIndex, int iSamplerChannel )
981  {  {
982          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
983    
984          if (pszFileName == NULL || iSamplerChannel < 0)          if (pszFileName == NULL || iSamplerChannel < 0)
985                  return LSCP_FAILED;                  return LSCP_FAILED;
986    
987          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",
988                    pszFileName, iInstrIndex, iSamplerChannel);
989          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
990  }  }
991    
# Line 889  lscp_status_t lscp_load_engine ( lscp_cl Line 1007  lscp_status_t lscp_load_engine ( lscp_cl
1007          if (pszEngineName == NULL || iSamplerChannel < 0)          if (pszEngineName == NULL || iSamplerChannel < 0)
1008                  return LSCP_FAILED;                  return LSCP_FAILED;
1009    
1010          sprintf(szQuery, "LOAD ENGINE %s %d\r\n", pszEngineName, iSamplerChannel);          sprintf(szQuery, "LOAD ENGINE %s %d\r\n",
1011                    pszEngineName, iSamplerChannel);
1012          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1013  }  }
1014    
# Line 1080  const char **lscp_list_available_engines Line 1199  const char **lscp_list_available_engines
1199   *  @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
1200   *  information of the given sampler engine, or NULL in case of failure.   *  information of the given sampler engine, or NULL in case of failure.
1201   */   */
1202  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,
1203            const char *pszEngineName )
1204  {  {
1205          lscp_engine_info_t *pEngineInfo;          lscp_engine_info_t *pEngineInfo;
1206          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 1408  int lscp_get_channel_stream_usage ( lscp Line 1528  int lscp_get_channel_stream_usage ( lscp
1528   *  information of the current disk stream buffer fill usage, for the given   *  information of the current disk stream buffer fill usage, for the given
1529   *  sampler channel, or NULL in case of failure.   *  sampler channel, or NULL in case of failure.
1530   */   */
1531  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,
1532            lscp_usage_t usage_type, int iSamplerChannel )
1533  {  {
1534          lscp_buffer_fill_t *pBufferFill;          lscp_buffer_fill_t *pBufferFill;
1535          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 1481  lscp_buffer_fill_t *lscp_get_channel_buf Line 1602  lscp_buffer_fill_t *lscp_get_channel_buf
1602   *   *
1603   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1604   */   */
1605  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,
1606            int iSamplerChannel, const char *pszAudioDriver )
1607  {  {
1608          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1609    
1610          if (iSamplerChannel < 0 || pszAudioDriver == NULL)          if (iSamplerChannel < 0 || pszAudioDriver == NULL)
1611                  return LSCP_FAILED;                  return LSCP_FAILED;
1612    
1613          sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_TYPE %d %s\r\n", iSamplerChannel, pszAudioDriver);          sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_TYPE %d %s\r\n",
1614                    iSamplerChannel, pszAudioDriver);
1615          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1616  }  }
1617    
# Line 1503  lscp_status_t lscp_set_channel_audio_typ Line 1626  lscp_status_t lscp_set_channel_audio_typ
1626   *   *
1627   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1628   */   */
1629  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,
1630            int iSamplerChannel, int iAudioDevice )
1631  {  {
1632          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1633    
1634          if (iSamplerChannel < 0 || iAudioDevice < 0)          if (iSamplerChannel < 0 || iAudioDevice < 0)
1635                  return LSCP_FAILED;                  return LSCP_FAILED;
1636    
1637          sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_DEVICE %d %d\r\n", iSamplerChannel, iAudioDevice);          sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_DEVICE %d %d\r\n",
1638                    iSamplerChannel, iAudioDevice);
1639          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1640  }  }
1641    
# Line 1526  lscp_status_t lscp_set_channel_audio_dev Line 1651  lscp_status_t lscp_set_channel_audio_dev
1651   *   *
1652   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1653   */   */
1654  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,
1655            int iSamplerChannel, int iAudioOut, int iAudioIn )
1656  {  {
1657          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1658    
1659          if (iSamplerChannel < 0 || iAudioOut < 0 || iAudioIn < 0)          if (iSamplerChannel < 0 || iAudioOut < 0 || iAudioIn < 0)
1660                  return LSCP_FAILED;                  return LSCP_FAILED;
1661    
1662          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",
1663                    iSamplerChannel, iAudioOut, iAudioIn);
1664          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1665  }  }
1666    
# Line 1548  lscp_status_t lscp_set_channel_audio_cha Line 1675  lscp_status_t lscp_set_channel_audio_cha
1675   *   *
1676   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1677   */   */
1678  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,
1679            int iSamplerChannel, const char *pszMidiDriver )
1680  {  {
1681          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1682    
1683          if (iSamplerChannel < 0 || pszMidiDriver == NULL)          if (iSamplerChannel < 0 || pszMidiDriver == NULL)
1684                  return LSCP_FAILED;                  return LSCP_FAILED;
1685    
1686          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_TYPE %d %s\r\n", iSamplerChannel, pszMidiDriver);          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_TYPE %d %s\r\n",
1687                    iSamplerChannel, pszMidiDriver);
1688          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1689  }  }
1690    
# Line 1570  lscp_status_t lscp_set_channel_midi_type Line 1699  lscp_status_t lscp_set_channel_midi_type
1699   *   *
1700   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1701   */   */
1702  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,
1703            int iSamplerChannel, int iMidiDevice )
1704  {  {
1705          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1706    
1707          if (iSamplerChannel < 0 || iMidiDevice < 0)          if (iSamplerChannel < 0 || iMidiDevice < 0)
1708                  return LSCP_FAILED;                  return LSCP_FAILED;
1709    
1710          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_DEVICE %d %d\r\n", iSamplerChannel, iMidiDevice);          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_DEVICE %d %d\r\n",
1711                    iSamplerChannel, iMidiDevice);
1712          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1713  }  }
1714    
# Line 1592  lscp_status_t lscp_set_channel_midi_devi Line 1723  lscp_status_t lscp_set_channel_midi_devi
1723   *   *
1724   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1725   */   */
1726  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,
1727            int iSamplerChannel, int iMidiPort )
1728  {  {
1729          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1730    
1731          if (iSamplerChannel < 0 || iMidiPort < 0)          if (iSamplerChannel < 0 || iMidiPort < 0)
1732                  return LSCP_FAILED;                  return LSCP_FAILED;
1733    
1734          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_PORT %d %d\r\n", iSamplerChannel, iMidiPort);          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_PORT %d %d\r\n",
1735                    iSamplerChannel, iMidiPort);
1736          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1737  }  }
1738    
# Line 1615  lscp_status_t lscp_set_channel_midi_port Line 1748  lscp_status_t lscp_set_channel_midi_port
1748   *   *
1749   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1750   */   */
1751  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,
1752            int iSamplerChannel, int iMidiChannel )
1753  {  {
1754          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1755    
# Line 1623  lscp_status_t lscp_set_channel_midi_chan Line 1757  lscp_status_t lscp_set_channel_midi_chan
1757                  return LSCP_FAILED;                  return LSCP_FAILED;
1758    
1759          if (iMidiChannel == LSCP_MIDI_CHANNEL_ALL)          if (iMidiChannel == LSCP_MIDI_CHANNEL_ALL)
1760                  sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n", iSamplerChannel);                  sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n",
1761                            iSamplerChannel);
1762          else          else
1763                  sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n", iSamplerChannel, iMidiChannel);                  sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n",
1764                            iSamplerChannel, iMidiChannel);
1765          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1766  }  }
1767    
# Line 1642  lscp_status_t lscp_set_channel_midi_chan Line 1778  lscp_status_t lscp_set_channel_midi_chan
1778   *   *
1779   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1780   */   */
1781  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,
1782            int iSamplerChannel, int iMidiMap )
1783  {  {
1784          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1785    
# Line 1676  lscp_status_t lscp_set_channel_midi_map Line 1813  lscp_status_t lscp_set_channel_midi_map
1813   *   *
1814   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1815   */   */
1816  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,
1817            int iSamplerChannel, float fVolume )
1818  {  {
1819          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1820          struct _locale_t locale;          struct _locale_t locale;
# Line 1685  lscp_status_t lscp_set_channel_volume ( Line 1823  lscp_status_t lscp_set_channel_volume (
1823                  return LSCP_FAILED;                  return LSCP_FAILED;
1824    
1825          _save_and_set_c_locale(&locale);          _save_and_set_c_locale(&locale);
1826          sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n", iSamplerChannel, fVolume);          sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n",
1827                    iSamplerChannel, fVolume);
1828          _restore_locale(&locale);          _restore_locale(&locale);
1829    
1830          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
# Line 1704  lscp_status_t lscp_set_channel_volume ( Line 1843  lscp_status_t lscp_set_channel_volume (
1843   *   *
1844   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1845   */   */
1846  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,
1847            int iSamplerChannel, int iMute )
1848  {  {
1849          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1850    
1851          if (iSamplerChannel < 0 || iMute < 0 || iMute > 1)          if (iSamplerChannel < 0 || iMute < 0 || iMute > 1)
1852                  return LSCP_FAILED;                  return LSCP_FAILED;
1853    
1854          sprintf(szQuery, "SET CHANNEL MUTE %d %d\r\n", iSamplerChannel, iMute);          sprintf(szQuery, "SET CHANNEL MUTE %d %d\r\n",
1855                    iSamplerChannel, iMute);
1856          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1857  }  }
1858    
# Line 1728  lscp_status_t lscp_set_channel_mute ( ls Line 1869  lscp_status_t lscp_set_channel_mute ( ls
1869   *   *
1870   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1871   */   */
1872  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,
1873            int iSamplerChannel, int iSolo )
1874  {  {
1875          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1876    
1877          if (iSamplerChannel < 0 || iSolo < 0 || iSolo > 1)          if (iSamplerChannel < 0 || iSolo < 0 || iSolo > 1)
1878                  return LSCP_FAILED;                  return LSCP_FAILED;
1879    
1880          sprintf(szQuery, "SET CHANNEL SOLO %d %d\r\n", iSamplerChannel, iSolo);          sprintf(szQuery, "SET CHANNEL SOLO %d %d\r\n",
1881                    iSamplerChannel, iSolo);
1882          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1883  }  }
1884    
# Line 1952  lscp_status_t lscp_set_volume ( lscp_cli Line 2095  lscp_status_t lscp_set_volume ( lscp_cli
2095          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2096  }  }
2097    
2098    
2099  /**  /**
2100   *  Get global voice limit setting:   *  Get global voice limit setting:
2101   *  @code   *  @code
# Line 1966  lscp_status_t lscp_set_volume ( lscp_cli Line 2110  lscp_status_t lscp_set_volume ( lscp_cli
2110   *           negative value on error (e.g. if sampler doesn't support   *           negative value on error (e.g. if sampler doesn't support
2111   *           this command).   *           this command).
2112   */   */
2113  int lscp_get_voices(lscp_client_t *pClient)  int lscp_get_voices ( lscp_client_t *pClient )
2114  {  {
2115          int iVoices = -1;          int iVoices = -1;
2116    
# Line 1985  int lscp_get_voices(lscp_client_t *pClie Line 2129  int lscp_get_voices(lscp_client_t *pClie
2129          return iVoices;          return iVoices;
2130  }  }
2131    
2132    
2133  /**  /**
2134   *  Setting global voice limit setting:   *  Setting global voice limit setting:
2135   *  @code   *  @code
# Line 2003  int lscp_get_voices(lscp_client_t *pClie Line 2148  int lscp_get_voices(lscp_client_t *pClie
2148   *   *
2149   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2150   */   */
2151  lscp_status_t lscp_set_voices(lscp_client_t *pClient, int iMaxVoices)  lscp_status_t lscp_set_voices ( lscp_client_t *pClient, int iMaxVoices )
2152  {  {
2153          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2154    
# Line 2014  lscp_status_t lscp_set_voices(lscp_clien Line 2159  lscp_status_t lscp_set_voices(lscp_clien
2159          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2160  }  }
2161    
2162    
2163  /**  /**
2164   *  Get global disk streams limit setting:   *  Get global disk streams limit setting:
2165   *  @code   *  @code
# Line 2028  lscp_status_t lscp_set_voices(lscp_clien Line 2174  lscp_status_t lscp_set_voices(lscp_clien
2174   *           or a negative value on error (e.g. if sampler doesn't   *           or a negative value on error (e.g. if sampler doesn't
2175   *           support this command).   *           support this command).
2176   */   */
2177  int lscp_get_streams(lscp_client_t *pClient)  int lscp_get_streams ( lscp_client_t *pClient )
2178  {  {
2179          int iStreams = -1;          int iStreams = -1;
2180    
# Line 2047  int lscp_get_streams(lscp_client_t *pCli Line 2193  int lscp_get_streams(lscp_client_t *pCli
2193          return iStreams;          return iStreams;
2194  }  }
2195    
2196    
2197  /**  /**
2198   *  Setting global disk streams limit setting:   *  Setting global disk streams limit setting:
2199   *  @code   *  @code
# Line 2065  int lscp_get_streams(lscp_client_t *pCli Line 2212  int lscp_get_streams(lscp_client_t *pCli
2212   *   *
2213   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2214   */   */
2215  lscp_status_t lscp_set_streams(lscp_client_t *pClient, int iMaxStreams)  lscp_status_t lscp_set_streams ( lscp_client_t *pClient, int iMaxStreams )
2216  {  {
2217          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2218    
# Line 2076  lscp_status_t lscp_set_streams(lscp_clie Line 2223  lscp_status_t lscp_set_streams(lscp_clie
2223          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2224  }  }
2225    
2226    
2227  /**  /**
2228   *  Add an effect send to a sampler channel:   *  Add an effect send to a sampler channel:
2229   *  CREATE FX_SEND <sampler-channel> <midi-ctrl> [<name>]   *  CREATE FX_SEND <sampler-channel> <midi-ctrl> [<fx-name>]
2230   *   *
2231   *  @param pClient          Pointer to client instance structure.   *  @param pClient          Pointer to client instance structure.
2232   *  @param iSamplerChannel  Sampler channel number.   *  @param iSamplerChannel  Sampler channel number.
2233   *  @param iMidiController  MIDI controller used to alter the effect,   *  @param iMidiController  MIDI controller used to alter the effect,
2234   *                          usually a number between 0 and 127.   *                          usually a number between 0 and 127.
2235   *  @param pszName          Optional name for the effect send entity,   *  @param pszFxName        Optional name for the effect send entity,
2236   *                          does not have to be unique.   *                          does not have to be unique.
2237   *   *
2238   *  @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.
2239   */   */
2240  int lscp_create_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iMidiController, const char *pszFxName )  int lscp_create_fxsend ( lscp_client_t *pClient,
2241            int iSamplerChannel, int iMidiController, const char *pszFxName )
2242  {  {
2243          int iFxSend = -1;          int iFxSend = -1;
2244          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 2102  int lscp_create_fxsend ( lscp_client_t * Line 2251  int lscp_create_fxsend ( lscp_client_t *
2251          // Lock this section up.          // Lock this section up.
2252          lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
2253    
2254          sprintf(szQuery, "CREATE FX_SEND %d %d", iSamplerChannel, iMidiController);          sprintf(szQuery, "CREATE FX_SEND %d %d",
2255                    iSamplerChannel, iMidiController);
2256    
2257          if (pszFxName)          if (pszFxName)
2258                  sprintf(szQuery + strlen(szQuery), " '%s'", pszFxName);                  sprintf(szQuery + strlen(szQuery), " '%s'", pszFxName);
# Line 2129  int lscp_create_fxsend ( lscp_client_t * Line 2279  int lscp_create_fxsend ( lscp_client_t *
2279   *   *
2280   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2281   */   */
2282  lscp_status_t lscp_destroy_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend )  lscp_status_t lscp_destroy_fxsend ( lscp_client_t *pClient,
2283            int iSamplerChannel, int iFxSend )
2284  {  {
2285          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2286    
2287          if (iSamplerChannel < 0 || iFxSend < 0)          if (iSamplerChannel < 0 || iFxSend < 0)
2288                  return LSCP_FAILED;                  return LSCP_FAILED;
2289    
2290          sprintf(szQuery, "DESTROY FX_SEND %d %d\r\n", iSamplerChannel, iFxSend);          sprintf(szQuery, "DESTROY FX_SEND %d %d\r\n",
2291                    iSamplerChannel, iFxSend);
2292    
2293          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2294  }  }
# Line 2226  int *lscp_list_fxsends ( lscp_client_t * Line 2378  int *lscp_list_fxsends ( lscp_client_t *
2378   *  @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
2379   *  information of the given FX send, or NULL in case of failure.   *  information of the given FX send, or NULL in case of failure.
2380   */   */
2381  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,
2382            int iSamplerChannel, int iFxSend )
2383  {  {
2384          lscp_fxsend_info_t *pFxSendInfo;          lscp_fxsend_info_t *pFxSendInfo;
2385          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 2291  lscp_fxsend_info_t *lscp_get_fxsend_info Line 2444  lscp_fxsend_info_t *lscp_get_fxsend_info
2444          return pFxSendInfo;          return pFxSendInfo;
2445  }  }
2446    
2447    
2448  /**  /**
2449   *  Alter effect send's name:   *  Alter effect send's name:
2450   *  @code   *  @code
# Line 2304  lscp_fxsend_info_t *lscp_get_fxsend_info Line 2458  lscp_fxsend_info_t *lscp_get_fxsend_info
2458   *   *
2459   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2460   */   */
2461  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,
2462            int iSamplerChannel, int iFxSend, const char *pszFxName )
2463  {  {
2464          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2465    
2466          if (!pClient || iSamplerChannel < 0 || iFxSend < 0 || !pszFxName)          if (!pClient || iSamplerChannel < 0 || iFxSend < 0 || !pszFxName)
2467                  return LSCP_FAILED;                  return LSCP_FAILED;
2468    
2469          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",
2470                    iSamplerChannel, iFxSend, pszFxName);
2471          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2472  }  }
2473    
2474    
2475  /**  /**
2476   *  Alter effect send's audio routing:   *  Alter effect send's audio routing:
2477   *  SET FX_SEND AUDIO_OUTPUT_CHANNEL <sampler-chan> <fx-send-id>   *  SET FX_SEND AUDIO_OUTPUT_CHANNEL <sampler-chan> <fx-send-id>
# Line 2328  lscp_status_t lscp_set_fxsend_name ( lsc Line 2485  lscp_status_t lscp_set_fxsend_name ( lsc
2485   *   *
2486   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2487   */   */
2488  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,
2489            int iSamplerChannel, int iFxSend, int iAudioSrc, int iAudioDst )
2490  {  {
2491          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2492    
2493          if (iSamplerChannel < 0 || iFxSend < 0 || iAudioSrc < 0 || iAudioDst < 0)          if (iSamplerChannel < 0 || iFxSend < 0 || iAudioSrc < 0 || iAudioDst < 0)
2494                  return LSCP_FAILED;                  return LSCP_FAILED;
2495    
2496          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",
2497                    iSamplerChannel, iFxSend, iAudioSrc, iAudioDst);
2498          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2499  }  }
2500    
# Line 2352  lscp_status_t lscp_set_fxsend_audio_chan Line 2511  lscp_status_t lscp_set_fxsend_audio_chan
2511   *   *
2512   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2513   */   */
2514  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,
2515            int iSamplerChannel, int iFxSend, int iMidiController )
2516  {  {
2517          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2518    
2519          if (iSamplerChannel < 0 || iFxSend < 0 || iMidiController < 0 || iMidiController > 127)          if (iSamplerChannel < 0 || iFxSend < 0 ||
2520                    iMidiController < 0 || iMidiController > 127)
2521                  return LSCP_FAILED;                  return LSCP_FAILED;
2522    
2523          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",
2524                    iSamplerChannel, iFxSend, iMidiController);
2525          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2526  }  }
2527    
# Line 2375  lscp_status_t lscp_set_fxsend_midi_contr Line 2537  lscp_status_t lscp_set_fxsend_midi_contr
2537   *   *
2538   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2539   */   */
2540  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,
2541            int iSamplerChannel, int iFxSend, float fLevel )
2542  {  {
2543          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2544          struct _locale_t locale;          struct _locale_t locale;
# Line 2384  lscp_status_t lscp_set_fxsend_level ( ls Line 2547  lscp_status_t lscp_set_fxsend_level ( ls
2547                  return LSCP_FAILED;                  return LSCP_FAILED;
2548    
2549          _save_and_set_c_locale(&locale);          _save_and_set_c_locale(&locale);
2550          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",
2551                    iSamplerChannel, iFxSend, fLevel);
2552          _restore_locale(&locale);          _restore_locale(&locale);
2553    
2554          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
# Line 2615  lscp_status_t lscp_set_midi_instrument_m Line 2779  lscp_status_t lscp_set_midi_instrument_m
2779   *   *
2780   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2781   */   */
2782  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,
2783            lscp_midi_instrument_t *pMidiInstr, const char *pszEngineName,
2784            const char *pszFileName, int iInstrIndex, float fVolume,
2785            lscp_load_mode_t load_mode, const char *pszName )
2786  {  {
2787          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2788          struct _locale_t locale;          struct _locale_t locale;
# Line 2671  lscp_status_t lscp_map_midi_instrument ( Line 2838  lscp_status_t lscp_map_midi_instrument (
2838   *   *
2839   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2840   */   */
2841  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,
2842            lscp_midi_instrument_t *pMidiInstr )
2843  {  {
2844          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2845    
# Line 2764  lscp_midi_instrument_t *lscp_list_midi_i Line 2932  lscp_midi_instrument_t *lscp_list_midi_i
2932          strcat(szQuery, "\r\n");          strcat(szQuery, "\r\n");
2933    
2934          if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK)          if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK)
2935                  pClient->midi_instruments = lscp_midi_instruments_create(lscp_client_get_result(pClient));                  pClient->midi_instruments = lscp_midi_instruments_create(
2936                            lscp_client_get_result(pClient));
2937    
2938          // Unlock this section down.          // Unlock this section down.
2939          lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
# Line 2784  lscp_midi_instrument_t *lscp_list_midi_i Line 2953  lscp_midi_instrument_t *lscp_list_midi_i
2953   *  with all the information of the given MIDI instrument map entry,   *  with all the information of the given MIDI instrument map entry,
2954   *  or NULL in case of failure.   *  or NULL in case of failure.
2955   */   */
2956  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,
2957            lscp_midi_instrument_t *pMidiInstr )
2958  {  {
2959          lscp_midi_instrument_info_t *pInstrInfo;          lscp_midi_instrument_info_t *pInstrInfo;
2960          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 2903  lscp_status_t lscp_clear_midi_instrument Line 3073  lscp_status_t lscp_clear_midi_instrument
3073          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
3074  }  }
3075    
3076    
3077  /**  /**
3078   * Open an instrument editor application for the instrument   * Open an instrument editor application for the instrument
3079   * on the given sampler channel:   * on the given sampler channel:

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

  ViewVC Help
Powered by ViewVC