/[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 2424 by capela, Sun Feb 24 19:02:30 2013 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-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
# Line 27  Line 27 
27  #define LSCP_TIMEOUT_MSECS  500  #define LSCP_TIMEOUT_MSECS  500
28    
29    
30    // Whether to use getaddrinfo() instead
31    // of deprecated gethostbyname()
32    #if !defined(WIN32)
33    #define USE_GETADDRINFO 1
34    #endif
35    
36    
37  // Local prototypes.  // Local prototypes.
38    
39  static void             _lscp_client_evt_proc       (void *pvClient);  static void _lscp_client_evt_proc (void *pvClient);
40    
41  static lscp_status_t    _lscp_client_evt_connect    (lscp_client_t *pClient);  static lscp_status_t _lscp_client_evt_connect (lscp_client_t *pClient);
42  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,
43            int iSubscribe, lscp_event_t event);
44    
45    
46  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 86  static void _lscp_client_evt_proc ( void Line 94  static void _lscp_client_evt_proc ( void
94          char   achBuffer[LSCP_BUFSIZ];          char   achBuffer[LSCP_BUFSIZ];
95          int    cchBuffer;          int    cchBuffer;
96          const char *pszSeps = ":\r\n";          const char *pszSeps = ":\r\n";
97          char * pszToken;          char  *pszToken;
98          char * pch;          char  *pch;
99          int     cchToken;          int    cchToken;
100    
101          lscp_event_t event;          lscp_event_t event;
102    
103  #ifdef DEBUG  #ifdef DEBUG
# Line 185  static lscp_status_t _lscp_client_evt_co Line 194  static lscp_status_t _lscp_client_evt_co
194          }          }
195    
196  #if defined(WIN32)  #if defined(WIN32)
197          if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)          if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER,
198                            (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)
199                  lscp_socket_perror("lscp_client_evt_connect: setsockopt(SO_DONTLINGER)");                  lscp_socket_perror("lscp_client_evt_connect: setsockopt(SO_DONTLINGER)");
200  #endif  #endif
201    
# Line 213  static lscp_status_t _lscp_client_evt_co Line 223  static lscp_status_t _lscp_client_evt_co
223    
224    
225  // Subscribe to a single event.  // Subscribe to a single event.
226  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,
227            int iSubscribe, lscp_event_t event )
228  {  {
229          const char *pszEvent;          const char *pszEvent;
230          char  szQuery[LSCP_BUFSIZ];          char  szQuery[LSCP_BUFSIZ];
# Line 228  static lscp_status_t _lscp_client_evt_re Line 239  static lscp_status_t _lscp_client_evt_re
239                  return LSCP_FAILED;                  return LSCP_FAILED;
240    
241          // Build the query string...          // Build the query string...
242          cchQuery = sprintf(szQuery, "%sSUBSCRIBE %s\n\n", (iSubscribe == 0 ? "UN" : ""), pszEvent);          cchQuery = sprintf(szQuery, "%sSUBSCRIBE %s\n\n",
243                    (iSubscribe == 0 ? "UN" : ""), pszEvent);
244          // Just send data, forget result...          // Just send data, forget result...
245          if (send(pClient->evt.sock, szQuery, cchQuery, 0) < cchQuery) {          if (send(pClient->evt.sock, szQuery, cchQuery, 0) < cchQuery) {
246                  lscp_socket_perror("_lscp_client_evt_request: send");                  lscp_socket_perror("_lscp_client_evt_request: send");
# Line 279  const char* lscp_client_build   (void) { Line 291  const char* lscp_client_build   (void) {
291   *  @returns The new client instance pointer if successfull, which shall be   *  @returns The new client instance pointer if successfull, which shall be
292   *  used on all subsequent client calls, NULL otherwise.   *  used on all subsequent client calls, NULL otherwise.
293   */   */
294  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,
295            lscp_client_proc_t pfnCallback, void *pvData )
296  {  {
297          lscp_client_t  *pClient;          lscp_client_t  *pClient;
298    #if defined(USE_GETADDRINFO)
299            char szPort[33];
300            struct addrinfo hints;
301            struct addrinfo *result, *res;
302    #else
303          struct hostent *pHost;          struct hostent *pHost;
         lscp_socket_t sock;  
304          struct sockaddr_in addr;          struct sockaddr_in addr;
305          int cAddr;          int cAddr;
306    #endif  /* !USE_GETADDRINFO */
307            lscp_socket_t sock;
308  #if defined(WIN32)  #if defined(WIN32)
309          int iSockOpt = (-1);          int iSockOpt = (-1);
310  #endif  #endif
# Line 295  lscp_client_t* lscp_client_create ( cons Line 314  lscp_client_t* lscp_client_create ( cons
314                  return NULL;                  return NULL;
315          }          }
316    
317    #if defined(USE_GETADDRINFO)
318    
319            // Convert port number to string/name...
320            snprintf(szPort, sizeof(szPort), "%d", iPort);
321    
322            // Obtain address(es) matching host/port...
323            memset(&hints, 0, sizeof(struct addrinfo));
324            hints.ai_family = AF_INET;
325            hints.ai_socktype = SOCK_STREAM;
326    
327            result = NULL;
328    
329            if (getaddrinfo(pszHost, szPort, &hints, &result)) {
330                    lscp_socket_herror("lscp_client_create: getaddrinfo");
331                    return NULL;
332            }
333    
334    #else
335    
336            // Obtain host matching name...
337          pHost = gethostbyname(pszHost);          pHost = gethostbyname(pszHost);
338          if (pHost == NULL) {          if (pHost == NULL) {
339                  lscp_socket_herror("lscp_client_create: gethostbyname");                  lscp_socket_herror("lscp_client_create: gethostbyname");
340                  return NULL;                  return NULL;
341          }          }
342    
343    #endif  /* !USE_GETADDRINFO */
344    
345          // Allocate client descriptor...          // Allocate client descriptor...
346    
347          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 355  lscp_client_t* lscp_client_create ( cons
355          pClient->pvData = pvData;          pClient->pvData = pvData;
356    
357  #ifdef DEBUG  #ifdef DEBUG
358          fprintf(stderr, "lscp_client_create: pClient=%p: pszHost=%s iPort=%d.\n", pClient, pszHost, iPort);          fprintf(stderr,
359                    "lscp_client_create: pClient=%p: pszHost=%s iPort=%d.\n",
360                     pClient, pszHost, iPort);
361  #endif  #endif
362    
363          // Prepare the command connection socket...          // Prepare the command connection socket...
364    
365    #if defined(USE_GETADDRINFO)
366    
367            // getaddrinfo() returns a list of address structures;
368            // try each address until we successfully connect(2);
369            // if socket or connect fails, we close the socket and
370            // try the next address...
371            sock = INVALID_SOCKET;
372    
373            for (res = result; res; res = res->ai_next) {
374                    sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
375                    if (sock == INVALID_SOCKET)
376                            continue;
377            #if defined(WIN32)
378                    if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER,
379                                    (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)
380                            lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)");
381            #endif
382            #ifdef DEBUG
383                    lscp_socket_getopts("lscp_client_create: cmd", sock);
384            #endif
385                    if (connect(sock, res->ai_addr, res->ai_addrlen) != SOCKET_ERROR)
386                            break;
387                    closesocket(sock);
388            }
389    
390            if (sock == INVALID_SOCKET) {
391                    lscp_socket_perror("lscp_client_create: cmd: socket");
392                    free(pClient);
393                    return NULL;
394            }
395    
396            if (res == NULL) {
397                    lscp_socket_perror("lscp_client_create: cmd: connect");
398                    free(pClient);
399                    return NULL;
400            }
401    
402            // Initialize the command socket agent struct...
403            lscp_socket_agent_init(&(pClient->cmd), sock,
404                    (struct sockaddr_in *) res->ai_addr, res->ai_addrlen);
405    
406            // No longer needed...
407            freeaddrinfo(result);
408    
409    #else
410    
411          sock = socket(AF_INET, SOCK_STREAM, 0);          sock = socket(AF_INET, SOCK_STREAM, 0);
412          if (sock == INVALID_SOCKET) {          if (sock == INVALID_SOCKET) {
413                  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 416  lscp_client_t* lscp_client_create ( cons
416          }          }
417    
418  #if defined(WIN32)  #if defined(WIN32)
419          if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)          if (setsockopt(sock, SOL_SOCKET, SO_DONTLINGER,
420                            (char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR)
421                  lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)");                  lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)");
422  #endif  #endif
423    
# Line 351  lscp_client_t* lscp_client_create ( cons Line 441  lscp_client_t* lscp_client_create ( cons
441          // Initialize the command socket agent struct...          // Initialize the command socket agent struct...
442          lscp_socket_agent_init(&(pClient->cmd), sock, &addr, cAddr);          lscp_socket_agent_init(&(pClient->cmd), sock, &addr, cAddr);
443    
444    #endif  /* !USE_GETADDRINFO */
445    
446  #ifdef DEBUG  #ifdef DEBUG
447          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,
448                    "lscp_client_create: cmd: pClient=%p: sock=%d addr=%s port=%d.\n",
449                    pClient, pClient->cmd.sock,
450                    inet_ntoa(pClient->cmd.addr.sin_addr),
451                    ntohs(pClient->cmd.addr.sin_port));
452  #endif  #endif
453    
454          // Initialize the event service socket struct...          // Initialize the event service socket struct...
# Line 837  lscp_event_t lscp_client_get_events ( ls Line 933  lscp_event_t lscp_client_get_events ( ls
933   *   *
934   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
935   */   */
936  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,
937            const char *pszFileName, int iInstrIndex, int iSamplerChannel )
938  {  {
939          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
940    
941          if (pszFileName == NULL || iSamplerChannel < 0)          if (pszFileName == NULL || iSamplerChannel < 0)
942                  return LSCP_FAILED;                  return LSCP_FAILED;
943    
944          sprintf(szQuery, "LOAD INSTRUMENT '%s' %d %d\r\n", pszFileName, iInstrIndex, iSamplerChannel);          sprintf(szQuery, "LOAD INSTRUMENT '%s' %d %d\r\n",
945                    pszFileName, iInstrIndex, iSamplerChannel);
946          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
947  }  }
948    
# Line 860  lscp_status_t lscp_load_instrument ( lsc Line 958  lscp_status_t lscp_load_instrument ( lsc
958   *   *
959   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
960   */   */
961  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,
962            const char *pszFileName, int iInstrIndex, int iSamplerChannel )
963  {  {
964          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
965    
966          if (pszFileName == NULL || iSamplerChannel < 0)          if (pszFileName == NULL || iSamplerChannel < 0)
967                  return LSCP_FAILED;                  return LSCP_FAILED;
968    
969          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",
970                    pszFileName, iInstrIndex, iSamplerChannel);
971          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
972  }  }
973    
# Line 889  lscp_status_t lscp_load_engine ( lscp_cl Line 989  lscp_status_t lscp_load_engine ( lscp_cl
989          if (pszEngineName == NULL || iSamplerChannel < 0)          if (pszEngineName == NULL || iSamplerChannel < 0)
990                  return LSCP_FAILED;                  return LSCP_FAILED;
991    
992          sprintf(szQuery, "LOAD ENGINE %s %d\r\n", pszEngineName, iSamplerChannel);          sprintf(szQuery, "LOAD ENGINE %s %d\r\n",
993                    pszEngineName, iSamplerChannel);
994          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
995  }  }
996    
# Line 1080  const char **lscp_list_available_engines Line 1181  const char **lscp_list_available_engines
1181   *  @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
1182   *  information of the given sampler engine, or NULL in case of failure.   *  information of the given sampler engine, or NULL in case of failure.
1183   */   */
1184  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,
1185            const char *pszEngineName )
1186  {  {
1187          lscp_engine_info_t *pEngineInfo;          lscp_engine_info_t *pEngineInfo;
1188          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 1408  int lscp_get_channel_stream_usage ( lscp Line 1510  int lscp_get_channel_stream_usage ( lscp
1510   *  information of the current disk stream buffer fill usage, for the given   *  information of the current disk stream buffer fill usage, for the given
1511   *  sampler channel, or NULL in case of failure.   *  sampler channel, or NULL in case of failure.
1512   */   */
1513  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,
1514            lscp_usage_t usage_type, int iSamplerChannel )
1515  {  {
1516          lscp_buffer_fill_t *pBufferFill;          lscp_buffer_fill_t *pBufferFill;
1517          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 1481  lscp_buffer_fill_t *lscp_get_channel_buf Line 1584  lscp_buffer_fill_t *lscp_get_channel_buf
1584   *   *
1585   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1586   */   */
1587  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,
1588            int iSamplerChannel, const char *pszAudioDriver )
1589  {  {
1590          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1591    
1592          if (iSamplerChannel < 0 || pszAudioDriver == NULL)          if (iSamplerChannel < 0 || pszAudioDriver == NULL)
1593                  return LSCP_FAILED;                  return LSCP_FAILED;
1594    
1595          sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_TYPE %d %s\r\n", iSamplerChannel, pszAudioDriver);          sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_TYPE %d %s\r\n",
1596                    iSamplerChannel, pszAudioDriver);
1597          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1598  }  }
1599    
# Line 1503  lscp_status_t lscp_set_channel_audio_typ Line 1608  lscp_status_t lscp_set_channel_audio_typ
1608   *   *
1609   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1610   */   */
1611  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,
1612            int iSamplerChannel, int iAudioDevice )
1613  {  {
1614          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1615    
1616          if (iSamplerChannel < 0 || iAudioDevice < 0)          if (iSamplerChannel < 0 || iAudioDevice < 0)
1617                  return LSCP_FAILED;                  return LSCP_FAILED;
1618    
1619          sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_DEVICE %d %d\r\n", iSamplerChannel, iAudioDevice);          sprintf(szQuery, "SET CHANNEL AUDIO_OUTPUT_DEVICE %d %d\r\n",
1620                    iSamplerChannel, iAudioDevice);
1621          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1622  }  }
1623    
# Line 1526  lscp_status_t lscp_set_channel_audio_dev Line 1633  lscp_status_t lscp_set_channel_audio_dev
1633   *   *
1634   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1635   */   */
1636  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,
1637            int iSamplerChannel, int iAudioOut, int iAudioIn )
1638  {  {
1639          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1640    
1641          if (iSamplerChannel < 0 || iAudioOut < 0 || iAudioIn < 0)          if (iSamplerChannel < 0 || iAudioOut < 0 || iAudioIn < 0)
1642                  return LSCP_FAILED;                  return LSCP_FAILED;
1643    
1644          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",
1645                    iSamplerChannel, iAudioOut, iAudioIn);
1646          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1647  }  }
1648    
# Line 1548  lscp_status_t lscp_set_channel_audio_cha Line 1657  lscp_status_t lscp_set_channel_audio_cha
1657   *   *
1658   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1659   */   */
1660  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,
1661            int iSamplerChannel, const char *pszMidiDriver )
1662  {  {
1663          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1664    
1665          if (iSamplerChannel < 0 || pszMidiDriver == NULL)          if (iSamplerChannel < 0 || pszMidiDriver == NULL)
1666                  return LSCP_FAILED;                  return LSCP_FAILED;
1667    
1668          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_TYPE %d %s\r\n", iSamplerChannel, pszMidiDriver);          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_TYPE %d %s\r\n",
1669                    iSamplerChannel, pszMidiDriver);
1670          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1671  }  }
1672    
# Line 1570  lscp_status_t lscp_set_channel_midi_type Line 1681  lscp_status_t lscp_set_channel_midi_type
1681   *   *
1682   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1683   */   */
1684  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,
1685            int iSamplerChannel, int iMidiDevice )
1686  {  {
1687          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1688    
1689          if (iSamplerChannel < 0 || iMidiDevice < 0)          if (iSamplerChannel < 0 || iMidiDevice < 0)
1690                  return LSCP_FAILED;                  return LSCP_FAILED;
1691    
1692          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_DEVICE %d %d\r\n", iSamplerChannel, iMidiDevice);          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_DEVICE %d %d\r\n",
1693                    iSamplerChannel, iMidiDevice);
1694          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1695  }  }
1696    
# Line 1592  lscp_status_t lscp_set_channel_midi_devi Line 1705  lscp_status_t lscp_set_channel_midi_devi
1705   *   *
1706   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1707   */   */
1708  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,
1709            int iSamplerChannel, int iMidiPort )
1710  {  {
1711          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1712    
1713          if (iSamplerChannel < 0 || iMidiPort < 0)          if (iSamplerChannel < 0 || iMidiPort < 0)
1714                  return LSCP_FAILED;                  return LSCP_FAILED;
1715    
1716          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_PORT %d %d\r\n", iSamplerChannel, iMidiPort);          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_PORT %d %d\r\n",
1717                    iSamplerChannel, iMidiPort);
1718          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1719  }  }
1720    
# Line 1615  lscp_status_t lscp_set_channel_midi_port Line 1730  lscp_status_t lscp_set_channel_midi_port
1730   *   *
1731   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1732   */   */
1733  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,
1734            int iSamplerChannel, int iMidiChannel )
1735  {  {
1736          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1737    
# Line 1623  lscp_status_t lscp_set_channel_midi_chan Line 1739  lscp_status_t lscp_set_channel_midi_chan
1739                  return LSCP_FAILED;                  return LSCP_FAILED;
1740    
1741          if (iMidiChannel == LSCP_MIDI_CHANNEL_ALL)          if (iMidiChannel == LSCP_MIDI_CHANNEL_ALL)
1742                  sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n", iSamplerChannel);                  sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n",
1743                            iSamplerChannel);
1744          else          else
1745                  sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n", iSamplerChannel, iMidiChannel);                  sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n",
1746                            iSamplerChannel, iMidiChannel);
1747          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1748  }  }
1749    
# Line 1642  lscp_status_t lscp_set_channel_midi_chan Line 1760  lscp_status_t lscp_set_channel_midi_chan
1760   *   *
1761   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1762   */   */
1763  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,
1764            int iSamplerChannel, int iMidiMap )
1765  {  {
1766          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1767    
# Line 1676  lscp_status_t lscp_set_channel_midi_map Line 1795  lscp_status_t lscp_set_channel_midi_map
1795   *   *
1796   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1797   */   */
1798  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,
1799            int iSamplerChannel, float fVolume )
1800  {  {
1801          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1802          struct _locale_t locale;          struct _locale_t locale;
# Line 1685  lscp_status_t lscp_set_channel_volume ( Line 1805  lscp_status_t lscp_set_channel_volume (
1805                  return LSCP_FAILED;                  return LSCP_FAILED;
1806    
1807          _save_and_set_c_locale(&locale);          _save_and_set_c_locale(&locale);
1808          sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n", iSamplerChannel, fVolume);          sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n",
1809                    iSamplerChannel, fVolume);
1810          _restore_locale(&locale);          _restore_locale(&locale);
1811    
1812          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
# Line 1704  lscp_status_t lscp_set_channel_volume ( Line 1825  lscp_status_t lscp_set_channel_volume (
1825   *   *
1826   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1827   */   */
1828  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,
1829            int iSamplerChannel, int iMute )
1830  {  {
1831          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1832    
1833          if (iSamplerChannel < 0 || iMute < 0 || iMute > 1)          if (iSamplerChannel < 0 || iMute < 0 || iMute > 1)
1834                  return LSCP_FAILED;                  return LSCP_FAILED;
1835    
1836          sprintf(szQuery, "SET CHANNEL MUTE %d %d\r\n", iSamplerChannel, iMute);          sprintf(szQuery, "SET CHANNEL MUTE %d %d\r\n",
1837                    iSamplerChannel, iMute);
1838          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1839  }  }
1840    
# Line 1728  lscp_status_t lscp_set_channel_mute ( ls Line 1851  lscp_status_t lscp_set_channel_mute ( ls
1851   *   *
1852   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1853   */   */
1854  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,
1855            int iSamplerChannel, int iSolo )
1856  {  {
1857          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1858    
1859          if (iSamplerChannel < 0 || iSolo < 0 || iSolo > 1)          if (iSamplerChannel < 0 || iSolo < 0 || iSolo > 1)
1860                  return LSCP_FAILED;                  return LSCP_FAILED;
1861    
1862          sprintf(szQuery, "SET CHANNEL SOLO %d %d\r\n", iSamplerChannel, iSolo);          sprintf(szQuery, "SET CHANNEL SOLO %d %d\r\n",
1863                    iSamplerChannel, iSolo);
1864          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1865  }  }
1866    
# Line 1952  lscp_status_t lscp_set_volume ( lscp_cli Line 2077  lscp_status_t lscp_set_volume ( lscp_cli
2077          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2078  }  }
2079    
2080    
2081  /**  /**
2082   *  Get global voice limit setting:   *  Get global voice limit setting:
2083   *  @code   *  @code
# Line 1966  lscp_status_t lscp_set_volume ( lscp_cli Line 2092  lscp_status_t lscp_set_volume ( lscp_cli
2092   *           negative value on error (e.g. if sampler doesn't support   *           negative value on error (e.g. if sampler doesn't support
2093   *           this command).   *           this command).
2094   */   */
2095  int lscp_get_voices(lscp_client_t *pClient)  int lscp_get_voices ( lscp_client_t *pClient )
2096  {  {
2097          int iVoices = -1;          int iVoices = -1;
2098    
# Line 1985  int lscp_get_voices(lscp_client_t *pClie Line 2111  int lscp_get_voices(lscp_client_t *pClie
2111          return iVoices;          return iVoices;
2112  }  }
2113    
2114    
2115  /**  /**
2116   *  Setting global voice limit setting:   *  Setting global voice limit setting:
2117   *  @code   *  @code
# Line 2003  int lscp_get_voices(lscp_client_t *pClie Line 2130  int lscp_get_voices(lscp_client_t *pClie
2130   *   *
2131   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2132   */   */
2133  lscp_status_t lscp_set_voices(lscp_client_t *pClient, int iMaxVoices)  lscp_status_t lscp_set_voices ( lscp_client_t *pClient, int iMaxVoices )
2134  {  {
2135          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2136    
# Line 2014  lscp_status_t lscp_set_voices(lscp_clien Line 2141  lscp_status_t lscp_set_voices(lscp_clien
2141          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2142  }  }
2143    
2144    
2145  /**  /**
2146   *  Get global disk streams limit setting:   *  Get global disk streams limit setting:
2147   *  @code   *  @code
# Line 2028  lscp_status_t lscp_set_voices(lscp_clien Line 2156  lscp_status_t lscp_set_voices(lscp_clien
2156   *           or a negative value on error (e.g. if sampler doesn't   *           or a negative value on error (e.g. if sampler doesn't
2157   *           support this command).   *           support this command).
2158   */   */
2159  int lscp_get_streams(lscp_client_t *pClient)  int lscp_get_streams ( lscp_client_t *pClient )
2160  {  {
2161          int iStreams = -1;          int iStreams = -1;
2162    
# Line 2047  int lscp_get_streams(lscp_client_t *pCli Line 2175  int lscp_get_streams(lscp_client_t *pCli
2175          return iStreams;          return iStreams;
2176  }  }
2177    
2178    
2179  /**  /**
2180   *  Setting global disk streams limit setting:   *  Setting global disk streams limit setting:
2181   *  @code   *  @code
# Line 2065  int lscp_get_streams(lscp_client_t *pCli Line 2194  int lscp_get_streams(lscp_client_t *pCli
2194   *   *
2195   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2196   */   */
2197  lscp_status_t lscp_set_streams(lscp_client_t *pClient, int iMaxStreams)  lscp_status_t lscp_set_streams ( lscp_client_t *pClient, int iMaxStreams )
2198  {  {
2199          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2200    
# Line 2076  lscp_status_t lscp_set_streams(lscp_clie Line 2205  lscp_status_t lscp_set_streams(lscp_clie
2205          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2206  }  }
2207    
2208    
2209  /**  /**
2210   *  Add an effect send to a sampler channel:   *  Add an effect send to a sampler channel:
2211   *  CREATE FX_SEND <sampler-channel> <midi-ctrl> [<name>]   *  CREATE FX_SEND <sampler-channel> <midi-ctrl> [<fx-name>]
2212   *   *
2213   *  @param pClient          Pointer to client instance structure.   *  @param pClient          Pointer to client instance structure.
2214   *  @param iSamplerChannel  Sampler channel number.   *  @param iSamplerChannel  Sampler channel number.
2215   *  @param iMidiController  MIDI controller used to alter the effect,   *  @param iMidiController  MIDI controller used to alter the effect,
2216   *                          usually a number between 0 and 127.   *                          usually a number between 0 and 127.
2217   *  @param pszName          Optional name for the effect send entity,   *  @param pszFxName        Optional name for the effect send entity,
2218   *                          does not have to be unique.   *                          does not have to be unique.
2219   *   *
2220   *  @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.
2221   */   */
2222  int lscp_create_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iMidiController, const char *pszFxName )  int lscp_create_fxsend ( lscp_client_t *pClient,
2223            int iSamplerChannel, int iMidiController, const char *pszFxName )
2224  {  {
2225          int iFxSend = -1;          int iFxSend = -1;
2226          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 2102  int lscp_create_fxsend ( lscp_client_t * Line 2233  int lscp_create_fxsend ( lscp_client_t *
2233          // Lock this section up.          // Lock this section up.
2234          lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
2235    
2236          sprintf(szQuery, "CREATE FX_SEND %d %d", iSamplerChannel, iMidiController);          sprintf(szQuery, "CREATE FX_SEND %d %d",
2237                    iSamplerChannel, iMidiController);
2238    
2239          if (pszFxName)          if (pszFxName)
2240                  sprintf(szQuery + strlen(szQuery), " '%s'", pszFxName);                  sprintf(szQuery + strlen(szQuery), " '%s'", pszFxName);
# Line 2129  int lscp_create_fxsend ( lscp_client_t * Line 2261  int lscp_create_fxsend ( lscp_client_t *
2261   *   *
2262   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2263   */   */
2264  lscp_status_t lscp_destroy_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend )  lscp_status_t lscp_destroy_fxsend ( lscp_client_t *pClient,
2265            int iSamplerChannel, int iFxSend )
2266  {  {
2267          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2268    
2269          if (iSamplerChannel < 0 || iFxSend < 0)          if (iSamplerChannel < 0 || iFxSend < 0)
2270                  return LSCP_FAILED;                  return LSCP_FAILED;
2271    
2272          sprintf(szQuery, "DESTROY FX_SEND %d %d\r\n", iSamplerChannel, iFxSend);          sprintf(szQuery, "DESTROY FX_SEND %d %d\r\n",
2273                    iSamplerChannel, iFxSend);
2274    
2275          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2276  }  }
# Line 2226  int *lscp_list_fxsends ( lscp_client_t * Line 2360  int *lscp_list_fxsends ( lscp_client_t *
2360   *  @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
2361   *  information of the given FX send, or NULL in case of failure.   *  information of the given FX send, or NULL in case of failure.
2362   */   */
2363  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,
2364            int iSamplerChannel, int iFxSend )
2365  {  {
2366          lscp_fxsend_info_t *pFxSendInfo;          lscp_fxsend_info_t *pFxSendInfo;
2367          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 2291  lscp_fxsend_info_t *lscp_get_fxsend_info Line 2426  lscp_fxsend_info_t *lscp_get_fxsend_info
2426          return pFxSendInfo;          return pFxSendInfo;
2427  }  }
2428    
2429    
2430  /**  /**
2431   *  Alter effect send's name:   *  Alter effect send's name:
2432   *  @code   *  @code
# Line 2304  lscp_fxsend_info_t *lscp_get_fxsend_info Line 2440  lscp_fxsend_info_t *lscp_get_fxsend_info
2440   *   *
2441   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2442   */   */
2443  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,
2444            int iSamplerChannel, int iFxSend, const char *pszFxName )
2445  {  {
2446          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2447    
2448          if (!pClient || iSamplerChannel < 0 || iFxSend < 0 || !pszFxName)          if (!pClient || iSamplerChannel < 0 || iFxSend < 0 || !pszFxName)
2449                  return LSCP_FAILED;                  return LSCP_FAILED;
2450    
2451          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",
2452                    iSamplerChannel, iFxSend, pszFxName);
2453          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2454  }  }
2455    
2456    
2457  /**  /**
2458   *  Alter effect send's audio routing:   *  Alter effect send's audio routing:
2459   *  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 2467  lscp_status_t lscp_set_fxsend_name ( lsc
2467   *   *
2468   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2469   */   */
2470  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,
2471            int iSamplerChannel, int iFxSend, int iAudioSrc, int iAudioDst )
2472  {  {
2473          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2474    
2475          if (iSamplerChannel < 0 || iFxSend < 0 || iAudioSrc < 0 || iAudioDst < 0)          if (iSamplerChannel < 0 || iFxSend < 0 || iAudioSrc < 0 || iAudioDst < 0)
2476                  return LSCP_FAILED;                  return LSCP_FAILED;
2477    
2478          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",
2479                    iSamplerChannel, iFxSend, iAudioSrc, iAudioDst);
2480          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2481  }  }
2482    
# Line 2352  lscp_status_t lscp_set_fxsend_audio_chan Line 2493  lscp_status_t lscp_set_fxsend_audio_chan
2493   *   *
2494   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2495   */   */
2496  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,
2497            int iSamplerChannel, int iFxSend, int iMidiController )
2498  {  {
2499          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2500    
2501          if (iSamplerChannel < 0 || iFxSend < 0 || iMidiController < 0 || iMidiController > 127)          if (iSamplerChannel < 0 || iFxSend < 0 ||
2502                    iMidiController < 0 || iMidiController > 127)
2503                  return LSCP_FAILED;                  return LSCP_FAILED;
2504    
2505          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",
2506                    iSamplerChannel, iFxSend, iMidiController);
2507          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
2508  }  }
2509    
# Line 2375  lscp_status_t lscp_set_fxsend_midi_contr Line 2519  lscp_status_t lscp_set_fxsend_midi_contr
2519   *   *
2520   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2521   */   */
2522  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,
2523            int iSamplerChannel, int iFxSend, float fLevel )
2524  {  {
2525          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2526          struct _locale_t locale;          struct _locale_t locale;
# Line 2384  lscp_status_t lscp_set_fxsend_level ( ls Line 2529  lscp_status_t lscp_set_fxsend_level ( ls
2529                  return LSCP_FAILED;                  return LSCP_FAILED;
2530    
2531          _save_and_set_c_locale(&locale);          _save_and_set_c_locale(&locale);
2532          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",
2533                    iSamplerChannel, iFxSend, fLevel);
2534          _restore_locale(&locale);          _restore_locale(&locale);
2535    
2536          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
# Line 2615  lscp_status_t lscp_set_midi_instrument_m Line 2761  lscp_status_t lscp_set_midi_instrument_m
2761   *   *
2762   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2763   */   */
2764  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,
2765            lscp_midi_instrument_t *pMidiInstr, const char *pszEngineName,
2766            const char *pszFileName, int iInstrIndex, float fVolume,
2767            lscp_load_mode_t load_mode, const char *pszName )
2768  {  {
2769          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2770          struct _locale_t locale;          struct _locale_t locale;
# Line 2671  lscp_status_t lscp_map_midi_instrument ( Line 2820  lscp_status_t lscp_map_midi_instrument (
2820   *   *
2821   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
2822   */   */
2823  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,
2824            lscp_midi_instrument_t *pMidiInstr )
2825  {  {
2826          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
2827    
# Line 2764  lscp_midi_instrument_t *lscp_list_midi_i Line 2914  lscp_midi_instrument_t *lscp_list_midi_i
2914          strcat(szQuery, "\r\n");          strcat(szQuery, "\r\n");
2915    
2916          if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK)          if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK)
2917                  pClient->midi_instruments = lscp_midi_instruments_create(lscp_client_get_result(pClient));                  pClient->midi_instruments = lscp_midi_instruments_create(
2918                            lscp_client_get_result(pClient));
2919    
2920          // Unlock this section down.          // Unlock this section down.
2921          lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
# Line 2784  lscp_midi_instrument_t *lscp_list_midi_i Line 2935  lscp_midi_instrument_t *lscp_list_midi_i
2935   *  with all the information of the given MIDI instrument map entry,   *  with all the information of the given MIDI instrument map entry,
2936   *  or NULL in case of failure.   *  or NULL in case of failure.
2937   */   */
2938  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,
2939            lscp_midi_instrument_t *pMidiInstr )
2940  {  {
2941          lscp_midi_instrument_info_t *pInstrInfo;          lscp_midi_instrument_info_t *pInstrInfo;
2942          char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
# Line 2903  lscp_status_t lscp_clear_midi_instrument Line 3055  lscp_status_t lscp_clear_midi_instrument
3055          return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
3056  }  }
3057    
3058    
3059  /**  /**
3060   * Open an instrument editor application for the instrument   * Open an instrument editor application for the instrument
3061   * on the given sampler channel:   * on the given sampler channel:

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

  ViewVC Help
Powered by ViewVC