3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2009 Christian Schoenebeck * |
* Copyright (C) 2005 - 2010 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
138 |
LSCPEvent::RegisterEvent(LSCPEvent::event_global_info, "GLOBAL_INFO"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_global_info, "GLOBAL_INFO"); |
139 |
LSCPEvent::RegisterEvent(LSCPEvent::event_channel_midi, "CHANNEL_MIDI"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_channel_midi, "CHANNEL_MIDI"); |
140 |
LSCPEvent::RegisterEvent(LSCPEvent::event_device_midi, "DEVICE_MIDI"); |
LSCPEvent::RegisterEvent(LSCPEvent::event_device_midi, "DEVICE_MIDI"); |
141 |
|
LSCPEvent::RegisterEvent(LSCPEvent::event_fx_instance_count, "EFFECT_INSTANCE_COUNT"); |
142 |
|
LSCPEvent::RegisterEvent(LSCPEvent::event_fx_instance_info, "EFFECT_INSTANCE_INFO"); |
143 |
|
LSCPEvent::RegisterEvent(LSCPEvent::event_send_fx_chain_count, "SEND_EFFECT_CHAIN_COUNT"); |
144 |
|
LSCPEvent::RegisterEvent(LSCPEvent::event_send_fx_chain_info, "SEND_EFFECT_CHAIN_INFO"); |
145 |
hSocket = -1; |
hSocket = -1; |
146 |
} |
} |
147 |
|
|
2387 |
AudioRouting += ToString(pFxSend->DestinationChannel(chan)); |
AudioRouting += ToString(pFxSend->DestinationChannel(chan)); |
2388 |
} |
} |
2389 |
|
|
2390 |
|
const String sEffectRouting = |
2391 |
|
(pFxSend->DestinationEffectChain() >= 0 && pFxSend->DestinationEffectChainPosition() >= 0) |
2392 |
|
? ToString(pFxSend->DestinationEffectChain()) + "," + ToString(pFxSend->DestinationEffectChainPosition()) |
2393 |
|
: "NONE"; |
2394 |
|
|
2395 |
// success |
// success |
2396 |
result.Add("NAME", _escapeLscpResponse(pFxSend->Name())); |
result.Add("NAME", _escapeLscpResponse(pFxSend->Name())); |
2397 |
result.Add("MIDI_CONTROLLER", pFxSend->MidiController()); |
result.Add("MIDI_CONTROLLER", pFxSend->MidiController()); |
2398 |
result.Add("LEVEL", ToString(pFxSend->Level())); |
result.Add("LEVEL", ToString(pFxSend->Level())); |
2399 |
result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting); |
result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting); |
2400 |
|
result.Add("EFFECT", sEffectRouting); |
2401 |
} catch (Exception e) { |
} catch (Exception e) { |
2402 |
result.Error(e); |
result.Error(e); |
2403 |
} |
} |
2460 |
return result.Produce(); |
return result.Produce(); |
2461 |
} |
} |
2462 |
|
|
2463 |
|
String LSCPServer::SetFxSendEffect(uint uiSamplerChannel, uint FxSendID, int iSendEffectChain, int iEffectChainPosition) { |
2464 |
|
dmsg(2,("LSCPServer: SetFxSendEffect(%d,%d)\n", iSendEffectChain, iEffectChainPosition)); |
2465 |
|
LSCPResultSet result; |
2466 |
|
try { |
2467 |
|
FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID); |
2468 |
|
|
2469 |
|
pFxSend->SetDestinationEffect(iSendEffectChain, iEffectChainPosition); |
2470 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID)); |
2471 |
|
} catch (Exception e) { |
2472 |
|
result.Error(e); |
2473 |
|
} |
2474 |
|
return result.Produce(); |
2475 |
|
} |
2476 |
|
|
2477 |
String LSCPServer::GetAvailableEffects() { |
String LSCPServer::GetAvailableEffects() { |
2478 |
dmsg(2,("LSCPServer: GetAvailableEffects()\n")); |
dmsg(2,("LSCPServer: GetAvailableEffects()\n")); |
2479 |
LSCPResultSet result; |
LSCPResultSet result; |
2534 |
return result.Produce(); |
return result.Produce(); |
2535 |
} |
} |
2536 |
|
|
2537 |
String LSCPServer::GetEffectInstanceInfo(int iEffectInstanceIndex) { |
String LSCPServer::GetEffectInstanceInfo(int iEffectInstance) { |
2538 |
dmsg(2,("LSCPServer: GetEffectInstanceInfo(%d)\n", iEffectInstanceIndex)); |
dmsg(2,("LSCPServer: GetEffectInstanceInfo(%d)\n", iEffectInstance)); |
2539 |
LSCPResultSet result; |
LSCPResultSet result; |
2540 |
try { |
try { |
2541 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstanceIndex); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2542 |
if (!pEffect) |
if (!pEffect) |
2543 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstanceIndex)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2544 |
|
|
2545 |
EffectInfo* pEffectInfo = pEffect->GetEffectInfo(); |
EffectInfo* pEffectInfo = pEffect->GetEffectInfo(); |
2546 |
|
|
2565 |
return result.Produce(); |
return result.Produce(); |
2566 |
} |
} |
2567 |
|
|
2568 |
String LSCPServer::GetEffectInstanceInputControlInfo(int iEffectInstanceIndex, int iInputControlIndex) { |
String LSCPServer::GetEffectInstanceInputControlInfo(int iEffectInstance, int iInputControlIndex) { |
2569 |
dmsg(2,("LSCPServer: GetEffectInstanceInputControlInfo(%d,%d)\n", iEffectInstanceIndex, iInputControlIndex)); |
dmsg(2,("LSCPServer: GetEffectInstanceInputControlInfo(%d,%d)\n", iEffectInstance, iInputControlIndex)); |
2570 |
LSCPResultSet result; |
LSCPResultSet result; |
2571 |
try { |
try { |
2572 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstanceIndex); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2573 |
if (!pEffect) |
if (!pEffect) |
2574 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstanceIndex)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2575 |
|
|
2576 |
EffectControl* pEffectControl = pEffect->InputControl(iInputControlIndex); |
EffectControl* pEffectControl = pEffect->InputControl(iInputControlIndex); |
2577 |
if (!pEffectControl) |
if (!pEffectControl) |
2578 |
throw Exception( |
throw Exception( |
2579 |
"Effect instance " + ToString(iEffectInstanceIndex) + |
"Effect instance " + ToString(iEffectInstance) + |
2580 |
" does not have an input control with index " + |
" does not have an input control with index " + |
2581 |
ToString(iInputControlIndex) |
ToString(iInputControlIndex) |
2582 |
); |
); |
2597 |
return result.Produce(); |
return result.Produce(); |
2598 |
} |
} |
2599 |
|
|
2600 |
String LSCPServer::SetEffectInstanceInputControl(int iEffectInstanceIndex, int iInputControlIndex, double dValue) { |
String LSCPServer::SetEffectInstanceInputControlValue(int iEffectInstance, int iInputControlIndex, double dValue) { |
2601 |
dmsg(2,("LSCPServer: SetEffectInstanceInputControl(%d,%d,%f)\n", iEffectInstanceIndex, iInputControlIndex, dValue)); |
dmsg(2,("LSCPServer: SetEffectInstanceInputControlValue(%d,%d,%f)\n", iEffectInstance, iInputControlIndex, dValue)); |
2602 |
LSCPResultSet result; |
LSCPResultSet result; |
2603 |
try { |
try { |
2604 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstanceIndex); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2605 |
if (!pEffect) |
if (!pEffect) |
2606 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstanceIndex)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2607 |
|
|
2608 |
EffectControl* pEffectControl = pEffect->InputControl(iInputControlIndex); |
EffectControl* pEffectControl = pEffect->InputControl(iInputControlIndex); |
2609 |
if (!pEffectControl) |
if (!pEffectControl) |
2610 |
throw Exception( |
throw Exception( |
2611 |
"Effect instance " + ToString(iEffectInstanceIndex) + |
"Effect instance " + ToString(iEffectInstance) + |
2612 |
" does not have an input control with index " + |
" does not have an input control with index " + |
2613 |
ToString(iInputControlIndex) |
ToString(iInputControlIndex) |
2614 |
); |
); |
2615 |
|
|
2616 |
pEffectControl->SetValue(dValue); |
pEffectControl->SetValue(dValue); |
2617 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_instance_info, iEffectInstance)); |
2618 |
} catch (Exception e) { |
} catch (Exception e) { |
2619 |
result.Error(e); |
result.Error(e); |
2620 |
} |
} |
2621 |
return result.Produce(); |
return result.Produce(); |
2622 |
} |
} |
2623 |
|
|
2624 |
String LSCPServer::CreateEffectInstance(int index) { |
String LSCPServer::CreateEffectInstance(int iEffectIndex) { |
2625 |
dmsg(2,("LSCPServer: CreateEffectInstance()\n")); |
dmsg(2,("LSCPServer: CreateEffectInstance(%d)\n", iEffectIndex)); |
2626 |
LSCPResultSet result; |
LSCPResultSet result; |
2627 |
try { |
try { |
2628 |
EffectInfo* pEffectInfo = EffectFactory::GetEffectInfo(index); |
EffectInfo* pEffectInfo = EffectFactory::GetEffectInfo(iEffectIndex); |
2629 |
if (!pEffectInfo) |
if (!pEffectInfo) |
2630 |
throw Exception("There is no effect with index " + ToString(index)); |
throw Exception("There is no effect with index " + ToString(iEffectIndex)); |
2631 |
Effect* pEffect = EffectFactory::Create(pEffectInfo); |
Effect* pEffect = EffectFactory::Create(pEffectInfo); |
2632 |
result.Add(pEffect->ID()); |
result = pEffect->ID(); // success |
2633 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_instance_count, EffectFactory::EffectInstancesCount())); |
2634 |
} catch (Exception e) { |
} catch (Exception e) { |
2635 |
result.Error(e); |
result.Error(e); |
2636 |
} |
} |
2638 |
} |
} |
2639 |
|
|
2640 |
String LSCPServer::CreateEffectInstance(String effectSystem, String module, String effectName) { |
String LSCPServer::CreateEffectInstance(String effectSystem, String module, String effectName) { |
2641 |
dmsg(2,("LSCPServer: CreateEffectInstance()\n")); |
dmsg(2,("LSCPServer: CreateEffectInstance('%s','%s','%s')\n", effectSystem.c_str(), module.c_str(), effectName.c_str())); |
2642 |
LSCPResultSet result; |
LSCPResultSet result; |
2643 |
try { |
try { |
2644 |
// to allow loading the same LSCP session file on different systems |
// to allow loading the same LSCP session file on different systems |
2677 |
|
|
2678 |
Effect* pEffect = EffectFactory::Create(pEffectInfo); |
Effect* pEffect = EffectFactory::Create(pEffectInfo); |
2679 |
result = LSCPResultSet(pEffect->ID()); |
result = LSCPResultSet(pEffect->ID()); |
2680 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_instance_count, EffectFactory::EffectInstancesCount())); |
2681 |
} catch (Exception e) { |
} catch (Exception e) { |
2682 |
result.Error(e); |
result.Error(e); |
2683 |
} |
} |
2684 |
return result.Produce(); |
return result.Produce(); |
2685 |
} |
} |
2686 |
|
|
2687 |
String LSCPServer::DestroyEffectInstance(int iEffectID) { |
String LSCPServer::DestroyEffectInstance(int iEffectInstance) { |
2688 |
dmsg(2,("LSCPServer: DestroyEffectInstance(%d)\n", iEffectID)); |
dmsg(2,("LSCPServer: DestroyEffectInstance(%d)\n", iEffectInstance)); |
2689 |
LSCPResultSet result; |
LSCPResultSet result; |
2690 |
try { |
try { |
2691 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectID); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2692 |
if (!pEffect) |
if (!pEffect) |
2693 |
throw Exception("There is no effect instance with ID " + ToString(iEffectID)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2694 |
EffectFactory::Destroy(pEffect); |
EffectFactory::Destroy(pEffect); |
2695 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_instance_count, EffectFactory::EffectInstancesCount())); |
2696 |
} catch (Exception e) { |
} catch (Exception e) { |
2697 |
result.Error(e); |
result.Error(e); |
2698 |
} |
} |
2729 |
return result.Produce(); |
return result.Produce(); |
2730 |
} |
} |
2731 |
|
|
2732 |
String LSCPServer::GetMasterEffectChains(int iAudioOutputDevice) { |
String LSCPServer::GetSendEffectChains(int iAudioOutputDevice) { |
2733 |
dmsg(2,("LSCPServer: GetMasterEffectChains(%d)\n", iAudioOutputDevice)); |
dmsg(2,("LSCPServer: GetSendEffectChains(%d)\n", iAudioOutputDevice)); |
2734 |
LSCPResultSet result; |
LSCPResultSet result; |
2735 |
try { |
try { |
2736 |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
2737 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2738 |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
2739 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2740 |
int n = pDevice->MasterEffectChainCount(); |
int n = pDevice->SendEffectChainCount(); |
2741 |
result.Add(n); |
result.Add(n); |
2742 |
} catch (Exception e) { |
} catch (Exception e) { |
2743 |
result.Error(e); |
result.Error(e); |
2745 |
return result.Produce(); |
return result.Produce(); |
2746 |
} |
} |
2747 |
|
|
2748 |
String LSCPServer::ListMasterEffectChains(int iAudioOutputDevice) { |
String LSCPServer::ListSendEffectChains(int iAudioOutputDevice) { |
2749 |
dmsg(2,("LSCPServer: ListMasterEffectChains(%d)\n", iAudioOutputDevice)); |
dmsg(2,("LSCPServer: ListSendEffectChains(%d)\n", iAudioOutputDevice)); |
2750 |
LSCPResultSet result; |
LSCPResultSet result; |
2751 |
String list; |
String list; |
2752 |
try { |
try { |
2754 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2755 |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
2756 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2757 |
int n = pDevice->MasterEffectChainCount(); |
int n = pDevice->SendEffectChainCount(); |
2758 |
for (int i = 0; i < n; i++) { |
for (int i = 0; i < n; i++) { |
2759 |
EffectChain* pEffectChain = pDevice->MasterEffectChain(i); |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
2760 |
if (i) list += ","; |
if (i) list += ","; |
2761 |
list += ToString(pEffectChain->ID()); |
list += ToString(pEffectChain->ID()); |
2762 |
} |
} |
2767 |
return result.Produce(); |
return result.Produce(); |
2768 |
} |
} |
2769 |
|
|
2770 |
String LSCPServer::AddMasterEffectChain(int iAudioOutputDevice) { |
String LSCPServer::AddSendEffectChain(int iAudioOutputDevice) { |
2771 |
dmsg(2,("LSCPServer: AddMasterEffectChain(%d)\n", iAudioOutputDevice)); |
dmsg(2,("LSCPServer: AddSendEffectChain(%d)\n", iAudioOutputDevice)); |
2772 |
LSCPResultSet result; |
LSCPResultSet result; |
2773 |
try { |
try { |
2774 |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
2775 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2776 |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
2777 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2778 |
EffectChain* pEffectChain = pDevice->AddMasterEffectChain(); |
EffectChain* pEffectChain = pDevice->AddSendEffectChain(); |
2779 |
result.Add(pEffectChain->ID()); |
result = pEffectChain->ID(); |
2780 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_send_fx_chain_count, iAudioOutputDevice, pDevice->SendEffectChainCount())); |
2781 |
} catch (Exception e) { |
} catch (Exception e) { |
2782 |
result.Error(e); |
result.Error(e); |
2783 |
} |
} |
2784 |
return result.Produce(); |
return result.Produce(); |
2785 |
} |
} |
2786 |
|
|
2787 |
String LSCPServer::RemoveMasterEffectChain(int iAudioOutputDevice, int iMasterEffectChain) { |
String LSCPServer::RemoveSendEffectChain(int iAudioOutputDevice, int iSendEffectChain) { |
2788 |
dmsg(2,("LSCPServer: RemoveMasterEffectChain(%d,%d)\n", iAudioOutputDevice, iMasterEffectChain)); |
dmsg(2,("LSCPServer: RemoveSendEffectChain(%d,%d)\n", iAudioOutputDevice, iSendEffectChain)); |
2789 |
LSCPResultSet result; |
LSCPResultSet result; |
2790 |
try { |
try { |
2791 |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
2792 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2793 |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
2794 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2795 |
for (int i = 0; i < pDevice->MasterEffectChainCount(); i++) { |
for (int i = 0; i < pDevice->SendEffectChainCount(); i++) { |
2796 |
EffectChain* pEffectChain = pDevice->MasterEffectChain(i); |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
2797 |
if (pEffectChain->ID() == iMasterEffectChain) { |
if (pEffectChain->ID() == iSendEffectChain) { |
2798 |
pDevice->RemoveMasterEffectChain(i); |
pDevice->RemoveSendEffectChain(i); |
2799 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_send_fx_chain_count, iAudioOutputDevice, pDevice->SendEffectChainCount())); |
2800 |
return result.Produce(); |
return result.Produce(); |
2801 |
} |
} |
2802 |
} |
} |
2803 |
throw Exception( |
throw Exception( |
2804 |
"There is no master effect chain with ID " + |
"There is no send effect chain with ID " + |
2805 |
ToString(iMasterEffectChain) + " for audio output device " + |
ToString(iSendEffectChain) + " for audio output device " + |
2806 |
ToString(iAudioOutputDevice) + "." |
ToString(iAudioOutputDevice) + "." |
2807 |
); |
); |
2808 |
} catch (Exception e) { |
} catch (Exception e) { |
2811 |
return result.Produce(); |
return result.Produce(); |
2812 |
} |
} |
2813 |
|
|
2814 |
static EffectChain* _getMasterEffectChain(Sampler* pSampler, int iAudioOutputDevice, int iMasterEffectChain) throw (Exception) { |
static EffectChain* _getSendEffectChain(Sampler* pSampler, int iAudioOutputDevice, int iSendEffectChain) throw (Exception) { |
2815 |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
2816 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2817 |
throw Exception( |
throw Exception( |
2819 |
ToString(iAudioOutputDevice) + "." |
ToString(iAudioOutputDevice) + "." |
2820 |
); |
); |
2821 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2822 |
for (int i = 0; i < pDevice->MasterEffectChainCount(); i++) { |
for (int i = 0; i < pDevice->SendEffectChainCount(); i++) { |
2823 |
EffectChain* pEffectChain = pDevice->MasterEffectChain(i); |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
2824 |
if (pEffectChain->ID() == iMasterEffectChain) { |
if (pEffectChain->ID() == iSendEffectChain) { |
2825 |
return pEffectChain; |
return pEffectChain; |
2826 |
} |
} |
2827 |
} |
} |
2828 |
throw Exception( |
throw Exception( |
2829 |
"There is no master effect chain with ID " + |
"There is no send effect chain with ID " + |
2830 |
ToString(iMasterEffectChain) + " for audio output device " + |
ToString(iSendEffectChain) + " for audio output device " + |
2831 |
ToString(iAudioOutputDevice) + "." |
ToString(iAudioOutputDevice) + "." |
2832 |
); |
); |
2833 |
} |
} |
2834 |
|
|
2835 |
String LSCPServer::GetMasterEffectChainInfo(int iAudioOutputDevice, int iMasterEffectChain) { |
String LSCPServer::GetSendEffectChainInfo(int iAudioOutputDevice, int iSendEffectChain) { |
2836 |
dmsg(2,("LSCPServer: GetMasterEffectChainInfo(%d,%d)\n", iAudioOutputDevice, iMasterEffectChain)); |
dmsg(2,("LSCPServer: GetSendEffectChainInfo(%d,%d)\n", iAudioOutputDevice, iSendEffectChain)); |
2837 |
LSCPResultSet result; |
LSCPResultSet result; |
2838 |
try { |
try { |
2839 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2840 |
_getMasterEffectChain(pSampler, iAudioOutputDevice, iMasterEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2841 |
String sEffectSequence; |
String sEffectSequence; |
2842 |
for (int i = 0; i < pEffectChain->EffectCount(); i++) { |
for (int i = 0; i < pEffectChain->EffectCount(); i++) { |
2843 |
if (i) sEffectSequence += ","; |
if (i) sEffectSequence += ","; |
2851 |
return result.Produce(); |
return result.Produce(); |
2852 |
} |
} |
2853 |
|
|
2854 |
String LSCPServer::AppendMasterEffectChainEffect(int iAudioOutputDevice, int iMasterEffectChain, int iEffectInstance) { |
String LSCPServer::AppendSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectInstance) { |
2855 |
dmsg(2,("LSCPServer: AppendMasterEffectChainEffect(%d,%d,%d)\n", iAudioOutputDevice, iMasterEffectChain, iEffectInstance)); |
dmsg(2,("LSCPServer: AppendSendEffectChainEffect(%d,%d,%d)\n", iAudioOutputDevice, iSendEffectChain, iEffectInstance)); |
2856 |
LSCPResultSet result; |
LSCPResultSet result; |
2857 |
try { |
try { |
2858 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2859 |
_getMasterEffectChain(pSampler, iAudioOutputDevice, iMasterEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2860 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2861 |
if (!pEffect) |
if (!pEffect) |
2862 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstance)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2863 |
pEffectChain->AppendEffect(pEffect); |
pEffectChain->AppendEffect(pEffect); |
2864 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_send_fx_chain_info, iAudioOutputDevice, iSendEffectChain, pEffectChain->EffectCount())); |
2865 |
} catch (Exception e) { |
} catch (Exception e) { |
2866 |
result.Error(e); |
result.Error(e); |
2867 |
} |
} |
2868 |
return result.Produce(); |
return result.Produce(); |
2869 |
} |
} |
2870 |
|
|
2871 |
String LSCPServer::InsertMasterEffectChainEffect(int iAudioOutputDevice, int iMasterEffectChain, int iEffectInstance, int iEffectChainPosition) { |
String LSCPServer::InsertSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectChainPosition, int iEffectInstance) { |
2872 |
dmsg(2,("LSCPServer: InsertMasterEffectChainEffect(%d,%d,%d,%d)\n", iAudioOutputDevice, iMasterEffectChain, iEffectInstance, iEffectChainPosition)); |
dmsg(2,("LSCPServer: InsertSendEffectChainEffect(%d,%d,%d,%d)\n", iAudioOutputDevice, iSendEffectChain, iEffectChainPosition, iEffectInstance)); |
2873 |
LSCPResultSet result; |
LSCPResultSet result; |
2874 |
try { |
try { |
2875 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2876 |
_getMasterEffectChain(pSampler, iAudioOutputDevice, iMasterEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2877 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2878 |
if (!pEffect) |
if (!pEffect) |
2879 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstance)); |
throw Exception("There is no effect instance with index " + ToString(iEffectInstance)); |
2880 |
pEffectChain->InsertEffect(pEffect, iEffectChainPosition); |
pEffectChain->InsertEffect(pEffect, iEffectChainPosition); |
2881 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_send_fx_chain_info, iAudioOutputDevice, iSendEffectChain, pEffectChain->EffectCount())); |
2882 |
} catch (Exception e) { |
} catch (Exception e) { |
2883 |
result.Error(e); |
result.Error(e); |
2884 |
} |
} |
2885 |
return result.Produce(); |
return result.Produce(); |
2886 |
} |
} |
2887 |
|
|
2888 |
String LSCPServer::RemoveMasterEffectChainEffect(int iAudioOutputDevice, int iMasterEffectChain, int iEffectInstance) { |
String LSCPServer::RemoveSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectChainPosition) { |
2889 |
dmsg(2,("LSCPServer: RemoveMasterEffectChainEffect(%d,%d,%d)\n", iAudioOutputDevice, iMasterEffectChain, iEffectInstance)); |
dmsg(2,("LSCPServer: RemoveSendEffectChainEffect(%d,%d,%d)\n", iAudioOutputDevice, iSendEffectChain, iEffectChainPosition)); |
2890 |
LSCPResultSet result; |
LSCPResultSet result; |
2891 |
try { |
try { |
2892 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2893 |
_getMasterEffectChain(pSampler, iAudioOutputDevice, iMasterEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2894 |
for (int i = 0; i < pEffectChain->EffectCount(); i++) { |
pEffectChain->RemoveEffect(iEffectChainPosition); |
2895 |
Effect* pEffect = pEffectChain->GetEffect(i); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_send_fx_chain_info, iAudioOutputDevice, iSendEffectChain, pEffectChain->EffectCount())); |
|
if (pEffect->ID() == iEffectInstance) { |
|
|
pEffectChain->RemoveEffect(i); |
|
|
return result.Produce(); |
|
|
} |
|
|
} |
|
|
throw Exception( |
|
|
"There is no effect instance with index " + |
|
|
ToString(iEffectInstance) |
|
|
); |
|
2896 |
} catch (Exception e) { |
} catch (Exception e) { |
2897 |
result.Error(e); |
result.Error(e); |
2898 |
} |
} |