--- liblscp/trunk/src/client.c 2004/09/27 14:40:08 253 +++ liblscp/trunk/src/client.c 2005/02/13 17:20:46 378 @@ -2,7 +2,7 @@ // /**************************************************************************** liblscp - LinuxSampler Control Protocol API - Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. + Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -111,7 +111,7 @@ } } // Check if select has in error. else if (iSelect < 0) { - lscp_socket_perror("_lscp_client_call: select"); + lscp_socket_perror("_lscp_client_evt_proc: select"); pClient->evt.iState = 0; } @@ -989,6 +989,11 @@ if (pszToken) pChannelInfo->instrument_nr = atoi(lscp_ltrim(pszToken)); } + else if (strcasecmp(pszToken, "INSTRUMENT_NAME") == 0) { + pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); + if (pszToken) + lscp_unquote_dup(&(pChannelInfo->instrument_name), &pszToken); + } else if (strcasecmp(pszToken, "INSTRUMENT_STATUS") == 0) { pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); if (pszToken) @@ -1006,8 +1011,13 @@ } else if (strcasecmp(pszToken, "MIDI_INPUT_CHANNEL") == 0) { pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); - if (pszToken) - pChannelInfo->midi_channel = atoi(lscp_ltrim(pszToken)); + if (pszToken) { + pszToken = lscp_ltrim(pszToken); + if (strcasecmp(pszToken, "ALL") == 0) + pChannelInfo->midi_channel = LSCP_MIDI_CHANNEL_ALL; + else + pChannelInfo->midi_channel = atoi(pszToken); + } } else if (strcasecmp(pszToken, "VOLUME") == 0) { pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); @@ -1352,8 +1362,8 @@ * * @param pClient Pointer to client instance structure. * @param iSamplerChannel Sampler channel number. - * @param iMidiChannel MIDI channel number to listen (0-15) or - * LSCP_MIDI_CHANNEL_ALL (-1) to listen on all channels. + * @param iMidiChannel MIDI channel address number to listen (0-15) or + * LSCP_MIDI_CHANNEL_ALL (16) to listen on all channels. * * @returns LSCP_OK on success, LSCP_FAILED otherwise. */ @@ -1361,13 +1371,13 @@ { char szQuery[LSCP_BUFSIZ]; - if (iSamplerChannel < 0 || iMidiChannel < LSCP_MIDI_CHANNEL_ALL || iMidiChannel > 15) + if (iSamplerChannel < 0 || iMidiChannel < 0 || iMidiChannel > 16) return LSCP_FAILED; - if (iMidiChannel >= 0) - sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n", iSamplerChannel, iMidiChannel); - else + if (iMidiChannel == LSCP_MIDI_CHANNEL_ALL) sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d ALL\r\n", iSamplerChannel); + else + sprintf(szQuery, "SET CHANNEL MIDI_INPUT_CHANNEL %d %d\r\n", iSamplerChannel, iMidiChannel); return lscp_client_query(pClient, szQuery); }