2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
liblscp - LinuxSampler Control Protocol API |
liblscp - LinuxSampler Control Protocol API |
5 |
Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2007, 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 |
327 |
pClient->midi_devices = NULL; |
pClient->midi_devices = NULL; |
328 |
pClient->engines = NULL; |
pClient->engines = NULL; |
329 |
pClient->channels = NULL; |
pClient->channels = NULL; |
330 |
|
pClient->fxsends = NULL; |
331 |
pClient->midi_instruments = NULL; |
pClient->midi_instruments = NULL; |
332 |
|
pClient->midi_maps = NULL; |
333 |
|
pClient->midi_map_name = NULL; |
334 |
lscp_driver_info_init(&(pClient->audio_driver_info)); |
lscp_driver_info_init(&(pClient->audio_driver_info)); |
335 |
lscp_driver_info_init(&(pClient->midi_driver_info)); |
lscp_driver_info_init(&(pClient->midi_driver_info)); |
336 |
lscp_device_info_init(&(pClient->audio_device_info)); |
lscp_device_info_init(&(pClient->audio_device_info)); |
344 |
lscp_server_info_init(&(pClient->server_info)); |
lscp_server_info_init(&(pClient->server_info)); |
345 |
lscp_engine_info_init(&(pClient->engine_info)); |
lscp_engine_info_init(&(pClient->engine_info)); |
346 |
lscp_channel_info_init(&(pClient->channel_info)); |
lscp_channel_info_init(&(pClient->channel_info)); |
347 |
|
lscp_fxsend_info_init(&(pClient->fxsend_info)); |
348 |
lscp_midi_instrument_info_init(&(pClient->midi_instrument_info)); |
lscp_midi_instrument_info_init(&(pClient->midi_instrument_info)); |
349 |
// Initialize error stuff. |
// Initialize error stuff. |
350 |
pClient->pszResult = NULL; |
pClient->pszResult = NULL; |
407 |
|
|
408 |
// Free up all cached members. |
// Free up all cached members. |
409 |
lscp_midi_instrument_info_free(&(pClient->midi_instrument_info)); |
lscp_midi_instrument_info_free(&(pClient->midi_instrument_info)); |
410 |
|
lscp_fxsend_info_free(&(pClient->fxsend_info)); |
411 |
lscp_channel_info_free(&(pClient->channel_info)); |
lscp_channel_info_free(&(pClient->channel_info)); |
412 |
lscp_engine_info_free(&(pClient->engine_info)); |
lscp_engine_info_free(&(pClient->engine_info)); |
413 |
lscp_server_info_free(&(pClient->server_info)); |
lscp_server_info_free(&(pClient->server_info)); |
428 |
lscp_isplit_destroy(pClient->midi_devices); |
lscp_isplit_destroy(pClient->midi_devices); |
429 |
lscp_szsplit_destroy(pClient->engines); |
lscp_szsplit_destroy(pClient->engines); |
430 |
lscp_isplit_destroy(pClient->channels); |
lscp_isplit_destroy(pClient->channels); |
431 |
|
lscp_isplit_destroy(pClient->fxsends); |
432 |
lscp_midi_instruments_destroy(pClient->midi_instruments); |
lscp_midi_instruments_destroy(pClient->midi_instruments); |
433 |
|
lscp_isplit_destroy(pClient->midi_maps); |
434 |
|
if (pClient->midi_map_name) |
435 |
|
free(pClient->midi_map_name); |
436 |
// Make them null. |
// Make them null. |
437 |
pClient->audio_drivers = NULL; |
pClient->audio_drivers = NULL; |
438 |
pClient->midi_drivers = NULL; |
pClient->midi_drivers = NULL; |
440 |
pClient->midi_devices = NULL; |
pClient->midi_devices = NULL; |
441 |
pClient->engines = NULL; |
pClient->engines = NULL; |
442 |
pClient->channels = NULL; |
pClient->channels = NULL; |
443 |
|
pClient->fxsends = NULL; |
444 |
pClient->midi_instruments = NULL; |
pClient->midi_instruments = NULL; |
445 |
|
pClient->midi_maps = NULL; |
446 |
|
pClient->midi_map_name = NULL; |
447 |
// Free result error stuff. |
// Free result error stuff. |
448 |
lscp_client_set_result(pClient, NULL, 0); |
lscp_client_set_result(pClient, NULL, 0); |
449 |
// Free stream usage stuff. |
// Free stream usage stuff. |
524 |
{ |
{ |
525 |
lscp_status_t ret; |
lscp_status_t ret; |
526 |
|
|
527 |
|
if (pClient == NULL) |
528 |
|
return LSCP_FAILED; |
529 |
|
|
530 |
// Lock this section up. |
// Lock this section up. |
531 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
532 |
|
|
579 |
|
|
580 |
/** |
/** |
581 |
* Register frontend for receiving event messages: |
* Register frontend for receiving event messages: |
582 |
* SUBSCRIBE CHANNEL_COUNT | VOICE_COUNT | STREAM_COUNT | BUFFER_FILL |
* SUBSCRIBE CHANNEL_COUNT | VOICE_COUNT | STREAM_COUNT |
583 |
* | CHANNEL_INFO | MISCELLANEOUS |
* | BUFFER_FILL | CHANNEL_INFO | TOTAL_VOICE_COUNT |
584 |
|
* | AUDIO_OUTPUT_DEVICE_COUNT | AUDIO_OUTPUT_DEVICE_INFO |
585 |
|
* | MIDI_INPUT_DEVICE_COUNT | MIDI_INPUT_DEVICE_INFO |
586 |
|
* | MIDI_INSTRUMENT_MAP_COUNT | MIDI_INSTRUMENT_MAP_INFO |
587 |
|
* | MIDI_INSTRUMENT_COUNT | MIDI_INSTRUMENT_INFO |
588 |
|
* | MISCELLANEOUS |
589 |
* |
* |
590 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
591 |
* @param events Bit-wise OR'ed event flags to subscribe. |
* @param events Bit-wise OR'ed event flags to subscribe. |
617 |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_BUFFER_FILL); |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_BUFFER_FILL); |
618 |
if (ret == LSCP_OK && (events & LSCP_EVENT_CHANNEL_INFO)) |
if (ret == LSCP_OK && (events & LSCP_EVENT_CHANNEL_INFO)) |
619 |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_CHANNEL_INFO); |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_CHANNEL_INFO); |
620 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_TOTAL_VOICE_COUNT)) |
621 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_TOTAL_VOICE_COUNT); |
622 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT)) |
623 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT); |
624 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO)) |
625 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO); |
626 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT)) |
627 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT); |
628 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INPUT_DEVICE_INFO)) |
629 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO); |
630 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_MAP_COUNT)) |
631 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INSTRUMENT_MAP_COUNT); |
632 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_MAP_INFO)) |
633 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INSTRUMENT_MAP_INFO); |
634 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_COUNT)) |
635 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INSTRUMENT_COUNT); |
636 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_INFO)) |
637 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INSTRUMENT_INFO); |
638 |
if (ret == LSCP_OK && (events & LSCP_EVENT_MISCELLANEOUS)) |
if (ret == LSCP_OK && (events & LSCP_EVENT_MISCELLANEOUS)) |
639 |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MISCELLANEOUS); |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MISCELLANEOUS); |
640 |
|
|
647 |
|
|
648 |
/** |
/** |
649 |
* Deregister frontend from receiving UDP event messages anymore: |
* Deregister frontend from receiving UDP event messages anymore: |
650 |
* SUBSCRIBE CHANNEL_COUNT | VOICE_COUNT | STREAM_COUNT | BUFFER_FILL |
* UNSUBSCRIBE CHANNEL_COUNT | VOICE_COUNT | STREAM_COUNT |
651 |
* | CHANNEL_INFO | MISCELLANEOUS |
* | BUFFER_FILL | CHANNEL_INFO | TOTAL_VOICE_COUNT |
652 |
|
* | AUDIO_OUTPUT_DEVICE_COUNT | AUDIO_OUTPUT_DEVICE_INFO |
653 |
|
* | MIDI_INPUT_DEVICE_COUNT | MIDI_INPUT_DEVICE_INFO |
654 |
|
* | MIDI_INSTRUMENT_MAP_COUNT | MIDI_INSTRUMENT_MAP_INFO |
655 |
|
* | MIDI_INSTRUMENT_COUNT | MIDI_INSTRUMENT_INFO |
656 |
|
* | MISCELLANEOUS |
657 |
* |
* |
658 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
659 |
* @param events Bit-wise OR'ed event flags to unsubscribe. |
* @param events Bit-wise OR'ed event flags to unsubscribe. |
681 |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_BUFFER_FILL); |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_BUFFER_FILL); |
682 |
if (ret == LSCP_OK && (events & LSCP_EVENT_CHANNEL_INFO)) |
if (ret == LSCP_OK && (events & LSCP_EVENT_CHANNEL_INFO)) |
683 |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_CHANNEL_INFO); |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_CHANNEL_INFO); |
684 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_TOTAL_VOICE_COUNT)) |
685 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_TOTAL_VOICE_COUNT); |
686 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT)) |
687 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT); |
688 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO)) |
689 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO); |
690 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT)) |
691 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT); |
692 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INPUT_DEVICE_INFO)) |
693 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO); |
694 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_MAP_COUNT)) |
695 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INSTRUMENT_MAP_COUNT); |
696 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_MAP_INFO)) |
697 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INSTRUMENT_MAP_INFO); |
698 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_COUNT)) |
699 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INSTRUMENT_COUNT); |
700 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_INFO)) |
701 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INSTRUMENT_INFO); |
702 |
if (ret == LSCP_OK && (events & LSCP_EVENT_MISCELLANEOUS)) |
if (ret == LSCP_OK && (events & LSCP_EVENT_MISCELLANEOUS)) |
703 |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MISCELLANEOUS); |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MISCELLANEOUS); |
704 |
|
|
813 |
{ |
{ |
814 |
int iChannels = -1; |
int iChannels = -1; |
815 |
|
|
816 |
|
if (pClient == NULL) |
817 |
|
return -1; |
818 |
|
|
819 |
// Lock this section up. |
// Lock this section up. |
820 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
821 |
|
|
876 |
{ |
{ |
877 |
int iSamplerChannel = -1; |
int iSamplerChannel = -1; |
878 |
|
|
879 |
|
if (pClient == NULL) |
880 |
|
return -1; |
881 |
|
|
882 |
// Lock this section up. |
// Lock this section up. |
883 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
884 |
|
|
926 |
{ |
{ |
927 |
int iAvailableEngines = -1; |
int iAvailableEngines = -1; |
928 |
|
|
929 |
|
if (pClient == NULL) |
930 |
|
return -1; |
931 |
|
|
932 |
// Lock this section up. |
// Lock this section up. |
933 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
934 |
|
|
955 |
{ |
{ |
956 |
const char *pszSeps = ","; |
const char *pszSeps = ","; |
957 |
|
|
958 |
|
if (pClient == NULL) |
959 |
|
return NULL; |
960 |
|
|
961 |
// Lock this section up. |
// Lock this section up. |
962 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
963 |
|
|
996 |
char *pszToken; |
char *pszToken; |
997 |
char *pch; |
char *pch; |
998 |
|
|
999 |
|
if (pClient == NULL) |
1000 |
|
return NULL; |
1001 |
if (pszEngineName == NULL) |
if (pszEngineName == NULL) |
1002 |
return NULL; |
return NULL; |
1003 |
|
|
1054 |
char *pszToken; |
char *pszToken; |
1055 |
char *pch; |
char *pch; |
1056 |
|
|
1057 |
|
if (pClient == NULL) |
1058 |
|
return NULL; |
1059 |
if (iSamplerChannel < 0) |
if (iSamplerChannel < 0) |
1060 |
return NULL; |
return NULL; |
1061 |
|
|
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) { |
1133 |
pChannelInfo->midi_channel = atoi(pszToken); |
pChannelInfo->midi_channel = atoi(pszToken); |
1134 |
} |
} |
1135 |
} |
} |
1136 |
|
else if (strcasecmp(pszToken, "MIDI_INSTRUMENT_MAP") == 0) { |
1137 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
1138 |
|
if (pszToken) { |
1139 |
|
pszToken = lscp_ltrim(pszToken); |
1140 |
|
if (strcasecmp(pszToken, "NONE") == 0) |
1141 |
|
pChannelInfo->midi_map = LSCP_MIDI_MAP_NONE; |
1142 |
|
else |
1143 |
|
if (strcasecmp(pszToken, "DEFAULT") == 0) |
1144 |
|
pChannelInfo->midi_map = LSCP_MIDI_MAP_DEFAULT; |
1145 |
|
else |
1146 |
|
pChannelInfo->midi_map = atoi(pszToken); |
1147 |
|
} |
1148 |
|
} |
1149 |
else if (strcasecmp(pszToken, "VOLUME") == 0) { |
else if (strcasecmp(pszToken, "VOLUME") == 0) { |
1150 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
1151 |
if (pszToken) |
if (pszToken) |
1187 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1188 |
int iVoiceCount = -1; |
int iVoiceCount = -1; |
1189 |
|
|
1190 |
|
if (pClient == NULL) |
1191 |
|
return -1; |
1192 |
if (iSamplerChannel < 0) |
if (iSamplerChannel < 0) |
1193 |
return iVoiceCount; |
return -1; |
1194 |
|
|
1195 |
// Lock this section up. |
// Lock this section up. |
1196 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1220 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1221 |
int iStreamCount = -1; |
int iStreamCount = -1; |
1222 |
|
|
1223 |
|
if (pClient == NULL) |
1224 |
|
return -1; |
1225 |
if (iSamplerChannel < 0) |
if (iSamplerChannel < 0) |
1226 |
return iStreamCount; |
return -1; |
1227 |
|
|
1228 |
// Lock this section up. |
// Lock this section up. |
1229 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1259 |
int iStream; |
int iStream; |
1260 |
int iPercent; |
int iPercent; |
1261 |
|
|
1262 |
|
if (pClient == NULL) |
1263 |
|
return -1; |
1264 |
if (iSamplerChannel < 0) |
if (iSamplerChannel < 0) |
1265 |
return iStreamUsage; |
return -1; |
1266 |
|
|
1267 |
// Lock this section up. |
// Lock this section up. |
1268 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1323 |
|
|
1324 |
// Retrieve a channel stream estimation. |
// Retrieve a channel stream estimation. |
1325 |
iStreamCount = lscp_get_channel_stream_count(pClient, iSamplerChannel); |
iStreamCount = lscp_get_channel_stream_count(pClient, iSamplerChannel); |
1326 |
if (pClient->iStreamCount < 0) |
if (iStreamCount < 0) |
1327 |
return NULL; |
return NULL; |
1328 |
|
|
1329 |
// Lock this section up. |
// Lock this section up. |
1512 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
1513 |
* @param iSamplerChannel Sampler channel number. |
* @param iSamplerChannel Sampler channel number. |
1514 |
* @param iMidiChannel MIDI channel address number to listen (0-15) or |
* @param iMidiChannel MIDI channel address number to listen (0-15) or |
1515 |
* LSCP_MIDI_CHANNEL_ALL (16) to listen on all channels. |
* @ref LSCP_MIDI_CHANNEL_ALL (16) to listen on all channels. |
1516 |
* |
* |
1517 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1518 |
*/ |
*/ |
1532 |
|
|
1533 |
|
|
1534 |
/** |
/** |
1535 |
|
* Setting MIDI instrument map: |
1536 |
|
* SET CHANNEL MIDI_INSTRUMENT_MAP <sampler-channel> <midi-map> |
1537 |
|
* |
1538 |
|
* @param pClient Pointer to client instance structure. |
1539 |
|
* @param iSamplerChannel Sampler channel number. |
1540 |
|
* @param iMidiMap MIDI instrument map number, or either |
1541 |
|
* @ref LSCP_MIDI_MAP_NONE or |
1542 |
|
* @ref LSCP_MIDI_MAP_DEFAULT . |
1543 |
|
* |
1544 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1545 |
|
*/ |
1546 |
|
lscp_status_t lscp_set_channel_midi_map ( lscp_client_t *pClient, int iSamplerChannel, int iMidiMap ) |
1547 |
|
{ |
1548 |
|
char szQuery[LSCP_BUFSIZ]; |
1549 |
|
|
1550 |
|
if (iSamplerChannel < 0) |
1551 |
|
return LSCP_FAILED; |
1552 |
|
|
1553 |
|
sprintf(szQuery, "SET CHANNEL MIDI_INSTRUMENT_MAP %d ", iSamplerChannel); |
1554 |
|
if (iMidiMap == LSCP_MIDI_MAP_NONE) |
1555 |
|
strcat(szQuery , "NONE"); |
1556 |
|
else |
1557 |
|
if (iMidiMap == LSCP_MIDI_MAP_DEFAULT) |
1558 |
|
strcat(szQuery , "DEFAULT"); |
1559 |
|
else |
1560 |
|
sprintf(szQuery + strlen(szQuery), "%d", iMidiMap); |
1561 |
|
|
1562 |
|
strcat(szQuery, "\r\n"); |
1563 |
|
|
1564 |
|
return lscp_client_query(pClient, szQuery); |
1565 |
|
} |
1566 |
|
|
1567 |
|
|
1568 |
|
/** |
1569 |
* Setting channel volume: |
* Setting channel volume: |
1570 |
* SET CHANNEL VOLUME <sampler-channel> <volume> |
* SET CHANNEL VOLUME <sampler-channel> <volume> |
1571 |
* |
* |
1581 |
{ |
{ |
1582 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1583 |
|
|
1584 |
if (iSamplerChannel < 0 || fVolume < 0.0) |
if (iSamplerChannel < 0 || fVolume < 0.0f) |
1585 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1586 |
|
|
1587 |
sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n", iSamplerChannel, fVolume); |
sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n", iSamplerChannel, fVolume); |
1668 |
*/ |
*/ |
1669 |
lscp_status_t lscp_reset_sampler ( lscp_client_t *pClient ) |
lscp_status_t lscp_reset_sampler ( lscp_client_t *pClient ) |
1670 |
{ |
{ |
1671 |
|
// Do actual whole sampler reset... |
1672 |
return lscp_client_query(pClient, "RESET\r\n"); |
return lscp_client_query(pClient, "RESET\r\n"); |
1673 |
} |
} |
1674 |
|
|
1691 |
char *pszToken; |
char *pszToken; |
1692 |
char *pch; |
char *pch; |
1693 |
|
|
1694 |
|
if (pClient == NULL) |
1695 |
|
return NULL; |
1696 |
|
|
1697 |
// Lock this section up. |
// Lock this section up. |
1698 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1699 |
|
|
1714 |
if (pszToken) |
if (pszToken) |
1715 |
lscp_unquote_dup(&(pServerInfo->version), &pszToken); |
lscp_unquote_dup(&(pServerInfo->version), &pszToken); |
1716 |
} |
} |
1717 |
|
else if (strcasecmp(pszToken, "PROTOCOL_VERSION") == 0) { |
1718 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
1719 |
|
if (pszToken) |
1720 |
|
lscp_unquote_dup(&(pServerInfo->protocol_version), &pszToken); |
1721 |
|
} |
1722 |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
1723 |
} |
} |
1724 |
} |
} |
1744 |
{ |
{ |
1745 |
int iVoiceCount = -1; |
int iVoiceCount = -1; |
1746 |
|
|
1747 |
|
if (pClient == NULL) |
1748 |
|
return -1; |
1749 |
|
|
1750 |
// Lock this section up. |
// Lock this section up. |
1751 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1752 |
|
|
1773 |
{ |
{ |
1774 |
int iVoiceCount = -1; |
int iVoiceCount = -1; |
1775 |
|
|
1776 |
|
if (pClient == NULL) |
1777 |
|
return -1; |
1778 |
|
|
1779 |
// Lock this section up. |
// Lock this section up. |
1780 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1781 |
|
|
1790 |
|
|
1791 |
|
|
1792 |
/** |
/** |
1793 |
|
* Get global volume attenuation: |
1794 |
|
* GET VOLUME |
1795 |
|
* |
1796 |
|
* @param pClient Pointer to client instance structure. |
1797 |
|
* |
1798 |
|
* @returns The global volume as positive floating point value usually in |
1799 |
|
* the range between 0.0 and 1.0; in case of failure 0.0 is returned. |
1800 |
|
*/ |
1801 |
|
float lscp_get_volume ( lscp_client_t *pClient ) |
1802 |
|
{ |
1803 |
|
float fVolume = 0.0f; |
1804 |
|
|
1805 |
|
if (pClient == NULL) |
1806 |
|
return 0.0f; |
1807 |
|
|
1808 |
|
// Lock this section up. |
1809 |
|
lscp_mutex_lock(pClient->mutex); |
1810 |
|
|
1811 |
|
if (lscp_client_call(pClient, "GET VOLUME\r\n", 0) == LSCP_OK) |
1812 |
|
fVolume = (float) atof(lscp_client_get_result(pClient)); |
1813 |
|
|
1814 |
|
// Unlock this section down. |
1815 |
|
lscp_mutex_unlock(pClient->mutex); |
1816 |
|
|
1817 |
|
return fVolume; |
1818 |
|
} |
1819 |
|
|
1820 |
|
|
1821 |
|
/** |
1822 |
|
* Setting global volume attenuation: |
1823 |
|
* SET VOLUME <volume> |
1824 |
|
* |
1825 |
|
* @param pClient Pointer to client instance structure. |
1826 |
|
* @param fVolume Global volume parameter as positive floating point |
1827 |
|
* value usually be in the range between 0.0 and 1.0, |
1828 |
|
* that is for attenuating the overall volume. |
1829 |
|
* |
1830 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1831 |
|
*/ |
1832 |
|
lscp_status_t lscp_set_volume ( lscp_client_t *pClient, float fVolume ) |
1833 |
|
{ |
1834 |
|
char szQuery[LSCP_BUFSIZ]; |
1835 |
|
|
1836 |
|
if (fVolume < 0.0f) |
1837 |
|
return LSCP_FAILED; |
1838 |
|
|
1839 |
|
sprintf(szQuery, "SET VOLUME %g\r\n", fVolume); |
1840 |
|
return lscp_client_query(pClient, szQuery); |
1841 |
|
} |
1842 |
|
|
1843 |
|
|
1844 |
|
/** |
1845 |
|
* Add an effect send to a sampler channel: |
1846 |
|
* CREATE FX_SEND <sampler-channel> <midi-ctrl> [<name>] |
1847 |
|
* |
1848 |
|
* @param pClient Pointer to client instance structure. |
1849 |
|
* @param iSamplerChannel Sampler channel number. |
1850 |
|
* @param iMidiController MIDI controller used to alter the effect, |
1851 |
|
* usually a number between 0 and 127. |
1852 |
|
* @param pszName Optional name for the effect send entity, |
1853 |
|
* does not have to be unique. |
1854 |
|
* |
1855 |
|
* @returns The new effect send number identifier, or -1 in case of failure. |
1856 |
|
*/ |
1857 |
|
int lscp_create_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iMidiController, const char *pszFxName ) |
1858 |
|
{ |
1859 |
|
int iFxSend = -1; |
1860 |
|
char szQuery[LSCP_BUFSIZ]; |
1861 |
|
|
1862 |
|
if (pClient == NULL) |
1863 |
|
return -1; |
1864 |
|
if (iSamplerChannel < 0 || iMidiController < 0 || iMidiController > 127) |
1865 |
|
return -1; |
1866 |
|
|
1867 |
|
// Lock this section up. |
1868 |
|
lscp_mutex_lock(pClient->mutex); |
1869 |
|
|
1870 |
|
sprintf(szQuery, "CREATE FX_SEND %d %d", iSamplerChannel, iMidiController); |
1871 |
|
|
1872 |
|
if (pszFxName) |
1873 |
|
sprintf(szQuery + strlen(szQuery), " '%s'", pszFxName); |
1874 |
|
|
1875 |
|
strcat(szQuery, "\r\n"); |
1876 |
|
|
1877 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
1878 |
|
iFxSend = atoi(lscp_client_get_result(pClient)); |
1879 |
|
|
1880 |
|
// Unlock this section down. |
1881 |
|
lscp_mutex_unlock(pClient->mutex); |
1882 |
|
|
1883 |
|
return iFxSend; |
1884 |
|
} |
1885 |
|
|
1886 |
|
|
1887 |
|
/** |
1888 |
|
* Remove an effect send from a sampler channel: |
1889 |
|
* DESTROY FX_SEND <sampler-channel> <fx-send-id> |
1890 |
|
* |
1891 |
|
* @param pClient Pointer to client instance structure. |
1892 |
|
* @param iSamplerChannel Sampler channel number. |
1893 |
|
* @param iFxSend Effect send number. |
1894 |
|
* |
1895 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1896 |
|
*/ |
1897 |
|
lscp_status_t lscp_destroy_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend ) |
1898 |
|
{ |
1899 |
|
char szQuery[LSCP_BUFSIZ]; |
1900 |
|
|
1901 |
|
if (iSamplerChannel < 0 || iFxSend < 0) |
1902 |
|
return LSCP_FAILED; |
1903 |
|
|
1904 |
|
sprintf(szQuery, "DESTROY FX_SEND %d %d\r\n", iSamplerChannel, iFxSend); |
1905 |
|
|
1906 |
|
return lscp_client_query(pClient, szQuery); |
1907 |
|
} |
1908 |
|
|
1909 |
|
|
1910 |
|
/** |
1911 |
|
* Get amount of effect sends on a sampler channel: |
1912 |
|
* GET FX_SENDS <sampler-channel> |
1913 |
|
* |
1914 |
|
* @param pClient Pointer to client instance structure. |
1915 |
|
* @param iSamplerChannel Sampler channel number. |
1916 |
|
* |
1917 |
|
* @returns The current total number of effect sends of the sampler channel |
1918 |
|
* on success, -1 otherwise. |
1919 |
|
*/ |
1920 |
|
int lscp_get_fxsends ( lscp_client_t *pClient, int iSamplerChannel ) |
1921 |
|
{ |
1922 |
|
int iFxSends = -1; |
1923 |
|
char szQuery[LSCP_BUFSIZ]; |
1924 |
|
|
1925 |
|
if (pClient == NULL) |
1926 |
|
return -1; |
1927 |
|
if (iSamplerChannel < 0) |
1928 |
|
return -1; |
1929 |
|
|
1930 |
|
// Lock this section up. |
1931 |
|
lscp_mutex_lock(pClient->mutex); |
1932 |
|
|
1933 |
|
sprintf(szQuery, "GET FX_SENDS %d\r\n", iSamplerChannel); |
1934 |
|
|
1935 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
1936 |
|
iFxSends = atoi(lscp_client_get_result(pClient)); |
1937 |
|
|
1938 |
|
// Unlock this section doen. |
1939 |
|
lscp_mutex_unlock(pClient->mutex); |
1940 |
|
|
1941 |
|
return iFxSends; |
1942 |
|
} |
1943 |
|
|
1944 |
|
|
1945 |
|
/** |
1946 |
|
* List all effect sends on a sampler channel: |
1947 |
|
* LIST FX_SENDS <sampler-channel> |
1948 |
|
* |
1949 |
|
* @param pClient Pointer to client instance structure. |
1950 |
|
* @param iSamplerChannel Sampler channel number. |
1951 |
|
* |
1952 |
|
* @returns An array of the effect sends identifiers as positive integers, |
1953 |
|
* terminated with -1 on success, NULL otherwise. |
1954 |
|
*/ |
1955 |
|
int *lscp_list_fxsends ( lscp_client_t *pClient, int iSamplerChannel ) |
1956 |
|
{ |
1957 |
|
const char *pszSeps = ","; |
1958 |
|
char szQuery[LSCP_BUFSIZ]; |
1959 |
|
|
1960 |
|
if (pClient == NULL) |
1961 |
|
return NULL; |
1962 |
|
|
1963 |
|
// Lock this section up. |
1964 |
|
lscp_mutex_lock(pClient->mutex); |
1965 |
|
|
1966 |
|
if (pClient->fxsends) { |
1967 |
|
lscp_isplit_destroy(pClient->fxsends); |
1968 |
|
pClient->fxsends = NULL; |
1969 |
|
} |
1970 |
|
|
1971 |
|
sprintf(szQuery, "LIST FX_SENDS %d\r\n", iSamplerChannel); |
1972 |
|
|
1973 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
1974 |
|
pClient->fxsends = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps); |
1975 |
|
|
1976 |
|
// Unlock this section down. |
1977 |
|
lscp_mutex_unlock(pClient->mutex); |
1978 |
|
|
1979 |
|
return pClient->fxsends; |
1980 |
|
} |
1981 |
|
|
1982 |
|
|
1983 |
|
/** |
1984 |
|
* Getting effect send information |
1985 |
|
* GET FX_SEND INFO <sampler-channel> <fx-send-id> |
1986 |
|
* |
1987 |
|
* @param pClient Pointer to client instance structure. |
1988 |
|
* @param iSamplerChannel Sampler channel number. |
1989 |
|
* @param iFxSend Effect send number. |
1990 |
|
* |
1991 |
|
* @returns A pointer to a @ref lscp_fxsend_info_t structure, with the |
1992 |
|
* information of the given FX send, or NULL in case of failure. |
1993 |
|
*/ |
1994 |
|
lscp_fxsend_info_t *lscp_get_fxsend_info ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend ) |
1995 |
|
{ |
1996 |
|
lscp_fxsend_info_t *pFxSendInfo; |
1997 |
|
char szQuery[LSCP_BUFSIZ]; |
1998 |
|
const char *pszResult; |
1999 |
|
const char *pszSeps = ":"; |
2000 |
|
const char *pszCrlf = "\r\n"; |
2001 |
|
char *pszToken; |
2002 |
|
char *pch; |
2003 |
|
|
2004 |
|
if (pClient == NULL) |
2005 |
|
return NULL; |
2006 |
|
if (iSamplerChannel < 0 || iFxSend < 0) |
2007 |
|
return NULL; |
2008 |
|
|
2009 |
|
// Lock this section up. |
2010 |
|
lscp_mutex_lock(pClient->mutex); |
2011 |
|
|
2012 |
|
pFxSendInfo = &(pClient->fxsend_info); |
2013 |
|
lscp_fxsend_info_reset(pFxSendInfo); |
2014 |
|
|
2015 |
|
sprintf(szQuery, "GET FX_SEND INFO %d %d\r\n", iSamplerChannel, iFxSend); |
2016 |
|
if (lscp_client_call(pClient, szQuery, 1) == LSCP_OK) { |
2017 |
|
pszResult = lscp_client_get_result(pClient); |
2018 |
|
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
2019 |
|
while (pszToken) { |
2020 |
|
if (strcasecmp(pszToken, "NAME") == 0) { |
2021 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2022 |
|
if (pszToken) |
2023 |
|
lscp_unquote_dup(&(pFxSendInfo->name), &pszToken); |
2024 |
|
} |
2025 |
|
else if (strcasecmp(pszToken, "MIDI_CONTROLLER") == 0) { |
2026 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2027 |
|
if (pszToken) |
2028 |
|
pFxSendInfo->midi_controller = atoi(lscp_ltrim(pszToken)); |
2029 |
|
} |
2030 |
|
else if (strcasecmp(pszToken, "AUDIO_OUTPUT_ROUTING") == 0) { |
2031 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2032 |
|
if (pszToken) { |
2033 |
|
if (pFxSendInfo->audio_routing) |
2034 |
|
lscp_isplit_destroy(pFxSendInfo->audio_routing); |
2035 |
|
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)); |
2044 |
|
} |
2045 |
|
} |
2046 |
|
else pFxSendInfo = NULL; |
2047 |
|
|
2048 |
|
// Unlock this section up. |
2049 |
|
lscp_mutex_unlock(pClient->mutex); |
2050 |
|
|
2051 |
|
return pFxSendInfo; |
2052 |
|
} |
2053 |
|
|
2054 |
|
|
2055 |
|
/** |
2056 |
|
* Alter effect send's audio routing: |
2057 |
|
* SET FX_SEND AUDIO_OUTPUT_CHANNEL <sampler-chan> <fx-send-id> |
2058 |
|
* <audio-src> <audio-dst> |
2059 |
|
* |
2060 |
|
* @param pClient Pointer to client instance structure. |
2061 |
|
* @param iSamplerChannel Sampler channel number. |
2062 |
|
* @param iFxSend Effect send number. |
2063 |
|
* @param iAudioSrc Audio output device channel to be routed from. |
2064 |
|
* @param iAudioDst Audio output device channel to be routed into. |
2065 |
|
* |
2066 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2067 |
|
*/ |
2068 |
|
lscp_status_t lscp_set_fxsend_audio_channel ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iAudioSrc, int iAudioDst ) |
2069 |
|
{ |
2070 |
|
char szQuery[LSCP_BUFSIZ]; |
2071 |
|
|
2072 |
|
if (iSamplerChannel < 0 || iFxSend < 0 || iAudioSrc < 0 || iAudioDst < 0) |
2073 |
|
return LSCP_FAILED; |
2074 |
|
|
2075 |
|
sprintf(szQuery, "SET FX_SEND AUDIO_OUTPUT_CHANNEL %d %d %d %d\r\n", iSamplerChannel, iFxSend, iAudioSrc, iAudioDst); |
2076 |
|
return lscp_client_query(pClient, szQuery); |
2077 |
|
} |
2078 |
|
|
2079 |
|
|
2080 |
|
/** |
2081 |
|
* Alter effect send's MIDI controller: |
2082 |
|
* SET FX_SEND MIDI_CONTROLLER <sampler-chan> <fx-send-id> <midi-ctrl> |
2083 |
|
* |
2084 |
|
* @param pClient Pointer to client instance structure. |
2085 |
|
* @param iSamplerChannel Sampler channel number. |
2086 |
|
* @param iFxSend Effect send number. |
2087 |
|
* @param iMidiController MIDI controller used to alter the effect, |
2088 |
|
* usually a number between 0 and 127. |
2089 |
|
* |
2090 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2091 |
|
*/ |
2092 |
|
lscp_status_t lscp_set_fxsend_midi_controller ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iMidiController ) |
2093 |
|
{ |
2094 |
|
char szQuery[LSCP_BUFSIZ]; |
2095 |
|
|
2096 |
|
if (iSamplerChannel < 0 || iFxSend < 0 || iMidiController < 0 || iMidiController > 127) |
2097 |
|
return LSCP_FAILED; |
2098 |
|
|
2099 |
|
sprintf(szQuery, "SET FX_SEND MIDI_CONTROLLER %d %d %d\r\n", iSamplerChannel, iFxSend, iMidiController); |
2100 |
|
return lscp_client_query(pClient, szQuery); |
2101 |
|
} |
2102 |
|
|
2103 |
|
|
2104 |
|
/** |
2105 |
|
* Alter effect send's audio level: |
2106 |
|
* SET FX_SEND LEVEL <sampler-chan> <fx-send-id> <level> |
2107 |
|
* |
2108 |
|
* @param pClient Pointer to client instance structure. |
2109 |
|
* @param iSamplerChannel Sampler channel number. |
2110 |
|
* @param iFxSend Effect send number. |
2111 |
|
* @param fLevel Effect send volume level. |
2112 |
|
* |
2113 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2114 |
|
*/ |
2115 |
|
lscp_status_t lscp_set_fxsend_level ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, float fLevel ) |
2116 |
|
{ |
2117 |
|
char szQuery[LSCP_BUFSIZ]; |
2118 |
|
|
2119 |
|
if (iSamplerChannel < 0 || iFxSend < 0 || fLevel < 0.0f) |
2120 |
|
return LSCP_FAILED; |
2121 |
|
|
2122 |
|
sprintf(szQuery, "SET FX_SEND LEVEL %d %d %f\r\n", iSamplerChannel, iFxSend, fLevel); |
2123 |
|
return lscp_client_query(pClient, szQuery); |
2124 |
|
} |
2125 |
|
|
2126 |
|
|
2127 |
|
/** |
2128 |
|
* Create a new MIDI instrument map: |
2129 |
|
* ADD MIDI_INSTRUMENT_MAP [<name>] |
2130 |
|
* |
2131 |
|
* @param pClient Pointer to client instance structure. |
2132 |
|
* @param pszMapName MIDI instrument map name (optional) |
2133 |
|
* |
2134 |
|
* @returns The new MIDI instrument map number identifier, |
2135 |
|
* or -1 in case of failure. |
2136 |
|
*/ |
2137 |
|
int lscp_add_midi_instrument_map ( lscp_client_t *pClient, const char *pszMapName ) |
2138 |
|
{ |
2139 |
|
int iMidiMap = -1; |
2140 |
|
char szQuery[LSCP_BUFSIZ]; |
2141 |
|
|
2142 |
|
if (pClient == NULL) |
2143 |
|
return -1; |
2144 |
|
|
2145 |
|
// Lock this section up. |
2146 |
|
lscp_mutex_lock(pClient->mutex); |
2147 |
|
|
2148 |
|
strcpy(szQuery, "ADD MIDI_INSTRUMENT_MAP"); |
2149 |
|
|
2150 |
|
if (pszMapName) |
2151 |
|
sprintf(szQuery + strlen(szQuery), " '%s'", pszMapName); |
2152 |
|
|
2153 |
|
strcat(szQuery, "\r\n"); |
2154 |
|
|
2155 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
2156 |
|
iMidiMap = atoi(lscp_client_get_result(pClient)); |
2157 |
|
|
2158 |
|
// Unlock this section down. |
2159 |
|
lscp_mutex_unlock(pClient->mutex); |
2160 |
|
|
2161 |
|
return iMidiMap; |
2162 |
|
} |
2163 |
|
|
2164 |
|
|
2165 |
|
/** |
2166 |
|
* Delete one particular or all MIDI instrument maps: |
2167 |
|
* REMOVE MIDI_INSTRUMENT_MAP <midi-map> |
2168 |
|
* |
2169 |
|
* @param pClient Pointer to client instance structure. |
2170 |
|
* @param iMidiMap MIDI instrument map number. |
2171 |
|
* |
2172 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2173 |
|
*/ |
2174 |
|
lscp_status_t lscp_remove_midi_instrument_map ( lscp_client_t *pClient, int iMidiMap ) |
2175 |
|
{ |
2176 |
|
char szQuery[LSCP_BUFSIZ]; |
2177 |
|
|
2178 |
|
if (iMidiMap < 0) |
2179 |
|
return LSCP_FAILED; |
2180 |
|
|
2181 |
|
sprintf(szQuery, "REMOVE MIDI_INSTRUMENT_MAP %d\r\n", iMidiMap); |
2182 |
|
|
2183 |
|
return lscp_client_query(pClient, szQuery); |
2184 |
|
} |
2185 |
|
|
2186 |
|
|
2187 |
|
/** |
2188 |
|
* Get amount of existing MIDI instrument maps: |
2189 |
|
* GET MIDI_INSTRUMENT_MAPS |
2190 |
|
* |
2191 |
|
* @param pClient Pointer to client instance structure. |
2192 |
|
* |
2193 |
|
* @returns The current total number of MIDI instrument maps |
2194 |
|
* on success, -1 otherwise. |
2195 |
|
*/ |
2196 |
|
int lscp_get_midi_instrument_maps ( lscp_client_t *pClient ) |
2197 |
|
{ |
2198 |
|
int iMidiMaps = -1; |
2199 |
|
|
2200 |
|
if (pClient == NULL) |
2201 |
|
return -1; |
2202 |
|
|
2203 |
|
// Lock this section up. |
2204 |
|
lscp_mutex_lock(pClient->mutex); |
2205 |
|
|
2206 |
|
if (lscp_client_call(pClient, "GET MIDI_INSTRUMENT_MAPS\r\n", 0) == LSCP_OK) |
2207 |
|
iMidiMaps = atoi(lscp_client_get_result(pClient)); |
2208 |
|
|
2209 |
|
// Unlock this section doen. |
2210 |
|
lscp_mutex_unlock(pClient->mutex); |
2211 |
|
|
2212 |
|
return iMidiMaps; |
2213 |
|
} |
2214 |
|
|
2215 |
|
|
2216 |
|
/** |
2217 |
|
* Getting all created MIDI instrument maps: |
2218 |
|
* LIST MIDI_INSTRUMENT_MAPS |
2219 |
|
* |
2220 |
|
* @param pClient Pointer to client instance structure. |
2221 |
|
* |
2222 |
|
* @returns An array of the MIDI instrument map identifiers as positive |
2223 |
|
* integers, terminated with -1 on success, NULL otherwise. |
2224 |
|
*/ |
2225 |
|
int *lscp_list_midi_instrument_maps ( lscp_client_t *pClient ) |
2226 |
|
{ |
2227 |
|
const char *pszSeps = ","; |
2228 |
|
|
2229 |
|
if (pClient == NULL) |
2230 |
|
return NULL; |
2231 |
|
|
2232 |
|
// Lock this section up. |
2233 |
|
lscp_mutex_lock(pClient->mutex); |
2234 |
|
|
2235 |
|
if (pClient->midi_maps) { |
2236 |
|
lscp_isplit_destroy(pClient->midi_maps); |
2237 |
|
pClient->midi_maps = NULL; |
2238 |
|
} |
2239 |
|
|
2240 |
|
if (lscp_client_call(pClient, "LIST MIDI_INSTRUMENT_MAPS\r\n", 0) == LSCP_OK) |
2241 |
|
pClient->midi_maps = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps); |
2242 |
|
|
2243 |
|
// Unlock this section down. |
2244 |
|
lscp_mutex_unlock(pClient->mutex); |
2245 |
|
|
2246 |
|
return pClient->midi_maps; |
2247 |
|
} |
2248 |
|
|
2249 |
|
|
2250 |
|
/** |
2251 |
|
* Getting a MIDI instrument map name: |
2252 |
|
* GET MIDI_INSTRUMENT_MAP INFO <midi-map> |
2253 |
|
* |
2254 |
|
* @param pClient Pointer to client instance structure. |
2255 |
|
* @param iMidiMap MIDI instrument map number. |
2256 |
|
* |
2257 |
|
* @returns The MIDI instrument map name on success, NULL on failure. |
2258 |
|
*/ |
2259 |
|
const char *lscp_get_midi_instrument_map_name ( lscp_client_t *pClient, int iMidiMap ) |
2260 |
|
{ |
2261 |
|
char szQuery[LSCP_BUFSIZ]; |
2262 |
|
const char *pszResult; |
2263 |
|
const char *pszSeps = ":"; |
2264 |
|
const char *pszCrlf = "\r\n"; |
2265 |
|
char *pszToken; |
2266 |
|
char *pch; |
2267 |
|
|
2268 |
|
if (pClient == NULL) |
2269 |
|
return NULL; |
2270 |
|
if (iMidiMap < 0) |
2271 |
|
return NULL; |
2272 |
|
|
2273 |
|
// Lock this section up. |
2274 |
|
lscp_mutex_lock(pClient->mutex); |
2275 |
|
|
2276 |
|
if (pClient->midi_map_name) { |
2277 |
|
free(pClient->midi_map_name); |
2278 |
|
pClient->midi_map_name = NULL; |
2279 |
|
} |
2280 |
|
|
2281 |
|
sprintf(szQuery, "GET MIDI_INSTRUMENT_MAP INFO %d\r\n", iMidiMap); |
2282 |
|
if (lscp_client_call(pClient, szQuery, 1) == LSCP_OK) { |
2283 |
|
pszResult = lscp_client_get_result(pClient); |
2284 |
|
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
2285 |
|
while (pszToken) { |
2286 |
|
if (strcasecmp(pszToken, "NAME") == 0) { |
2287 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2288 |
|
if (pszToken) |
2289 |
|
lscp_unquote_dup(&(pClient->midi_map_name), &pszToken); |
2290 |
|
} |
2291 |
|
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
2292 |
|
} |
2293 |
|
} |
2294 |
|
|
2295 |
|
// Unlock this section down. |
2296 |
|
lscp_mutex_unlock(pClient->mutex); |
2297 |
|
|
2298 |
|
return pClient->midi_map_name; |
2299 |
|
} |
2300 |
|
|
2301 |
|
|
2302 |
|
/** |
2303 |
|
* Renaming a MIDI instrument map: |
2304 |
|
* SET MIDI_INSTRUMENT_MAP NAME <midi-map> <map-name> |
2305 |
|
* |
2306 |
|
* @param pClient Pointer to client instance structure. |
2307 |
|
* @param iMidiMap MIDI instrument map number. |
2308 |
|
* @param pszMapName MIDI instrument map name. |
2309 |
|
* |
2310 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2311 |
|
*/ |
2312 |
|
lscp_status_t lscp_set_midi_instrument_map_name ( lscp_client_t *pClient, int iMidiMap, const char *pszMapName ) |
2313 |
|
{ |
2314 |
|
char szQuery[LSCP_BUFSIZ]; |
2315 |
|
|
2316 |
|
if (iMidiMap < 0) |
2317 |
|
return LSCP_FAILED; |
2318 |
|
if (pszMapName == NULL) |
2319 |
|
return LSCP_FAILED; |
2320 |
|
|
2321 |
|
sprintf(szQuery, "SET MIDI_INSTRUMENT_MAP NAME %d '%s'\r\n", |
2322 |
|
iMidiMap, pszMapName); |
2323 |
|
|
2324 |
|
return lscp_client_query(pClient, szQuery); |
2325 |
|
} |
2326 |
|
|
2327 |
|
|
2328 |
|
/** |
2329 |
* Create or replace a MIDI instrumnet map entry: |
* Create or replace a MIDI instrumnet map entry: |
2330 |
* MAP MIDI_INSTRUMENT <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
* MAP MIDI_INSTRUMENT <midi-map> <midi-bank> <midi-prog> |
2331 |
* <engine-name> <filename> <instr-index> <volume> <load-mode> [<name>] |
* <engine-name> <filename> <instr-index> <volume> [<load-mode> [<name>]} |
2332 |
* |
* |
2333 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2334 |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
2344 |
* @ref LSCP_LOAD_ON_DEMAND, or |
* @ref LSCP_LOAD_ON_DEMAND, or |
2345 |
* @ref LSCP_LOAD_ON_DEMAND_HOLD, or |
* @ref LSCP_LOAD_ON_DEMAND_HOLD, or |
2346 |
* @ref LSCP_LOAD_PERSISTENT. |
* @ref LSCP_LOAD_PERSISTENT. |
2347 |
* @param pszName Instrument custom name for the map entry. |
* @param pszName Instrument custom name for the map entry (optional). |
2348 |
* |
* |
2349 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2350 |
*/ |
*/ |
2351 |
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, lscp_midi_instrument_t *pMidiInstr, const char *pszEngineName, const char *pszFileName, int iInstrIndex, float fVolume, lscp_load_mode_t load_mode, const char *pszName ) |
2352 |
{ |
{ |
2353 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2354 |
|
|
2355 |
if (pMidiInstr->bank_msb < 0 || pMidiInstr->bank_msb > 127) |
if (pMidiInstr->map < 0) |
2356 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2357 |
if (pMidiInstr->bank_lsb < 0 || pMidiInstr->bank_lsb > 127) |
if (pMidiInstr->bank < 0 || pMidiInstr->bank > 16383) |
2358 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2359 |
if (pMidiInstr->program < 0 || pMidiInstr->program > 127) |
if (pMidiInstr->prog < 0 || pMidiInstr->prog > 127) |
2360 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2361 |
if (pszEngineName == NULL || pszFileName == NULL) |
if (pszEngineName == NULL || pszFileName == NULL) |
2362 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2363 |
|
|
2364 |
if (fVolume < 0.0f) |
if (fVolume < 0.0f) |
2365 |
fVolume = 1.0f; |
fVolume = 1.0f; |
2366 |
|
|
2367 |
sprintf(szQuery, "MAP MIDI_INSTRUMENT %d %d %d %s '%s' %d %g", |
sprintf(szQuery, "MAP MIDI_INSTRUMENT %d %d %d %s '%s' %d %g", |
2368 |
pMidiInstr->bank_msb, pMidiInstr->bank_lsb, pMidiInstr->program, |
pMidiInstr->map, pMidiInstr->bank, pMidiInstr->prog, |
2369 |
pszEngineName, pszFileName, iInstrIndex, fVolume); |
pszEngineName, pszFileName, iInstrIndex, fVolume); |
2370 |
|
|
2371 |
switch (load_mode) { |
switch (load_mode) { |
2372 |
case LSCP_LOAD_PERSISTENT: |
case LSCP_LOAD_PERSISTENT: |
2373 |
strcat(szQuery, " PERSISTENT"); |
strcat(szQuery, " PERSISTENT"); |
2376 |
strcat(szQuery, " ON_DEMAND_HOLD"); |
strcat(szQuery, " ON_DEMAND_HOLD"); |
2377 |
break; |
break; |
2378 |
case LSCP_LOAD_ON_DEMAND: |
case LSCP_LOAD_ON_DEMAND: |
2379 |
strcat(szQuery, " ON_DEMAND_HOLD"); |
strcat(szQuery, " ON_DEMAND"); |
2380 |
break; |
break; |
2381 |
case LSCP_LOAD_DEFAULT: |
case LSCP_LOAD_DEFAULT: |
2382 |
default: |
default: |
2383 |
break; |
break; |
2384 |
} |
} |
2385 |
|
|
2386 |
if (pszName) |
if (pszName) |
2387 |
sprintf(szQuery + strlen(szQuery), " '%s'", pszName); |
sprintf(szQuery + strlen(szQuery), " '%s'", pszName); |
2388 |
|
|
2389 |
strcat(szQuery, "\r\n"); |
strcat(szQuery, "\r\n"); |
2390 |
|
|
2391 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2392 |
} |
} |
2393 |
|
|
2394 |
|
|
2395 |
/** |
/** |
2396 |
* Remove an entry from the MIDI instrument map: |
* Remove an entry from the MIDI instrument map: |
2397 |
* UNMAP MIDI_INSTRUMENT <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
* UNMAP MIDI_INSTRUMENT <midi-map> <midi-bank> <midi-prog> |
2398 |
* |
* |
2399 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2400 |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
2405 |
{ |
{ |
2406 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2407 |
|
|
2408 |
if (pMidiInstr->bank_msb < 0 || pMidiInstr->bank_msb > 127) |
if (pMidiInstr->map < 0) |
2409 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2410 |
if (pMidiInstr->bank_lsb < 0 || pMidiInstr->bank_lsb > 127) |
if (pMidiInstr->bank < 0 || pMidiInstr->bank > 16383) |
2411 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2412 |
if (pMidiInstr->program < 0 || pMidiInstr->program > 127) |
if (pMidiInstr->prog < 0 || pMidiInstr->prog > 127) |
2413 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2414 |
|
|
2415 |
sprintf(szQuery, "UNMAP MIDI_INSTRUMENT %d %d %d\r\n", |
sprintf(szQuery, "UNMAP MIDI_INSTRUMENT %d %d %d\r\n", |
2416 |
pMidiInstr->bank_msb, pMidiInstr->bank_lsb, pMidiInstr->program); |
pMidiInstr->map, pMidiInstr->bank, pMidiInstr->prog); |
2417 |
|
|
2418 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2419 |
} |
} |
2421 |
|
|
2422 |
/** |
/** |
2423 |
* Get the total count of MIDI instrument map entries: |
* Get the total count of MIDI instrument map entries: |
2424 |
* GET MIDI_INSTRUMENTS |
* GET MIDI_INSTRUMENTS ALL|<midi-map> |
2425 |
* |
* |
2426 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2427 |
|
* @param iMidiMap MIDI instrument map number, or @ref LSCP_MIDI_MAP_ALL . |
2428 |
* |
* |
2429 |
* @returns The current total number of MIDI instrument map entries |
* @returns The current total number of MIDI instrument map entries |
2430 |
* on success, -1 otherwise. |
* on success, -1 otherwise. |
2431 |
*/ |
*/ |
2432 |
int lscp_get_midi_instruments ( lscp_client_t *pClient ) |
int lscp_get_midi_instruments ( lscp_client_t *pClient, int iMidiMap ) |
2433 |
{ |
{ |
2434 |
int iInstruments = -1; |
int iInstruments = -1; |
2435 |
|
char szQuery[LSCP_BUFSIZ]; |
2436 |
|
|
2437 |
|
if (pClient == NULL) |
2438 |
|
return -1; |
2439 |
|
|
2440 |
// Lock this section up. |
// Lock this section up. |
2441 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
2442 |
|
|
2443 |
if (lscp_client_call(pClient, "GET MIDI_INSTRUMENTS\r\n", 0) == LSCP_OK) |
strcpy(szQuery, "GET MIDI_INSTRUMENTS "); |
2444 |
|
|
2445 |
|
if (iMidiMap < 0) |
2446 |
|
strcat(szQuery, "ALL"); |
2447 |
|
else |
2448 |
|
sprintf(szQuery + strlen(szQuery), "%d", iMidiMap); |
2449 |
|
|
2450 |
|
strcat(szQuery, "\r\n"); |
2451 |
|
|
2452 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
2453 |
iInstruments = atoi(lscp_client_get_result(pClient)); |
iInstruments = atoi(lscp_client_get_result(pClient)); |
2454 |
|
|
2455 |
// Unlock this section down. |
// Unlock this section down. |
2461 |
|
|
2462 |
/** |
/** |
2463 |
* Getting indeces of all MIDI instrument map entries: |
* Getting indeces of all MIDI instrument map entries: |
2464 |
* LIST MIDI_INSTRUMENTS |
* LIST MIDI_INSTRUMENTS ALL|<midi-map> |
2465 |
* |
* |
2466 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2467 |
|
* @param iMidiMap MIDI instrument map number, or @ref LSCP_MIDI_MAP_ALL . |
2468 |
* |
* |
2469 |
* @returns An array of @ref lscp_midi_instrument_t, terminated with the |
* @returns An array of @ref lscp_midi_instrument_t, terminated with the |
2470 |
* {-1,-1,-1} triplet, NULL otherwise. |
* {-1,-1,-1} triplet, NULL otherwise. |
2471 |
*/ |
*/ |
2472 |
lscp_midi_instrument_t *lscp_list_midi_instruments ( lscp_client_t *pClient ) |
lscp_midi_instrument_t *lscp_list_midi_instruments ( lscp_client_t *pClient, int iMidiMap ) |
2473 |
{ |
{ |
2474 |
|
char szQuery[LSCP_BUFSIZ]; |
2475 |
|
|
2476 |
if (pClient == NULL) |
if (pClient == NULL) |
2477 |
return NULL; |
return NULL; |
2478 |
|
|
2484 |
pClient->midi_instruments = NULL; |
pClient->midi_instruments = NULL; |
2485 |
} |
} |
2486 |
|
|
2487 |
if (lscp_client_call(pClient, "LIST MIDI_INSTRUMENTS\r\n", 0) == LSCP_OK) |
strcpy(szQuery, "LIST MIDI_INSTRUMENTS "); |
2488 |
|
|
2489 |
|
if (iMidiMap < 0) |
2490 |
|
strcat(szQuery, "ALL"); |
2491 |
|
else |
2492 |
|
sprintf(szQuery + strlen(szQuery), "%d", iMidiMap); |
2493 |
|
|
2494 |
|
strcat(szQuery, "\r\n"); |
2495 |
|
|
2496 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
2497 |
pClient->midi_instruments = lscp_midi_instruments_create(lscp_client_get_result(pClient)); |
pClient->midi_instruments = lscp_midi_instruments_create(lscp_client_get_result(pClient)); |
2498 |
|
|
2499 |
// Unlock this section down. |
// Unlock this section down. |
2505 |
|
|
2506 |
/** |
/** |
2507 |
* Getting information about a MIDI instrument map entry: |
* Getting information about a MIDI instrument map entry: |
2508 |
* GET MIDI_INSTRUMENT INFO <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
* GET MIDI_INSTRUMENT INFO <midi-map> <midi-bank> <midi-prog> |
2509 |
* |
* |
2510 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2511 |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
2523 |
const char *pszCrlf = "\r\n"; |
const char *pszCrlf = "\r\n"; |
2524 |
char *pszToken; |
char *pszToken; |
2525 |
char *pch; |
char *pch; |
2526 |
|
|
2527 |
if (pMidiInstr->bank_msb < 0 || pMidiInstr->bank_msb > 127) |
if (pClient == NULL) |
2528 |
return NULL; |
return NULL; |
2529 |
if (pMidiInstr->bank_lsb < 0 || pMidiInstr->bank_lsb > 127) |
if (pMidiInstr->map < 0) |
2530 |
return NULL; |
return NULL; |
2531 |
if (pMidiInstr->program < 0 || pMidiInstr->program > 127) |
if (pMidiInstr->bank < 0 || pMidiInstr->bank > 16383) |
2532 |
return NULL; |
return NULL; |
2533 |
|
if (pMidiInstr->prog < 0 || pMidiInstr->prog > 127) |
2534 |
|
return NULL; |
2535 |
|
|
2536 |
// Lock this section up. |
// Lock this section up. |
2537 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
2538 |
|
|
2539 |
pInstrInfo = &(pClient->midi_instrument_info); |
pInstrInfo = &(pClient->midi_instrument_info); |
2540 |
lscp_midi_instrument_info_reset(pInstrInfo); |
lscp_midi_instrument_info_reset(pInstrInfo); |
2541 |
|
|
2542 |
sprintf(szQuery, "GET MIDI_INSTRUMENT INFO %d %d %d\r\n", |
sprintf(szQuery, "GET MIDI_INSTRUMENT INFO %d %d %d\r\n", |
2543 |
pMidiInstr->bank_msb, pMidiInstr->bank_lsb, pMidiInstr->program); |
pMidiInstr->map, pMidiInstr->bank, pMidiInstr->prog); |
2544 |
if (lscp_client_call(pClient, szQuery, 1) == LSCP_OK) { |
if (lscp_client_call(pClient, szQuery, 1) == LSCP_OK) { |
2545 |
pszResult = lscp_client_get_result(pClient); |
pszResult = lscp_client_get_result(pClient); |
2546 |
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
2595 |
} |
} |
2596 |
} |
} |
2597 |
else pInstrInfo = NULL; |
else pInstrInfo = NULL; |
2598 |
|
|
2599 |
// Unlock this section down. |
// Unlock this section down. |
2600 |
lscp_mutex_unlock(pClient->mutex); |
lscp_mutex_unlock(pClient->mutex); |
2601 |
|
|
2602 |
return pInstrInfo; |
return pInstrInfo; |
2603 |
} |
} |
2604 |
|
|
2605 |
|
|
2606 |
/** |
/** |
2607 |
* Clear the MIDI instrumnet map: |
* Clear the MIDI instrumnet map: |
2608 |
* CLEAR MIDI_INSTRUMENTS |
* CLEAR MIDI_INSTRUMENTS ALL|<midi-map> |
2609 |
* |
* |
2610 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2611 |
* @param iSamplerChannel Sampler channel number. |
* @param iMidiMap MIDI instrument map number, or @ref LSCP_MIDI_MAP_ALL . |
2612 |
* |
* |
2613 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2614 |
*/ |
*/ |
2615 |
lscp_status_t lscp_clear_midi_instruments ( lscp_client_t *pClient ) |
lscp_status_t lscp_clear_midi_instruments ( lscp_client_t *pClient, int iMidiMap ) |
2616 |
{ |
{ |
2617 |
return lscp_client_query(pClient, "CLEAR MIDI_INSTRUMENTS\r\n"); |
char szQuery[LSCP_BUFSIZ]; |
2618 |
|
|
2619 |
|
strcpy(szQuery, "CLEAR MIDI_INSTRUMENTS "); |
2620 |
|
|
2621 |
|
if (iMidiMap < 0) |
2622 |
|
strcat(szQuery, "ALL"); |
2623 |
|
else |
2624 |
|
sprintf(szQuery + strlen(szQuery), "%d", iMidiMap); |
2625 |
|
|
2626 |
|
strcat(szQuery, "\r\n"); |
2627 |
|
|
2628 |
|
return lscp_client_query(pClient, szQuery); |
2629 |
|
} |
2630 |
|
|
2631 |
|
/** |
2632 |
|
* Open an instrument editor application for the instrument on the given |
2633 |
|
* sampler channel: |
2634 |
|
* EDIT INSTRUMENT <sampler-channel> |
2635 |
|
* |
2636 |
|
* @param pClient Pointer to client instance structure. |
2637 |
|
* @param iSamplerChannel Sampler Channel. |
2638 |
|
* |
2639 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2640 |
|
*/ |
2641 |
|
lscp_status_t lscp_edit_instrument (lscp_client_t *pClient, int iSamplerChannel) |
2642 |
|
{ |
2643 |
|
char szQuery[LSCP_BUFSIZ]; |
2644 |
|
snprintf(szQuery, LSCP_BUFSIZ, "EDIT INSTRUMENT %d\r\n", iSamplerChannel); |
2645 |
|
return lscp_client_query(pClient, szQuery); |
2646 |
} |
} |
2647 |
|
|
2648 |
|
|