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-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 |
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 |
|
|
578 |
// Client registration protocol functions. |
// Client registration protocol functions. |
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 |
* @e Caution: since liblscp v0.5.5.4 you have to call lscp_client_subscribe() |
583 |
* | CHANNEL_INFO | MISCELLANEOUS |
* for @e each event you want to subscribe. That is the old bitflag approach |
584 |
|
* was abondoned at this point. You can however still register all older |
585 |
|
* events with one lscp_client_subscribe() call at once. Thus, the old |
586 |
|
* behavior of this functions was not broken. Those older events are namely: |
587 |
|
* @code |
588 |
|
* SUBSCRIBE CHANNEL_COUNT | VOICE_COUNT | STREAM_COUNT |
589 |
|
* | BUFFER_FILL | CHANNEL_INFO | TOTAL_VOICE_COUNT |
590 |
|
* | AUDIO_OUTPUT_DEVICE_COUNT | AUDIO_OUTPUT_DEVICE_INFO |
591 |
|
* | MIDI_INPUT_DEVICE_COUNT | MIDI_INPUT_DEVICE_INFO |
592 |
|
* | MIDI_INSTRUMENT_MAP_COUNT | MIDI_INSTRUMENT_MAP_INFO |
593 |
|
* | MIDI_INSTRUMENT_COUNT | MIDI_INSTRUMENT_INFO |
594 |
|
* | MISCELLANEOUS |
595 |
|
* @endcode |
596 |
|
* The old events occupy the lower 16 bits (as bit flags), and all younger |
597 |
|
* events enumerate the whole upper 16 bits range. The new, enumerated |
598 |
|
* events are namely: |
599 |
|
* @code |
600 |
|
* SUBSCRIBE CHANNEL_MIDI |
601 |
|
* @endcode |
602 |
* |
* |
603 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
604 |
* @param events Bit-wise OR'ed event flags to subscribe. |
* @param events Bit-wise OR'ed event flags to subscribe. |
630 |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_BUFFER_FILL); |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_BUFFER_FILL); |
631 |
if (ret == LSCP_OK && (events & LSCP_EVENT_CHANNEL_INFO)) |
if (ret == LSCP_OK && (events & LSCP_EVENT_CHANNEL_INFO)) |
632 |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_CHANNEL_INFO); |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_CHANNEL_INFO); |
633 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_TOTAL_VOICE_COUNT)) |
634 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_TOTAL_VOICE_COUNT); |
635 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT)) |
636 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT); |
637 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO)) |
638 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO); |
639 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT)) |
640 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT); |
641 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INPUT_DEVICE_INFO)) |
642 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO); |
643 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_MAP_COUNT)) |
644 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INSTRUMENT_MAP_COUNT); |
645 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_MAP_INFO)) |
646 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INSTRUMENT_MAP_INFO); |
647 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_COUNT)) |
648 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INSTRUMENT_COUNT); |
649 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_INFO)) |
650 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MIDI_INSTRUMENT_INFO); |
651 |
if (ret == LSCP_OK && (events & LSCP_EVENT_MISCELLANEOUS)) |
if (ret == LSCP_OK && (events & LSCP_EVENT_MISCELLANEOUS)) |
652 |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MISCELLANEOUS); |
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_MISCELLANEOUS); |
653 |
|
// Caution: for the upper 16 bits, we don't use bit flags anymore ... |
654 |
|
if (ret == LSCP_OK && ((events & 0xffff0000) == LSCP_EVENT_CHANNEL_MIDI)) |
655 |
|
ret = _lscp_client_evt_request(pClient, 1, LSCP_EVENT_CHANNEL_MIDI); |
656 |
|
|
657 |
// Unlock this section down. |
// Unlock this section down. |
658 |
lscp_mutex_unlock(pClient->mutex); |
lscp_mutex_unlock(pClient->mutex); |
663 |
|
|
664 |
/** |
/** |
665 |
* Deregister frontend from receiving UDP event messages anymore: |
* Deregister frontend from receiving UDP event messages anymore: |
666 |
* SUBSCRIBE CHANNEL_COUNT | VOICE_COUNT | STREAM_COUNT | BUFFER_FILL |
* @e Caution: since liblscp v0.5.5.4 you have to call |
667 |
* | CHANNEL_INFO | MISCELLANEOUS |
* lscp_client_unsubscribe() for @e each event you want to unsubscribe. |
668 |
|
* That is the old bitflag approach was abondoned at this point. You can |
669 |
|
* however still register all older events with one lscp_client_subscribe() |
670 |
|
* call at once. Thus, the old behavior of this functions was not broken. |
671 |
|
* Those older events are namely: |
672 |
|
* @code |
673 |
|
* UNSUBSCRIBE CHANNEL_COUNT | VOICE_COUNT | STREAM_COUNT |
674 |
|
* | BUFFER_FILL | CHANNEL_INFO | TOTAL_VOICE_COUNT |
675 |
|
* | AUDIO_OUTPUT_DEVICE_COUNT | AUDIO_OUTPUT_DEVICE_INFO |
676 |
|
* | MIDI_INPUT_DEVICE_COUNT | MIDI_INPUT_DEVICE_INFO |
677 |
|
* | MIDI_INSTRUMENT_MAP_COUNT | MIDI_INSTRUMENT_MAP_INFO |
678 |
|
* | MIDI_INSTRUMENT_COUNT | MIDI_INSTRUMENT_INFO |
679 |
|
* | MISCELLANEOUS |
680 |
|
* @endcode |
681 |
|
* The old events occupy the lower 16 bits (as bit flags), and all younger |
682 |
|
* events enumerate the whole upper 16 bits range. The new, enumerated |
683 |
|
* events are namely: |
684 |
|
* @code |
685 |
|
* UNSUBSCRIBE CHANNEL_MIDI |
686 |
|
* @endcode |
687 |
* |
* |
688 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
689 |
* @param events Bit-wise OR'ed event flags to unsubscribe. |
* @param events Bit-wise OR'ed event flags to unsubscribe. |
711 |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_BUFFER_FILL); |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_BUFFER_FILL); |
712 |
if (ret == LSCP_OK && (events & LSCP_EVENT_CHANNEL_INFO)) |
if (ret == LSCP_OK && (events & LSCP_EVENT_CHANNEL_INFO)) |
713 |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_CHANNEL_INFO); |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_CHANNEL_INFO); |
714 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_TOTAL_VOICE_COUNT)) |
715 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_TOTAL_VOICE_COUNT); |
716 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT)) |
717 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT); |
718 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO)) |
719 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO); |
720 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT)) |
721 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT); |
722 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INPUT_DEVICE_INFO)) |
723 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO); |
724 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_MAP_COUNT)) |
725 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INSTRUMENT_MAP_COUNT); |
726 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_MAP_INFO)) |
727 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INSTRUMENT_MAP_INFO); |
728 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_COUNT)) |
729 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INSTRUMENT_COUNT); |
730 |
|
if (ret == LSCP_OK && (events & LSCP_EVENT_MIDI_INSTRUMENT_INFO)) |
731 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MIDI_INSTRUMENT_INFO); |
732 |
if (ret == LSCP_OK && (events & LSCP_EVENT_MISCELLANEOUS)) |
if (ret == LSCP_OK && (events & LSCP_EVENT_MISCELLANEOUS)) |
733 |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MISCELLANEOUS); |
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_MISCELLANEOUS); |
734 |
|
// Caution: for the upper 16 bits, we don't use bit flags anymore ... |
735 |
|
if (ret == LSCP_OK && ((events & 0xffff0000) == LSCP_EVENT_CHANNEL_MIDI)) |
736 |
|
ret = _lscp_client_evt_request(pClient, 0, LSCP_EVENT_CHANNEL_MIDI); |
737 |
|
|
738 |
// If necessary, close the alternate connection... |
// If necessary, close the alternate connection... |
739 |
if (pClient->events == LSCP_EVENT_NONE) |
if (pClient->events == LSCP_EVENT_NONE) |
846 |
{ |
{ |
847 |
int iChannels = -1; |
int iChannels = -1; |
848 |
|
|
849 |
|
if (pClient == NULL) |
850 |
|
return -1; |
851 |
|
|
852 |
// Lock this section up. |
// Lock this section up. |
853 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
854 |
|
|
909 |
{ |
{ |
910 |
int iSamplerChannel = -1; |
int iSamplerChannel = -1; |
911 |
|
|
912 |
|
if (pClient == NULL) |
913 |
|
return -1; |
914 |
|
|
915 |
// Lock this section up. |
// Lock this section up. |
916 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
917 |
|
|
959 |
{ |
{ |
960 |
int iAvailableEngines = -1; |
int iAvailableEngines = -1; |
961 |
|
|
962 |
|
if (pClient == NULL) |
963 |
|
return -1; |
964 |
|
|
965 |
// Lock this section up. |
// Lock this section up. |
966 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
967 |
|
|
988 |
{ |
{ |
989 |
const char *pszSeps = ","; |
const char *pszSeps = ","; |
990 |
|
|
991 |
|
if (pClient == NULL) |
992 |
|
return NULL; |
993 |
|
|
994 |
// Lock this section up. |
// Lock this section up. |
995 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
996 |
|
|
1029 |
char *pszToken; |
char *pszToken; |
1030 |
char *pch; |
char *pch; |
1031 |
|
|
1032 |
|
if (pClient == NULL) |
1033 |
|
return NULL; |
1034 |
if (pszEngineName == NULL) |
if (pszEngineName == NULL) |
1035 |
return NULL; |
return NULL; |
1036 |
|
|
1087 |
char *pszToken; |
char *pszToken; |
1088 |
char *pch; |
char *pch; |
1089 |
|
|
1090 |
|
if (pClient == NULL) |
1091 |
|
return NULL; |
1092 |
if (iSamplerChannel < 0) |
if (iSamplerChannel < 0) |
1093 |
return NULL; |
return NULL; |
1094 |
|
|
1122 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
1123 |
if (pszToken) { |
if (pszToken) { |
1124 |
if (pChannelInfo->audio_routing) |
if (pChannelInfo->audio_routing) |
1125 |
lscp_szsplit_destroy(pChannelInfo->audio_routing); |
lscp_isplit_destroy(pChannelInfo->audio_routing); |
1126 |
pChannelInfo->audio_routing = lscp_szsplit_create(pszToken, ","); |
pChannelInfo->audio_routing = lscp_isplit_create(pszToken, ","); |
1127 |
} |
} |
1128 |
} |
} |
1129 |
else if (strcasecmp(pszToken, "INSTRUMENT_FILE") == 0) { |
else if (strcasecmp(pszToken, "INSTRUMENT_FILE") == 0) { |
1166 |
pChannelInfo->midi_channel = atoi(pszToken); |
pChannelInfo->midi_channel = atoi(pszToken); |
1167 |
} |
} |
1168 |
} |
} |
1169 |
|
else if (strcasecmp(pszToken, "MIDI_INSTRUMENT_MAP") == 0) { |
1170 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
1171 |
|
if (pszToken) { |
1172 |
|
pszToken = lscp_ltrim(pszToken); |
1173 |
|
if (strcasecmp(pszToken, "NONE") == 0) |
1174 |
|
pChannelInfo->midi_map = LSCP_MIDI_MAP_NONE; |
1175 |
|
else |
1176 |
|
if (strcasecmp(pszToken, "DEFAULT") == 0) |
1177 |
|
pChannelInfo->midi_map = LSCP_MIDI_MAP_DEFAULT; |
1178 |
|
else |
1179 |
|
pChannelInfo->midi_map = atoi(pszToken); |
1180 |
|
} |
1181 |
|
} |
1182 |
else if (strcasecmp(pszToken, "VOLUME") == 0) { |
else if (strcasecmp(pszToken, "VOLUME") == 0) { |
1183 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
1184 |
if (pszToken) |
if (pszToken) |
1220 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1221 |
int iVoiceCount = -1; |
int iVoiceCount = -1; |
1222 |
|
|
1223 |
|
if (pClient == NULL) |
1224 |
|
return -1; |
1225 |
if (iSamplerChannel < 0) |
if (iSamplerChannel < 0) |
1226 |
return iVoiceCount; |
return -1; |
1227 |
|
|
1228 |
// Lock this section up. |
// Lock this section up. |
1229 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1253 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1254 |
int iStreamCount = -1; |
int iStreamCount = -1; |
1255 |
|
|
1256 |
|
if (pClient == NULL) |
1257 |
|
return -1; |
1258 |
if (iSamplerChannel < 0) |
if (iSamplerChannel < 0) |
1259 |
return iStreamCount; |
return -1; |
1260 |
|
|
1261 |
// Lock this section up. |
// Lock this section up. |
1262 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1292 |
int iStream; |
int iStream; |
1293 |
int iPercent; |
int iPercent; |
1294 |
|
|
1295 |
|
if (pClient == NULL) |
1296 |
|
return -1; |
1297 |
if (iSamplerChannel < 0) |
if (iSamplerChannel < 0) |
1298 |
return iStreamUsage; |
return -1; |
1299 |
|
|
1300 |
// Lock this section up. |
// Lock this section up. |
1301 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1356 |
|
|
1357 |
// Retrieve a channel stream estimation. |
// Retrieve a channel stream estimation. |
1358 |
iStreamCount = lscp_get_channel_stream_count(pClient, iSamplerChannel); |
iStreamCount = lscp_get_channel_stream_count(pClient, iSamplerChannel); |
1359 |
if (pClient->iStreamCount < 0) |
if (iStreamCount < 0) |
1360 |
return NULL; |
return NULL; |
1361 |
|
|
1362 |
// Lock this section up. |
// Lock this section up. |
1545 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
1546 |
* @param iSamplerChannel Sampler channel number. |
* @param iSamplerChannel Sampler channel number. |
1547 |
* @param iMidiChannel MIDI channel address number to listen (0-15) or |
* @param iMidiChannel MIDI channel address number to listen (0-15) or |
1548 |
* LSCP_MIDI_CHANNEL_ALL (16) to listen on all channels. |
* @ref LSCP_MIDI_CHANNEL_ALL (16) to listen on all channels. |
1549 |
* |
* |
1550 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1551 |
*/ |
*/ |
1565 |
|
|
1566 |
|
|
1567 |
/** |
/** |
1568 |
|
* Setting MIDI instrument map: |
1569 |
|
* SET CHANNEL MIDI_INSTRUMENT_MAP <sampler-channel> <midi-map> |
1570 |
|
* |
1571 |
|
* @param pClient Pointer to client instance structure. |
1572 |
|
* @param iSamplerChannel Sampler channel number. |
1573 |
|
* @param iMidiMap MIDI instrument map number, or either |
1574 |
|
* @ref LSCP_MIDI_MAP_NONE or |
1575 |
|
* @ref LSCP_MIDI_MAP_DEFAULT . |
1576 |
|
* |
1577 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1578 |
|
*/ |
1579 |
|
lscp_status_t lscp_set_channel_midi_map ( lscp_client_t *pClient, int iSamplerChannel, int iMidiMap ) |
1580 |
|
{ |
1581 |
|
char szQuery[LSCP_BUFSIZ]; |
1582 |
|
|
1583 |
|
if (iSamplerChannel < 0) |
1584 |
|
return LSCP_FAILED; |
1585 |
|
|
1586 |
|
sprintf(szQuery, "SET CHANNEL MIDI_INSTRUMENT_MAP %d ", iSamplerChannel); |
1587 |
|
if (iMidiMap == LSCP_MIDI_MAP_NONE) |
1588 |
|
strcat(szQuery , "NONE"); |
1589 |
|
else |
1590 |
|
if (iMidiMap == LSCP_MIDI_MAP_DEFAULT) |
1591 |
|
strcat(szQuery , "DEFAULT"); |
1592 |
|
else |
1593 |
|
sprintf(szQuery + strlen(szQuery), "%d", iMidiMap); |
1594 |
|
|
1595 |
|
strcat(szQuery, "\r\n"); |
1596 |
|
|
1597 |
|
return lscp_client_query(pClient, szQuery); |
1598 |
|
} |
1599 |
|
|
1600 |
|
|
1601 |
|
/** |
1602 |
* Setting channel volume: |
* Setting channel volume: |
1603 |
* SET CHANNEL VOLUME <sampler-channel> <volume> |
* SET CHANNEL VOLUME <sampler-channel> <volume> |
1604 |
* |
* |
1614 |
{ |
{ |
1615 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
1616 |
|
|
1617 |
if (iSamplerChannel < 0 || fVolume < 0.0) |
if (iSamplerChannel < 0 || fVolume < 0.0f) |
1618 |
return LSCP_FAILED; |
return LSCP_FAILED; |
1619 |
|
|
1620 |
sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n", iSamplerChannel, fVolume); |
sprintf(szQuery, "SET CHANNEL VOLUME %d %g\r\n", iSamplerChannel, fVolume); |
1701 |
*/ |
*/ |
1702 |
lscp_status_t lscp_reset_sampler ( lscp_client_t *pClient ) |
lscp_status_t lscp_reset_sampler ( lscp_client_t *pClient ) |
1703 |
{ |
{ |
1704 |
|
// Do actual whole sampler reset... |
1705 |
return lscp_client_query(pClient, "RESET\r\n"); |
return lscp_client_query(pClient, "RESET\r\n"); |
1706 |
} |
} |
1707 |
|
|
1724 |
char *pszToken; |
char *pszToken; |
1725 |
char *pch; |
char *pch; |
1726 |
|
|
1727 |
|
if (pClient == NULL) |
1728 |
|
return NULL; |
1729 |
|
|
1730 |
// Lock this section up. |
// Lock this section up. |
1731 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1732 |
|
|
1747 |
if (pszToken) |
if (pszToken) |
1748 |
lscp_unquote_dup(&(pServerInfo->version), &pszToken); |
lscp_unquote_dup(&(pServerInfo->version), &pszToken); |
1749 |
} |
} |
1750 |
|
else if (strcasecmp(pszToken, "PROTOCOL_VERSION") == 0) { |
1751 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
1752 |
|
if (pszToken) |
1753 |
|
lscp_unquote_dup(&(pServerInfo->protocol_version), &pszToken); |
1754 |
|
} |
1755 |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
1756 |
} |
} |
1757 |
} |
} |
1777 |
{ |
{ |
1778 |
int iVoiceCount = -1; |
int iVoiceCount = -1; |
1779 |
|
|
1780 |
|
if (pClient == NULL) |
1781 |
|
return -1; |
1782 |
|
|
1783 |
// Lock this section up. |
// Lock this section up. |
1784 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1785 |
|
|
1806 |
{ |
{ |
1807 |
int iVoiceCount = -1; |
int iVoiceCount = -1; |
1808 |
|
|
1809 |
|
if (pClient == NULL) |
1810 |
|
return -1; |
1811 |
|
|
1812 |
// Lock this section up. |
// Lock this section up. |
1813 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
1814 |
|
|
1823 |
|
|
1824 |
|
|
1825 |
/** |
/** |
1826 |
|
* Get global volume attenuation: |
1827 |
|
* GET VOLUME |
1828 |
|
* |
1829 |
|
* @param pClient Pointer to client instance structure. |
1830 |
|
* |
1831 |
|
* @returns The global volume as positive floating point value usually in |
1832 |
|
* the range between 0.0 and 1.0; in case of failure 0.0 is returned. |
1833 |
|
*/ |
1834 |
|
float lscp_get_volume ( lscp_client_t *pClient ) |
1835 |
|
{ |
1836 |
|
float fVolume = 0.0f; |
1837 |
|
|
1838 |
|
if (pClient == NULL) |
1839 |
|
return 0.0f; |
1840 |
|
|
1841 |
|
// Lock this section up. |
1842 |
|
lscp_mutex_lock(pClient->mutex); |
1843 |
|
|
1844 |
|
if (lscp_client_call(pClient, "GET VOLUME\r\n", 0) == LSCP_OK) |
1845 |
|
fVolume = (float) atof(lscp_client_get_result(pClient)); |
1846 |
|
|
1847 |
|
// Unlock this section down. |
1848 |
|
lscp_mutex_unlock(pClient->mutex); |
1849 |
|
|
1850 |
|
return fVolume; |
1851 |
|
} |
1852 |
|
|
1853 |
|
|
1854 |
|
/** |
1855 |
|
* Setting global volume attenuation: |
1856 |
|
* SET VOLUME <volume> |
1857 |
|
* |
1858 |
|
* @param pClient Pointer to client instance structure. |
1859 |
|
* @param fVolume Global volume parameter as positive floating point |
1860 |
|
* value usually be in the range between 0.0 and 1.0, |
1861 |
|
* that is for attenuating the overall volume. |
1862 |
|
* |
1863 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1864 |
|
*/ |
1865 |
|
lscp_status_t lscp_set_volume ( lscp_client_t *pClient, float fVolume ) |
1866 |
|
{ |
1867 |
|
char szQuery[LSCP_BUFSIZ]; |
1868 |
|
|
1869 |
|
if (fVolume < 0.0f) |
1870 |
|
return LSCP_FAILED; |
1871 |
|
|
1872 |
|
sprintf(szQuery, "SET VOLUME %g\r\n", fVolume); |
1873 |
|
return lscp_client_query(pClient, szQuery); |
1874 |
|
} |
1875 |
|
|
1876 |
|
|
1877 |
|
/** |
1878 |
|
* Add an effect send to a sampler channel: |
1879 |
|
* CREATE FX_SEND <sampler-channel> <midi-ctrl> [<name>] |
1880 |
|
* |
1881 |
|
* @param pClient Pointer to client instance structure. |
1882 |
|
* @param iSamplerChannel Sampler channel number. |
1883 |
|
* @param iMidiController MIDI controller used to alter the effect, |
1884 |
|
* usually a number between 0 and 127. |
1885 |
|
* @param pszName Optional name for the effect send entity, |
1886 |
|
* does not have to be unique. |
1887 |
|
* |
1888 |
|
* @returns The new effect send number identifier, or -1 in case of failure. |
1889 |
|
*/ |
1890 |
|
int lscp_create_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iMidiController, const char *pszFxName ) |
1891 |
|
{ |
1892 |
|
int iFxSend = -1; |
1893 |
|
char szQuery[LSCP_BUFSIZ]; |
1894 |
|
|
1895 |
|
if (pClient == NULL) |
1896 |
|
return -1; |
1897 |
|
if (iSamplerChannel < 0 || iMidiController < 0 || iMidiController > 127) |
1898 |
|
return -1; |
1899 |
|
|
1900 |
|
// Lock this section up. |
1901 |
|
lscp_mutex_lock(pClient->mutex); |
1902 |
|
|
1903 |
|
sprintf(szQuery, "CREATE FX_SEND %d %d", iSamplerChannel, iMidiController); |
1904 |
|
|
1905 |
|
if (pszFxName) |
1906 |
|
sprintf(szQuery + strlen(szQuery), " '%s'", pszFxName); |
1907 |
|
|
1908 |
|
strcat(szQuery, "\r\n"); |
1909 |
|
|
1910 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
1911 |
|
iFxSend = atoi(lscp_client_get_result(pClient)); |
1912 |
|
|
1913 |
|
// Unlock this section down. |
1914 |
|
lscp_mutex_unlock(pClient->mutex); |
1915 |
|
|
1916 |
|
return iFxSend; |
1917 |
|
} |
1918 |
|
|
1919 |
|
|
1920 |
|
/** |
1921 |
|
* Remove an effect send from a sampler channel: |
1922 |
|
* DESTROY FX_SEND <sampler-channel> <fx-send-id> |
1923 |
|
* |
1924 |
|
* @param pClient Pointer to client instance structure. |
1925 |
|
* @param iSamplerChannel Sampler channel number. |
1926 |
|
* @param iFxSend Effect send number. |
1927 |
|
* |
1928 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
1929 |
|
*/ |
1930 |
|
lscp_status_t lscp_destroy_fxsend ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend ) |
1931 |
|
{ |
1932 |
|
char szQuery[LSCP_BUFSIZ]; |
1933 |
|
|
1934 |
|
if (iSamplerChannel < 0 || iFxSend < 0) |
1935 |
|
return LSCP_FAILED; |
1936 |
|
|
1937 |
|
sprintf(szQuery, "DESTROY FX_SEND %d %d\r\n", iSamplerChannel, iFxSend); |
1938 |
|
|
1939 |
|
return lscp_client_query(pClient, szQuery); |
1940 |
|
} |
1941 |
|
|
1942 |
|
|
1943 |
|
/** |
1944 |
|
* Get amount of effect sends on a sampler channel: |
1945 |
|
* GET FX_SENDS <sampler-channel> |
1946 |
|
* |
1947 |
|
* @param pClient Pointer to client instance structure. |
1948 |
|
* @param iSamplerChannel Sampler channel number. |
1949 |
|
* |
1950 |
|
* @returns The current total number of effect sends of the sampler channel |
1951 |
|
* on success, -1 otherwise. |
1952 |
|
*/ |
1953 |
|
int lscp_get_fxsends ( lscp_client_t *pClient, int iSamplerChannel ) |
1954 |
|
{ |
1955 |
|
int iFxSends = -1; |
1956 |
|
char szQuery[LSCP_BUFSIZ]; |
1957 |
|
|
1958 |
|
if (pClient == NULL) |
1959 |
|
return -1; |
1960 |
|
if (iSamplerChannel < 0) |
1961 |
|
return -1; |
1962 |
|
|
1963 |
|
// Lock this section up. |
1964 |
|
lscp_mutex_lock(pClient->mutex); |
1965 |
|
|
1966 |
|
sprintf(szQuery, "GET FX_SENDS %d\r\n", iSamplerChannel); |
1967 |
|
|
1968 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
1969 |
|
iFxSends = atoi(lscp_client_get_result(pClient)); |
1970 |
|
|
1971 |
|
// Unlock this section doen. |
1972 |
|
lscp_mutex_unlock(pClient->mutex); |
1973 |
|
|
1974 |
|
return iFxSends; |
1975 |
|
} |
1976 |
|
|
1977 |
|
|
1978 |
|
/** |
1979 |
|
* List all effect sends on a sampler channel: |
1980 |
|
* LIST FX_SENDS <sampler-channel> |
1981 |
|
* |
1982 |
|
* @param pClient Pointer to client instance structure. |
1983 |
|
* @param iSamplerChannel Sampler channel number. |
1984 |
|
* |
1985 |
|
* @returns An array of the effect sends identifiers as positive integers, |
1986 |
|
* terminated with -1 on success, NULL otherwise. |
1987 |
|
*/ |
1988 |
|
int *lscp_list_fxsends ( lscp_client_t *pClient, int iSamplerChannel ) |
1989 |
|
{ |
1990 |
|
const char *pszSeps = ","; |
1991 |
|
char szQuery[LSCP_BUFSIZ]; |
1992 |
|
|
1993 |
|
if (pClient == NULL) |
1994 |
|
return NULL; |
1995 |
|
|
1996 |
|
// Lock this section up. |
1997 |
|
lscp_mutex_lock(pClient->mutex); |
1998 |
|
|
1999 |
|
if (pClient->fxsends) { |
2000 |
|
lscp_isplit_destroy(pClient->fxsends); |
2001 |
|
pClient->fxsends = NULL; |
2002 |
|
} |
2003 |
|
|
2004 |
|
sprintf(szQuery, "LIST FX_SENDS %d\r\n", iSamplerChannel); |
2005 |
|
|
2006 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
2007 |
|
pClient->fxsends = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps); |
2008 |
|
|
2009 |
|
// Unlock this section down. |
2010 |
|
lscp_mutex_unlock(pClient->mutex); |
2011 |
|
|
2012 |
|
return pClient->fxsends; |
2013 |
|
} |
2014 |
|
|
2015 |
|
|
2016 |
|
/** |
2017 |
|
* Getting effect send information |
2018 |
|
* GET FX_SEND INFO <sampler-channel> <fx-send-id> |
2019 |
|
* |
2020 |
|
* @param pClient Pointer to client instance structure. |
2021 |
|
* @param iSamplerChannel Sampler channel number. |
2022 |
|
* @param iFxSend Effect send number. |
2023 |
|
* |
2024 |
|
* @returns A pointer to a @ref lscp_fxsend_info_t structure, with the |
2025 |
|
* information of the given FX send, or NULL in case of failure. |
2026 |
|
*/ |
2027 |
|
lscp_fxsend_info_t *lscp_get_fxsend_info ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend ) |
2028 |
|
{ |
2029 |
|
lscp_fxsend_info_t *pFxSendInfo; |
2030 |
|
char szQuery[LSCP_BUFSIZ]; |
2031 |
|
const char *pszResult; |
2032 |
|
const char *pszSeps = ":"; |
2033 |
|
const char *pszCrlf = "\r\n"; |
2034 |
|
char *pszToken; |
2035 |
|
char *pch; |
2036 |
|
|
2037 |
|
if (pClient == NULL) |
2038 |
|
return NULL; |
2039 |
|
if (iSamplerChannel < 0 || iFxSend < 0) |
2040 |
|
return NULL; |
2041 |
|
|
2042 |
|
// Lock this section up. |
2043 |
|
lscp_mutex_lock(pClient->mutex); |
2044 |
|
|
2045 |
|
pFxSendInfo = &(pClient->fxsend_info); |
2046 |
|
lscp_fxsend_info_reset(pFxSendInfo); |
2047 |
|
|
2048 |
|
sprintf(szQuery, "GET FX_SEND INFO %d %d\r\n", iSamplerChannel, iFxSend); |
2049 |
|
if (lscp_client_call(pClient, szQuery, 1) == LSCP_OK) { |
2050 |
|
pszResult = lscp_client_get_result(pClient); |
2051 |
|
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
2052 |
|
while (pszToken) { |
2053 |
|
if (strcasecmp(pszToken, "NAME") == 0) { |
2054 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2055 |
|
if (pszToken) |
2056 |
|
lscp_unquote_dup(&(pFxSendInfo->name), &pszToken); |
2057 |
|
} |
2058 |
|
else if (strcasecmp(pszToken, "MIDI_CONTROLLER") == 0) { |
2059 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2060 |
|
if (pszToken) |
2061 |
|
pFxSendInfo->midi_controller = atoi(lscp_ltrim(pszToken)); |
2062 |
|
} |
2063 |
|
else if (strcasecmp(pszToken, "AUDIO_OUTPUT_ROUTING") == 0) { |
2064 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2065 |
|
if (pszToken) { |
2066 |
|
if (pFxSendInfo->audio_routing) |
2067 |
|
lscp_isplit_destroy(pFxSendInfo->audio_routing); |
2068 |
|
pFxSendInfo->audio_routing = lscp_isplit_create(pszToken, ","); |
2069 |
|
} |
2070 |
|
} |
2071 |
|
else if (strcasecmp(pszToken, "LEVEL") == 0) { |
2072 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2073 |
|
if (pszToken) |
2074 |
|
pFxSendInfo->level = (float) atof(lscp_ltrim(pszToken)); |
2075 |
|
} |
2076 |
|
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
2077 |
|
} |
2078 |
|
} |
2079 |
|
else pFxSendInfo = NULL; |
2080 |
|
|
2081 |
|
// Unlock this section up. |
2082 |
|
lscp_mutex_unlock(pClient->mutex); |
2083 |
|
|
2084 |
|
return pFxSendInfo; |
2085 |
|
} |
2086 |
|
|
2087 |
|
/** |
2088 |
|
* Alter effect send's name: |
2089 |
|
* @code |
2090 |
|
* SET FX_SEND NAME <sampler-chan> <fx-send-id> <name> |
2091 |
|
* @endcode |
2092 |
|
* |
2093 |
|
* @param pClient Pointer to client instance structure. |
2094 |
|
* @param iSamplerChannel Sampler channel number. |
2095 |
|
* @param iFxSend Effect send number. |
2096 |
|
* @param pszFxName Effect send's new name. |
2097 |
|
* |
2098 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2099 |
|
*/ |
2100 |
|
lscp_status_t lscp_set_fxsend_name ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, const char *pszFxName ) |
2101 |
|
{ |
2102 |
|
char szQuery[LSCP_BUFSIZ]; |
2103 |
|
|
2104 |
|
if (!pClient || iSamplerChannel < 0 || iFxSend < 0 || !pszFxName) |
2105 |
|
return LSCP_FAILED; |
2106 |
|
|
2107 |
|
snprintf(szQuery, LSCP_BUFSIZ, "SET FX_SEND NAME %d %d '%s'\r\n", iSamplerChannel, iFxSend, pszFxName); |
2108 |
|
return lscp_client_query(pClient, szQuery); |
2109 |
|
} |
2110 |
|
|
2111 |
|
/** |
2112 |
|
* Alter effect send's audio routing: |
2113 |
|
* SET FX_SEND AUDIO_OUTPUT_CHANNEL <sampler-chan> <fx-send-id> |
2114 |
|
* <audio-src> <audio-dst> |
2115 |
|
* |
2116 |
|
* @param pClient Pointer to client instance structure. |
2117 |
|
* @param iSamplerChannel Sampler channel number. |
2118 |
|
* @param iFxSend Effect send number. |
2119 |
|
* @param iAudioSrc Audio output device channel to be routed from. |
2120 |
|
* @param iAudioDst Audio output device channel to be routed into. |
2121 |
|
* |
2122 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2123 |
|
*/ |
2124 |
|
lscp_status_t lscp_set_fxsend_audio_channel ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iAudioSrc, int iAudioDst ) |
2125 |
|
{ |
2126 |
|
char szQuery[LSCP_BUFSIZ]; |
2127 |
|
|
2128 |
|
if (iSamplerChannel < 0 || iFxSend < 0 || iAudioSrc < 0 || iAudioDst < 0) |
2129 |
|
return LSCP_FAILED; |
2130 |
|
|
2131 |
|
sprintf(szQuery, "SET FX_SEND AUDIO_OUTPUT_CHANNEL %d %d %d %d\r\n", iSamplerChannel, iFxSend, iAudioSrc, iAudioDst); |
2132 |
|
return lscp_client_query(pClient, szQuery); |
2133 |
|
} |
2134 |
|
|
2135 |
|
|
2136 |
|
/** |
2137 |
|
* Alter effect send's MIDI controller: |
2138 |
|
* SET FX_SEND MIDI_CONTROLLER <sampler-chan> <fx-send-id> <midi-ctrl> |
2139 |
|
* |
2140 |
|
* @param pClient Pointer to client instance structure. |
2141 |
|
* @param iSamplerChannel Sampler channel number. |
2142 |
|
* @param iFxSend Effect send number. |
2143 |
|
* @param iMidiController MIDI controller used to alter the effect, |
2144 |
|
* usually a number between 0 and 127. |
2145 |
|
* |
2146 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2147 |
|
*/ |
2148 |
|
lscp_status_t lscp_set_fxsend_midi_controller ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, int iMidiController ) |
2149 |
|
{ |
2150 |
|
char szQuery[LSCP_BUFSIZ]; |
2151 |
|
|
2152 |
|
if (iSamplerChannel < 0 || iFxSend < 0 || iMidiController < 0 || iMidiController > 127) |
2153 |
|
return LSCP_FAILED; |
2154 |
|
|
2155 |
|
sprintf(szQuery, "SET FX_SEND MIDI_CONTROLLER %d %d %d\r\n", iSamplerChannel, iFxSend, iMidiController); |
2156 |
|
return lscp_client_query(pClient, szQuery); |
2157 |
|
} |
2158 |
|
|
2159 |
|
|
2160 |
|
/** |
2161 |
|
* Alter effect send's audio level: |
2162 |
|
* SET FX_SEND LEVEL <sampler-chan> <fx-send-id> <level> |
2163 |
|
* |
2164 |
|
* @param pClient Pointer to client instance structure. |
2165 |
|
* @param iSamplerChannel Sampler channel number. |
2166 |
|
* @param iFxSend Effect send number. |
2167 |
|
* @param fLevel Effect send volume level. |
2168 |
|
* |
2169 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2170 |
|
*/ |
2171 |
|
lscp_status_t lscp_set_fxsend_level ( lscp_client_t *pClient, int iSamplerChannel, int iFxSend, float fLevel ) |
2172 |
|
{ |
2173 |
|
char szQuery[LSCP_BUFSIZ]; |
2174 |
|
|
2175 |
|
if (iSamplerChannel < 0 || iFxSend < 0 || fLevel < 0.0f) |
2176 |
|
return LSCP_FAILED; |
2177 |
|
|
2178 |
|
sprintf(szQuery, "SET FX_SEND LEVEL %d %d %f\r\n", iSamplerChannel, iFxSend, fLevel); |
2179 |
|
return lscp_client_query(pClient, szQuery); |
2180 |
|
} |
2181 |
|
|
2182 |
|
|
2183 |
|
/** |
2184 |
|
* Create a new MIDI instrument map: |
2185 |
|
* ADD MIDI_INSTRUMENT_MAP [<name>] |
2186 |
|
* |
2187 |
|
* @param pClient Pointer to client instance structure. |
2188 |
|
* @param pszMapName MIDI instrument map name (optional) |
2189 |
|
* |
2190 |
|
* @returns The new MIDI instrument map number identifier, |
2191 |
|
* or -1 in case of failure. |
2192 |
|
*/ |
2193 |
|
int lscp_add_midi_instrument_map ( lscp_client_t *pClient, const char *pszMapName ) |
2194 |
|
{ |
2195 |
|
int iMidiMap = -1; |
2196 |
|
char szQuery[LSCP_BUFSIZ]; |
2197 |
|
|
2198 |
|
if (pClient == NULL) |
2199 |
|
return -1; |
2200 |
|
|
2201 |
|
// Lock this section up. |
2202 |
|
lscp_mutex_lock(pClient->mutex); |
2203 |
|
|
2204 |
|
strcpy(szQuery, "ADD MIDI_INSTRUMENT_MAP"); |
2205 |
|
|
2206 |
|
if (pszMapName) |
2207 |
|
sprintf(szQuery + strlen(szQuery), " '%s'", pszMapName); |
2208 |
|
|
2209 |
|
strcat(szQuery, "\r\n"); |
2210 |
|
|
2211 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
2212 |
|
iMidiMap = atoi(lscp_client_get_result(pClient)); |
2213 |
|
|
2214 |
|
// Unlock this section down. |
2215 |
|
lscp_mutex_unlock(pClient->mutex); |
2216 |
|
|
2217 |
|
return iMidiMap; |
2218 |
|
} |
2219 |
|
|
2220 |
|
|
2221 |
|
/** |
2222 |
|
* Delete one particular or all MIDI instrument maps: |
2223 |
|
* REMOVE MIDI_INSTRUMENT_MAP <midi-map> |
2224 |
|
* |
2225 |
|
* @param pClient Pointer to client instance structure. |
2226 |
|
* @param iMidiMap MIDI instrument map number. |
2227 |
|
* |
2228 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2229 |
|
*/ |
2230 |
|
lscp_status_t lscp_remove_midi_instrument_map ( lscp_client_t *pClient, int iMidiMap ) |
2231 |
|
{ |
2232 |
|
char szQuery[LSCP_BUFSIZ]; |
2233 |
|
|
2234 |
|
if (iMidiMap < 0) |
2235 |
|
return LSCP_FAILED; |
2236 |
|
|
2237 |
|
sprintf(szQuery, "REMOVE MIDI_INSTRUMENT_MAP %d\r\n", iMidiMap); |
2238 |
|
|
2239 |
|
return lscp_client_query(pClient, szQuery); |
2240 |
|
} |
2241 |
|
|
2242 |
|
|
2243 |
|
/** |
2244 |
|
* Get amount of existing MIDI instrument maps: |
2245 |
|
* GET MIDI_INSTRUMENT_MAPS |
2246 |
|
* |
2247 |
|
* @param pClient Pointer to client instance structure. |
2248 |
|
* |
2249 |
|
* @returns The current total number of MIDI instrument maps |
2250 |
|
* on success, -1 otherwise. |
2251 |
|
*/ |
2252 |
|
int lscp_get_midi_instrument_maps ( lscp_client_t *pClient ) |
2253 |
|
{ |
2254 |
|
int iMidiMaps = -1; |
2255 |
|
|
2256 |
|
if (pClient == NULL) |
2257 |
|
return -1; |
2258 |
|
|
2259 |
|
// Lock this section up. |
2260 |
|
lscp_mutex_lock(pClient->mutex); |
2261 |
|
|
2262 |
|
if (lscp_client_call(pClient, "GET MIDI_INSTRUMENT_MAPS\r\n", 0) == LSCP_OK) |
2263 |
|
iMidiMaps = atoi(lscp_client_get_result(pClient)); |
2264 |
|
|
2265 |
|
// Unlock this section doen. |
2266 |
|
lscp_mutex_unlock(pClient->mutex); |
2267 |
|
|
2268 |
|
return iMidiMaps; |
2269 |
|
} |
2270 |
|
|
2271 |
|
|
2272 |
|
/** |
2273 |
|
* Getting all created MIDI instrument maps: |
2274 |
|
* LIST MIDI_INSTRUMENT_MAPS |
2275 |
|
* |
2276 |
|
* @param pClient Pointer to client instance structure. |
2277 |
|
* |
2278 |
|
* @returns An array of the MIDI instrument map identifiers as positive |
2279 |
|
* integers, terminated with -1 on success, NULL otherwise. |
2280 |
|
*/ |
2281 |
|
int *lscp_list_midi_instrument_maps ( lscp_client_t *pClient ) |
2282 |
|
{ |
2283 |
|
const char *pszSeps = ","; |
2284 |
|
|
2285 |
|
if (pClient == NULL) |
2286 |
|
return NULL; |
2287 |
|
|
2288 |
|
// Lock this section up. |
2289 |
|
lscp_mutex_lock(pClient->mutex); |
2290 |
|
|
2291 |
|
if (pClient->midi_maps) { |
2292 |
|
lscp_isplit_destroy(pClient->midi_maps); |
2293 |
|
pClient->midi_maps = NULL; |
2294 |
|
} |
2295 |
|
|
2296 |
|
if (lscp_client_call(pClient, "LIST MIDI_INSTRUMENT_MAPS\r\n", 0) == LSCP_OK) |
2297 |
|
pClient->midi_maps = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps); |
2298 |
|
|
2299 |
|
// Unlock this section down. |
2300 |
|
lscp_mutex_unlock(pClient->mutex); |
2301 |
|
|
2302 |
|
return pClient->midi_maps; |
2303 |
|
} |
2304 |
|
|
2305 |
|
|
2306 |
|
/** |
2307 |
|
* Getting a MIDI instrument map name: |
2308 |
|
* GET MIDI_INSTRUMENT_MAP INFO <midi-map> |
2309 |
|
* |
2310 |
|
* @param pClient Pointer to client instance structure. |
2311 |
|
* @param iMidiMap MIDI instrument map number. |
2312 |
|
* |
2313 |
|
* @returns The MIDI instrument map name on success, NULL on failure. |
2314 |
|
*/ |
2315 |
|
const char *lscp_get_midi_instrument_map_name ( lscp_client_t *pClient, int iMidiMap ) |
2316 |
|
{ |
2317 |
|
char szQuery[LSCP_BUFSIZ]; |
2318 |
|
const char *pszResult; |
2319 |
|
const char *pszSeps = ":"; |
2320 |
|
const char *pszCrlf = "\r\n"; |
2321 |
|
char *pszToken; |
2322 |
|
char *pch; |
2323 |
|
|
2324 |
|
if (pClient == NULL) |
2325 |
|
return NULL; |
2326 |
|
if (iMidiMap < 0) |
2327 |
|
return NULL; |
2328 |
|
|
2329 |
|
// Lock this section up. |
2330 |
|
lscp_mutex_lock(pClient->mutex); |
2331 |
|
|
2332 |
|
if (pClient->midi_map_name) { |
2333 |
|
free(pClient->midi_map_name); |
2334 |
|
pClient->midi_map_name = NULL; |
2335 |
|
} |
2336 |
|
|
2337 |
|
sprintf(szQuery, "GET MIDI_INSTRUMENT_MAP INFO %d\r\n", iMidiMap); |
2338 |
|
if (lscp_client_call(pClient, szQuery, 1) == LSCP_OK) { |
2339 |
|
pszResult = lscp_client_get_result(pClient); |
2340 |
|
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
2341 |
|
while (pszToken) { |
2342 |
|
if (strcasecmp(pszToken, "NAME") == 0) { |
2343 |
|
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
2344 |
|
if (pszToken) |
2345 |
|
lscp_unquote_dup(&(pClient->midi_map_name), &pszToken); |
2346 |
|
} |
2347 |
|
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
2348 |
|
} |
2349 |
|
} |
2350 |
|
|
2351 |
|
// Unlock this section down. |
2352 |
|
lscp_mutex_unlock(pClient->mutex); |
2353 |
|
|
2354 |
|
return pClient->midi_map_name; |
2355 |
|
} |
2356 |
|
|
2357 |
|
|
2358 |
|
/** |
2359 |
|
* Renaming a MIDI instrument map: |
2360 |
|
* SET MIDI_INSTRUMENT_MAP NAME <midi-map> <map-name> |
2361 |
|
* |
2362 |
|
* @param pClient Pointer to client instance structure. |
2363 |
|
* @param iMidiMap MIDI instrument map number. |
2364 |
|
* @param pszMapName MIDI instrument map name. |
2365 |
|
* |
2366 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2367 |
|
*/ |
2368 |
|
lscp_status_t lscp_set_midi_instrument_map_name ( lscp_client_t *pClient, int iMidiMap, const char *pszMapName ) |
2369 |
|
{ |
2370 |
|
char szQuery[LSCP_BUFSIZ]; |
2371 |
|
|
2372 |
|
if (iMidiMap < 0) |
2373 |
|
return LSCP_FAILED; |
2374 |
|
if (pszMapName == NULL) |
2375 |
|
return LSCP_FAILED; |
2376 |
|
|
2377 |
|
sprintf(szQuery, "SET MIDI_INSTRUMENT_MAP NAME %d '%s'\r\n", |
2378 |
|
iMidiMap, pszMapName); |
2379 |
|
|
2380 |
|
return lscp_client_query(pClient, szQuery); |
2381 |
|
} |
2382 |
|
|
2383 |
|
|
2384 |
|
/** |
2385 |
* Create or replace a MIDI instrumnet map entry: |
* Create or replace a MIDI instrumnet map entry: |
2386 |
* MAP MIDI_INSTRUMENT <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
* MAP MIDI_INSTRUMENT <midi-map> <midi-bank> <midi-prog> |
2387 |
* <engine-name> <filename> <instr-index> <volume> <load-mode> [<name>] |
* <engine-name> <filename> <instr-index> <volume> [<load-mode> [<name>]} |
2388 |
* |
* |
2389 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2390 |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
2400 |
* @ref LSCP_LOAD_ON_DEMAND, or |
* @ref LSCP_LOAD_ON_DEMAND, or |
2401 |
* @ref LSCP_LOAD_ON_DEMAND_HOLD, or |
* @ref LSCP_LOAD_ON_DEMAND_HOLD, or |
2402 |
* @ref LSCP_LOAD_PERSISTENT. |
* @ref LSCP_LOAD_PERSISTENT. |
2403 |
* @param pszName Instrument custom name for the map entry. |
* @param pszName Instrument custom name for the map entry (optional). |
2404 |
* |
* |
2405 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2406 |
*/ |
*/ |
2408 |
{ |
{ |
2409 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2410 |
|
|
2411 |
if (pMidiInstr->bank_msb < 0 || pMidiInstr->bank_msb > 127) |
if (pMidiInstr->map < 0) |
2412 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2413 |
if (pMidiInstr->bank_lsb < 0 || pMidiInstr->bank_lsb > 127) |
if (pMidiInstr->bank < 0 || pMidiInstr->bank > 16383) |
2414 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2415 |
if (pMidiInstr->program < 0 || pMidiInstr->program > 127) |
if (pMidiInstr->prog < 0 || pMidiInstr->prog > 127) |
2416 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2417 |
if (pszEngineName == NULL || pszFileName == NULL) |
if (pszEngineName == NULL || pszFileName == NULL) |
2418 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2421 |
fVolume = 1.0f; |
fVolume = 1.0f; |
2422 |
|
|
2423 |
sprintf(szQuery, "MAP MIDI_INSTRUMENT %d %d %d %s '%s' %d %g", |
sprintf(szQuery, "MAP MIDI_INSTRUMENT %d %d %d %s '%s' %d %g", |
2424 |
pMidiInstr->bank_msb, pMidiInstr->bank_lsb, pMidiInstr->program, |
pMidiInstr->map, pMidiInstr->bank, pMidiInstr->prog, |
2425 |
pszEngineName, pszFileName, iInstrIndex, fVolume); |
pszEngineName, pszFileName, iInstrIndex, fVolume); |
2426 |
|
|
2427 |
switch (load_mode) { |
switch (load_mode) { |
2450 |
|
|
2451 |
/** |
/** |
2452 |
* Remove an entry from the MIDI instrument map: |
* Remove an entry from the MIDI instrument map: |
2453 |
* UNMAP MIDI_INSTRUMENT <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
* UNMAP MIDI_INSTRUMENT <midi-map> <midi-bank> <midi-prog> |
2454 |
* |
* |
2455 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2456 |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
2461 |
{ |
{ |
2462 |
char szQuery[LSCP_BUFSIZ]; |
char szQuery[LSCP_BUFSIZ]; |
2463 |
|
|
2464 |
if (pMidiInstr->bank_msb < 0 || pMidiInstr->bank_msb > 127) |
if (pMidiInstr->map < 0) |
2465 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2466 |
if (pMidiInstr->bank_lsb < 0 || pMidiInstr->bank_lsb > 127) |
if (pMidiInstr->bank < 0 || pMidiInstr->bank > 16383) |
2467 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2468 |
if (pMidiInstr->program < 0 || pMidiInstr->program > 127) |
if (pMidiInstr->prog < 0 || pMidiInstr->prog > 127) |
2469 |
return LSCP_FAILED; |
return LSCP_FAILED; |
2470 |
|
|
2471 |
sprintf(szQuery, "UNMAP MIDI_INSTRUMENT %d %d %d\r\n", |
sprintf(szQuery, "UNMAP MIDI_INSTRUMENT %d %d %d\r\n", |
2472 |
pMidiInstr->bank_msb, pMidiInstr->bank_lsb, pMidiInstr->program); |
pMidiInstr->map, pMidiInstr->bank, pMidiInstr->prog); |
2473 |
|
|
2474 |
return lscp_client_query(pClient, szQuery); |
return lscp_client_query(pClient, szQuery); |
2475 |
} |
} |
2477 |
|
|
2478 |
/** |
/** |
2479 |
* Get the total count of MIDI instrument map entries: |
* Get the total count of MIDI instrument map entries: |
2480 |
* GET MIDI_INSTRUMENTS |
* GET MIDI_INSTRUMENTS ALL|<midi-map> |
2481 |
* |
* |
2482 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2483 |
|
* @param iMidiMap MIDI instrument map number, or @ref LSCP_MIDI_MAP_ALL . |
2484 |
* |
* |
2485 |
* @returns The current total number of MIDI instrument map entries |
* @returns The current total number of MIDI instrument map entries |
2486 |
* on success, -1 otherwise. |
* on success, -1 otherwise. |
2487 |
*/ |
*/ |
2488 |
int lscp_get_midi_instruments ( lscp_client_t *pClient ) |
int lscp_get_midi_instruments ( lscp_client_t *pClient, int iMidiMap ) |
2489 |
{ |
{ |
2490 |
int iInstruments = -1; |
int iInstruments = -1; |
2491 |
|
char szQuery[LSCP_BUFSIZ]; |
2492 |
|
|
2493 |
|
if (pClient == NULL) |
2494 |
|
return -1; |
2495 |
|
|
2496 |
// Lock this section up. |
// Lock this section up. |
2497 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
2498 |
|
|
2499 |
if (lscp_client_call(pClient, "GET MIDI_INSTRUMENTS\r\n", 0) == LSCP_OK) |
strcpy(szQuery, "GET MIDI_INSTRUMENTS "); |
2500 |
|
|
2501 |
|
if (iMidiMap < 0) |
2502 |
|
strcat(szQuery, "ALL"); |
2503 |
|
else |
2504 |
|
sprintf(szQuery + strlen(szQuery), "%d", iMidiMap); |
2505 |
|
|
2506 |
|
strcat(szQuery, "\r\n"); |
2507 |
|
|
2508 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
2509 |
iInstruments = atoi(lscp_client_get_result(pClient)); |
iInstruments = atoi(lscp_client_get_result(pClient)); |
2510 |
|
|
2511 |
// Unlock this section down. |
// Unlock this section down. |
2517 |
|
|
2518 |
/** |
/** |
2519 |
* Getting indeces of all MIDI instrument map entries: |
* Getting indeces of all MIDI instrument map entries: |
2520 |
* LIST MIDI_INSTRUMENTS |
* LIST MIDI_INSTRUMENTS ALL|<midi-map> |
2521 |
* |
* |
2522 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2523 |
|
* @param iMidiMap MIDI instrument map number, or @ref LSCP_MIDI_MAP_ALL . |
2524 |
* |
* |
2525 |
* @returns An array of @ref lscp_midi_instrument_t, terminated with the |
* @returns An array of @ref lscp_midi_instrument_t, terminated with the |
2526 |
* {-1,-1,-1} triplet, NULL otherwise. |
* {-1,-1,-1} triplet, NULL otherwise. |
2527 |
*/ |
*/ |
2528 |
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 ) |
2529 |
{ |
{ |
2530 |
|
char szQuery[LSCP_BUFSIZ]; |
2531 |
|
|
2532 |
if (pClient == NULL) |
if (pClient == NULL) |
2533 |
return NULL; |
return NULL; |
2534 |
|
|
2540 |
pClient->midi_instruments = NULL; |
pClient->midi_instruments = NULL; |
2541 |
} |
} |
2542 |
|
|
2543 |
if (lscp_client_call(pClient, "LIST MIDI_INSTRUMENTS\r\n", 0) == LSCP_OK) |
strcpy(szQuery, "LIST MIDI_INSTRUMENTS "); |
2544 |
|
|
2545 |
|
if (iMidiMap < 0) |
2546 |
|
strcat(szQuery, "ALL"); |
2547 |
|
else |
2548 |
|
sprintf(szQuery + strlen(szQuery), "%d", iMidiMap); |
2549 |
|
|
2550 |
|
strcat(szQuery, "\r\n"); |
2551 |
|
|
2552 |
|
if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK) |
2553 |
pClient->midi_instruments = lscp_midi_instruments_create(lscp_client_get_result(pClient)); |
pClient->midi_instruments = lscp_midi_instruments_create(lscp_client_get_result(pClient)); |
2554 |
|
|
2555 |
// Unlock this section down. |
// Unlock this section down. |
2561 |
|
|
2562 |
/** |
/** |
2563 |
* Getting information about a MIDI instrument map entry: |
* Getting information about a MIDI instrument map entry: |
2564 |
* GET MIDI_INSTRUMENT INFO <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
* GET MIDI_INSTRUMENT INFO <midi-map> <midi-bank> <midi-prog> |
2565 |
* |
* |
2566 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2567 |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
* @param pMidiInstr MIDI instrument bank and program parameter key. |
2580 |
char *pszToken; |
char *pszToken; |
2581 |
char *pch; |
char *pch; |
2582 |
|
|
2583 |
if (pMidiInstr->bank_msb < 0 || pMidiInstr->bank_msb > 127) |
if (pClient == NULL) |
2584 |
return NULL; |
return NULL; |
2585 |
if (pMidiInstr->bank_lsb < 0 || pMidiInstr->bank_lsb > 127) |
if (pMidiInstr->map < 0) |
2586 |
return NULL; |
return NULL; |
2587 |
if (pMidiInstr->program < 0 || pMidiInstr->program > 127) |
if (pMidiInstr->bank < 0 || pMidiInstr->bank > 16383) |
2588 |
|
return NULL; |
2589 |
|
if (pMidiInstr->prog < 0 || pMidiInstr->prog > 127) |
2590 |
return NULL; |
return NULL; |
2591 |
|
|
2592 |
// Lock this section up. |
// Lock this section up. |
2596 |
lscp_midi_instrument_info_reset(pInstrInfo); |
lscp_midi_instrument_info_reset(pInstrInfo); |
2597 |
|
|
2598 |
sprintf(szQuery, "GET MIDI_INSTRUMENT INFO %d %d %d\r\n", |
sprintf(szQuery, "GET MIDI_INSTRUMENT INFO %d %d %d\r\n", |
2599 |
pMidiInstr->bank_msb, pMidiInstr->bank_lsb, pMidiInstr->program); |
pMidiInstr->map, pMidiInstr->bank, pMidiInstr->prog); |
2600 |
if (lscp_client_call(pClient, szQuery, 1) == LSCP_OK) { |
if (lscp_client_call(pClient, szQuery, 1) == LSCP_OK) { |
2601 |
pszResult = lscp_client_get_result(pClient); |
pszResult = lscp_client_get_result(pClient); |
2602 |
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
2661 |
|
|
2662 |
/** |
/** |
2663 |
* Clear the MIDI instrumnet map: |
* Clear the MIDI instrumnet map: |
2664 |
* CLEAR MIDI_INSTRUMENTS |
* CLEAR MIDI_INSTRUMENTS ALL|<midi-map> |
2665 |
* |
* |
2666 |
* @param pClient Pointer to client instance structure. |
* @param pClient Pointer to client instance structure. |
2667 |
* @param iSamplerChannel Sampler channel number. |
* @param iMidiMap MIDI instrument map number, or @ref LSCP_MIDI_MAP_ALL . |
2668 |
* |
* |
2669 |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2670 |
*/ |
*/ |
2671 |
lscp_status_t lscp_clear_midi_instruments ( lscp_client_t *pClient ) |
lscp_status_t lscp_clear_midi_instruments ( lscp_client_t *pClient, int iMidiMap ) |
2672 |
{ |
{ |
2673 |
return lscp_client_query(pClient, "CLEAR MIDI_INSTRUMENTS\r\n"); |
char szQuery[LSCP_BUFSIZ]; |
2674 |
|
|
2675 |
|
strcpy(szQuery, "CLEAR MIDI_INSTRUMENTS "); |
2676 |
|
|
2677 |
|
if (iMidiMap < 0) |
2678 |
|
strcat(szQuery, "ALL"); |
2679 |
|
else |
2680 |
|
sprintf(szQuery + strlen(szQuery), "%d", iMidiMap); |
2681 |
|
|
2682 |
|
strcat(szQuery, "\r\n"); |
2683 |
|
|
2684 |
|
return lscp_client_query(pClient, szQuery); |
2685 |
|
} |
2686 |
|
|
2687 |
|
/** |
2688 |
|
* Open an instrument editor application for the instrument |
2689 |
|
* on the given sampler channel: |
2690 |
|
* EDIT CHANNEL INSTRUMENT <sampler-channel> |
2691 |
|
* |
2692 |
|
* @param pClient Pointer to client instance structure. |
2693 |
|
* @param iSamplerChannel Sampler Channel. |
2694 |
|
* |
2695 |
|
* @returns LSCP_OK on success, LSCP_FAILED otherwise. |
2696 |
|
*/ |
2697 |
|
lscp_status_t lscp_edit_channel_instrument ( lscp_client_t *pClient, int iSamplerChannel ) |
2698 |
|
{ |
2699 |
|
char szQuery[LSCP_BUFSIZ]; |
2700 |
|
|
2701 |
|
if (iSamplerChannel < 0) |
2702 |
|
return LSCP_FAILED; |
2703 |
|
|
2704 |
|
sprintf(szQuery, "EDIT CHANNEL INSTRUMENT %d\r\n", iSamplerChannel); |
2705 |
|
|
2706 |
|
return lscp_client_query(pClient, szQuery); |
2707 |
} |
} |
2708 |
|
|
2709 |
|
|