/[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 253 by capela, Mon Sep 27 14:40:08 2004 UTC revision 378 by capela, Sun Feb 13 17:20:46 2005 UTC
# Line 2  Line 2 
2  //  //
3  /****************************************************************************  /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API     liblscp - LinuxSampler Control Protocol API
5     Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2005, 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 111  static void _lscp_client_evt_proc ( void Line 111  static void _lscp_client_evt_proc ( void
111              }              }
112          }   // Check if select has in error.          }   // Check if select has in error.
113          else if (iSelect < 0) {          else if (iSelect < 0) {
114              lscp_socket_perror("_lscp_client_call: select");              lscp_socket_perror("_lscp_client_evt_proc: select");
115              pClient->evt.iState = 0;              pClient->evt.iState = 0;
116          }          }
117                    
# Line 989  lscp_channel_info_t *lscp_get_channel_in Line 989  lscp_channel_info_t *lscp_get_channel_in
989                  if (pszToken)                  if (pszToken)
990                      pChannelInfo->instrument_nr = atoi(lscp_ltrim(pszToken));                      pChannelInfo->instrument_nr = atoi(lscp_ltrim(pszToken));
991              }              }
992                else if (strcasecmp(pszToken, "INSTRUMENT_NAME") == 0) {
993                    pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
994                    if (pszToken)
995                        lscp_unquote_dup(&(pChannelInfo->instrument_name), &pszToken);
996                }
997              else if (strcasecmp(pszToken, "INSTRUMENT_STATUS") == 0) {              else if (strcasecmp(pszToken, "INSTRUMENT_STATUS") == 0) {
998                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
999                  if (pszToken)                  if (pszToken)
# Line 1006  lscp_channel_info_t *lscp_get_channel_in Line 1011  lscp_channel_info_t *lscp_get_channel_in
1011              }              }
1012              else if (strcasecmp(pszToken, "MIDI_INPUT_CHANNEL") == 0) {              else if (strcasecmp(pszToken, "MIDI_INPUT_CHANNEL") == 0) {
1013                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
1014                  if (pszToken)                  if (pszToken) {
1015                      pChannelInfo->midi_channel = atoi(lscp_ltrim(pszToken));                      pszToken = lscp_ltrim(pszToken);
1016                        if (strcasecmp(pszToken, "ALL") == 0)
1017                            pChannelInfo->midi_channel = LSCP_MIDI_CHANNEL_ALL;
1018                        else
1019                            pChannelInfo->midi_channel = atoi(pszToken);
1020                    }
1021              }              }
1022              else if (strcasecmp(pszToken, "VOLUME") == 0) {              else if (strcasecmp(pszToken, "VOLUME") == 0) {
1023                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
# Line 1352  lscp_status_t lscp_set_channel_midi_port Line 1362  lscp_status_t lscp_set_channel_midi_port
1362   *   *
1363   *  @param pClient          Pointer to client instance structure.   *  @param pClient          Pointer to client instance structure.
1364   *  @param iSamplerChannel  Sampler channel number.   *  @param iSamplerChannel  Sampler channel number.
1365   *  @param iMidiChannel     MIDI channel number to listen (0-15) or   *  @param iMidiChannel     MIDI channel address number to listen (0-15) or
1366   *                          LSCP_MIDI_CHANNEL_ALL (-1) to listen on all channels.   *                          LSCP_MIDI_CHANNEL_ALL (16) to listen on all channels.
1367   *   *
1368   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.   *  @returns LSCP_OK on success, LSCP_FAILED otherwise.
1369   */   */
# Line 1361  lscp_status_t lscp_set_channel_midi_chan Line 1371  lscp_status_t lscp_set_channel_midi_chan
1371  {  {
1372      char szQuery[LSCP_BUFSIZ];      char szQuery[LSCP_BUFSIZ];
1373    
1374      if (iSamplerChannel < 0 || iMidiChannel < LSCP_MIDI_CHANNEL_ALL || iMidiChannel > 15)      if (iSamplerChannel < 0 || iMidiChannel < 0 || iMidiChannel > 16)
1375          return LSCP_FAILED;          return LSCP_FAILED;
1376    
1377      if (iMidiChannel >= 0)      if (iMidiChannel == LSCP_MIDI_CHANNEL_ALL)
         sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n", iSamplerChannel, iMidiChannel);  
     else  
1378          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n", iSamplerChannel);          sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n", iSamplerChannel);
1379        else
1380            sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n", iSamplerChannel, iMidiChannel);
1381      return lscp_client_query(pClient, szQuery);      return lscp_client_query(pClient, szQuery);
1382  }  }
1383    

Legend:
Removed from v.253  
changed lines
  Added in v.378

  ViewVC Help
Powered by ViewVC