2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
liblscp - LinuxSampler Control Protocol API |
liblscp - LinuxSampler Control Protocol API |
5 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2008, 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 |
1089 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
1090 |
if (pszToken) { |
if (pszToken) { |
1091 |
if (pChannelInfo->audio_routing) |
if (pChannelInfo->audio_routing) |
1092 |
lscp_szsplit_destroy(pChannelInfo->audio_routing); |
lscp_isplit_destroy(pChannelInfo->audio_routing); |
1093 |
pChannelInfo->audio_routing = lscp_szsplit_create(pszToken, ","); |
pChannelInfo->audio_routing = lscp_isplit_create(pszToken, ","); |
1094 |
} |
} |
1095 |
} |
} |
1096 |
else if (strcasecmp(pszToken, "INSTRUMENT_FILE") == 0) { |
else if (strcasecmp(pszToken, "INSTRUMENT_FILE") == 0) { |
2031 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2032 |
if (pszToken) { |
if (pszToken) { |
2033 |
if (pFxSendInfo->audio_routing) |
if (pFxSendInfo->audio_routing) |
2034 |
lscp_szsplit_destroy(pFxSendInfo->audio_routing); |
lscp_isplit_destroy(pFxSendInfo->audio_routing); |
2035 |
pFxSendInfo->audio_routing = lscp_szsplit_create(pszToken, ","); |
pFxSendInfo->audio_routing = lscp_isplit_create(pszToken, ","); |
2036 |
} |
} |
2037 |
} |
} |
2038 |
|
else if (strcasecmp(pszToken, "LEVEL") == 0) { |
2039 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2040 |
|
if (pszToken) |
2041 |
|
pFxSendInfo->level = (float) atof(lscp_ltrim(pszToken)); |
2042 |
|
} |
2043 |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
2044 |
} |
} |
2045 |
} |
} |
2051 |
return pFxSendInfo; |
return pFxSendInfo; |
2052 |
} |
} |
2053 |
|
|
2054 |
|
/** |
2055 |
|
* Alter effect send's name: |
2056 |
|
* @code |
2057 |
|
* SET FX_SEND NAME <sampler-chan> <fx-send-id> <name> |
2058 |
|
* @endcode |
2059 |
|
* |
2060 |
|
* @param pClient Pointer to client instance structure. |
2061 |
|
* @param iSamplerChannel Sampler channel number. |
2062 |
|
* @param iFxSend Effect send number. |
2063 |
|
* @param pszFxName Effect send's new name. |
2064 |
|
* |
2065 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2066 |
|
*/ |
2067 |
|
lscp_status_t lscp_set_fxsend_name ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, const char *pszFxName ) |
2068 |
|
{ |
2069 |
|
char szQuery[LSCP_BUFSIZ]; |
2070 |
|
|
2071 |
|
if (!pClient || iSamplerChannel < 0 || iFxSend < 0 || !pszFxName) |
2072 |
|
return LSCP_FAILED; |
2073 |
|
|
2074 |
|
snprintf(szQuery, LSCP_BUFSIZ, "SET FX_SEND NAME %d %d %s\r\n", iSamplerChannel, iFxSend, pszFxName); |
2075 |
|
return lscp_client_query(pClient, szQuery); |
2076 |
|
} |
2077 |
|
|
2078 |
/** |
/** |
2079 |
* Alter effect send's audio routing: |
* Alter effect send's audio routing: |
2101 |
|
|
2102 |
|
|
2103 |
/** |
/** |
2104 |
|
* Alter effect send's MIDI controller: |
2105 |
|
* SET FX_SEND MIDI_CONTROLLER <sampler-chan> <fx-send-id> <midi-ctrl> |
2106 |
|
* |
2107 |
|
* @param pClient Pointer to client instance structure. |
2108 |
|
* @param iSamplerChannel Sampler channel number. |
2109 |
|
* @param iFxSend Effect send number. |
2110 |
|
* @param iMidiController MIDI controller used to alter the effect, |
2111 |
|
* usually a number between 0 and 127. |
2112 |
|
* |
2113 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2114 |
|
*/ |
2115 |
|
lscp_status_t lscp_set_fxsend_midi_controller ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iMidiController ) |
2116 |
|
{ |
2117 |
|
char szQuery[LSCP_BUFSIZ]; |
2118 |
|
|
2119 |
|
if (iSamplerChannel < 0 || iFxSend < 0 || iMidiController < 0 || iMidiController > 127) |
2120 |
|
return LSCP_FAILED; |
2121 |
|
|
2122 |
|
sprintf(szQuery, "SET FX_SEND MIDI_CONTROLLER %d %d %d\r\n", iSamplerChannel, iFxSend, iMidiController); |
2123 |
|
return lscp_client_query(pClient, szQuery); |
2124 |
|
} |
2125 |
|
|
2126 |
|
|
2127 |
|
/** |
2128 |
|
* Alter effect send's audio level: |
2129 |
|
* SET FX_SEND LEVEL <sampler-chan> <fx-send-id> <level> |
2130 |
|
* |
2131 |
|
* @param pClient Pointer to client instance structure. |
2132 |
|
* @param iSamplerChannel Sampler channel number. |
2133 |
|
* @param iFxSend Effect send number. |
2134 |
|
* @param fLevel Effect send volume level. |
2135 |
|
* |
2136 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2137 |
|
*/ |
2138 |
|
lscp_status_t lscp_set_fxsend_level ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, float fLevel ) |
2139 |
|
{ |
2140 |
|
char szQuery[LSCP_BUFSIZ]; |
2141 |
|
|
2142 |
|
if (iSamplerChannel < 0 || iFxSend < 0 || fLevel < 0.0f) |
2143 |
|
return LSCP_FAILED; |
2144 |
|
|
2145 |
|
sprintf(szQuery, "SET FX_SEND LEVEL %d %d %f\r\n", iSamplerChannel, iFxSend, fLevel); |
2146 |
|
return lscp_client_query(pClient, szQuery); |
2147 |
|
} |
2148 |
|
|
2149 |
|
|
2150 |
|
/** |
2151 |
* Create a new MIDI instrument map: |
* Create a new MIDI instrument map: |
2152 |
* ADD MIDI_INSTRUMENT_MAP [<name>] |
* ADD MIDI_INSTRUMENT_MAP [<name>] |
2153 |
* |
* |
2650 |
|
|
2651 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2652 |
} |
} |
2653 |
|
|
2654 |
|
/** |
2655 |
|
* Open an instrument editor application for the instrument |
2656 |
|
* on the given sampler channel: |
2657 |
|
* EDIT CHANNEL INSTRUMENT <sampler-channel> |
2658 |
|
* |
2659 |
|
* @param pClient Pointer to client instance structure. |
2660 |
|
* @param iSamplerChannel Sampler Channel. |
2661 |
|
* |
2662 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2663 |
|
*/ |
2664 |
|
lscp_status_t lscp_edit_channel_instrument ( lscp_client_t *pClient, int iSamplerChannel ) |
2665 |
|
{ |
2666 |
|
char szQuery[LSCP_BUFSIZ]; |
2667 |
|
|
2668 |
|
if (iSamplerChannel < 0) |
2669 |
|
return LSCP_FAILED; |
2670 |
|
|
2671 |
|
sprintf(szQuery, "EDIT CHANNEL INSTRUMENT %d\r\n", iSamplerChannel); |
2672 |
|
|
2673 |
|
return lscp_client_query(pClient, szQuery); |
2674 |
|
} |
2675 |
|
|
2676 |
|
|
2677 |
// end of client.c |
// end of client.c |