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 * |
2383 |
AudioRouting += ToString(pFxSend->DestinationChannel(chan)); |
AudioRouting += ToString(pFxSend->DestinationChannel(chan)); |
2384 |
} |
} |
2385 |
|
|
2386 |
|
const String sEffectRouting = |
2387 |
|
(pFxSend->DestinationEffectChain() >= 0 && pFxSend->DestinationEffectChainPosition() >= 0) |
2388 |
|
? ToString(pFxSend->DestinationEffectChain()) + "," + ToString(pFxSend->DestinationEffectChainPosition()) |
2389 |
|
: "NONE"; |
2390 |
|
|
2391 |
// success |
// success |
2392 |
result.Add("NAME", _escapeLscpResponse(pFxSend->Name())); |
result.Add("NAME", _escapeLscpResponse(pFxSend->Name())); |
2393 |
result.Add("MIDI_CONTROLLER", pFxSend->MidiController()); |
result.Add("MIDI_CONTROLLER", pFxSend->MidiController()); |
2394 |
result.Add("LEVEL", ToString(pFxSend->Level())); |
result.Add("LEVEL", ToString(pFxSend->Level())); |
2395 |
result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting); |
result.Add("AUDIO_OUTPUT_ROUTING", AudioRouting); |
2396 |
|
result.Add("SEND_EFFECT", sEffectRouting); |
2397 |
} catch (Exception e) { |
} catch (Exception e) { |
2398 |
result.Error(e); |
result.Error(e); |
2399 |
} |
} |
2456 |
return result.Produce(); |
return result.Produce(); |
2457 |
} |
} |
2458 |
|
|
2459 |
|
String LSCPServer::SetFxSendEffect(uint uiSamplerChannel, uint FxSendID, int iSendEffectChain, int iEffectChainPosition) { |
2460 |
|
dmsg(2,("LSCPServer: SetFxSendEffect(%d,%d)\n", iSendEffectChain, iEffectChainPosition)); |
2461 |
|
LSCPResultSet result; |
2462 |
|
try { |
2463 |
|
FxSend* pFxSend = GetFxSend(uiSamplerChannel, FxSendID); |
2464 |
|
|
2465 |
|
pFxSend->SetDestinationEffect(iSendEffectChain, iEffectChainPosition); |
2466 |
|
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_fx_send_info, uiSamplerChannel, FxSendID)); |
2467 |
|
} catch (Exception e) { |
2468 |
|
result.Error(e); |
2469 |
|
} |
2470 |
|
return result.Produce(); |
2471 |
|
} |
2472 |
|
|
2473 |
String LSCPServer::GetAvailableEffects() { |
String LSCPServer::GetAvailableEffects() { |
2474 |
dmsg(2,("LSCPServer: GetAvailableEffects()\n")); |
dmsg(2,("LSCPServer: GetAvailableEffects()\n")); |
2475 |
LSCPResultSet result; |
LSCPResultSet result; |
2530 |
return result.Produce(); |
return result.Produce(); |
2531 |
} |
} |
2532 |
|
|
2533 |
String LSCPServer::GetEffectInstanceInfo(int iEffectInstanceIndex) { |
String LSCPServer::GetEffectInstanceInfo(int iEffectInstance) { |
2534 |
dmsg(2,("LSCPServer: GetEffectInstanceInfo(%d)\n", iEffectInstanceIndex)); |
dmsg(2,("LSCPServer: GetEffectInstanceInfo(%d)\n", iEffectInstance)); |
2535 |
LSCPResultSet result; |
LSCPResultSet result; |
2536 |
try { |
try { |
2537 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstanceIndex); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2538 |
if (!pEffect) |
if (!pEffect) |
2539 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstanceIndex)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2540 |
|
|
2541 |
EffectInfo* pEffectInfo = pEffect->GetEffectInfo(); |
EffectInfo* pEffectInfo = pEffect->GetEffectInfo(); |
2542 |
|
|
2561 |
return result.Produce(); |
return result.Produce(); |
2562 |
} |
} |
2563 |
|
|
2564 |
String LSCPServer::GetEffectInstanceInputControlInfo(int iEffectInstanceIndex, int iInputControlIndex) { |
String LSCPServer::GetEffectInstanceInputControlInfo(int iEffectInstance, int iInputControlIndex) { |
2565 |
dmsg(2,("LSCPServer: GetEffectInstanceInputControlInfo(%d,%d)\n", iEffectInstanceIndex, iInputControlIndex)); |
dmsg(2,("LSCPServer: GetEffectInstanceInputControlInfo(%d,%d)\n", iEffectInstance, iInputControlIndex)); |
2566 |
LSCPResultSet result; |
LSCPResultSet result; |
2567 |
try { |
try { |
2568 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstanceIndex); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2569 |
if (!pEffect) |
if (!pEffect) |
2570 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstanceIndex)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2571 |
|
|
2572 |
EffectControl* pEffectControl = pEffect->InputControl(iInputControlIndex); |
EffectControl* pEffectControl = pEffect->InputControl(iInputControlIndex); |
2573 |
if (!pEffectControl) |
if (!pEffectControl) |
2574 |
throw Exception( |
throw Exception( |
2575 |
"Effect instance " + ToString(iEffectInstanceIndex) + |
"Effect instance " + ToString(iEffectInstance) + |
2576 |
" does not have an input control with index " + |
" does not have an input control with index " + |
2577 |
ToString(iInputControlIndex) |
ToString(iInputControlIndex) |
2578 |
); |
); |
2593 |
return result.Produce(); |
return result.Produce(); |
2594 |
} |
} |
2595 |
|
|
2596 |
String LSCPServer::SetEffectInstanceInputControl(int iEffectInstanceIndex, int iInputControlIndex, double dValue) { |
String LSCPServer::SetEffectInstanceInputControlValue(int iEffectInstance, int iInputControlIndex, double dValue) { |
2597 |
dmsg(2,("LSCPServer: SetEffectInstanceInputControl(%d,%d,%f)\n", iEffectInstanceIndex, iInputControlIndex, dValue)); |
dmsg(2,("LSCPServer: SetEffectInstanceInputControlValue(%d,%d,%f)\n", iEffectInstance, iInputControlIndex, dValue)); |
2598 |
LSCPResultSet result; |
LSCPResultSet result; |
2599 |
try { |
try { |
2600 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstanceIndex); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2601 |
if (!pEffect) |
if (!pEffect) |
2602 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstanceIndex)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2603 |
|
|
2604 |
EffectControl* pEffectControl = pEffect->InputControl(iInputControlIndex); |
EffectControl* pEffectControl = pEffect->InputControl(iInputControlIndex); |
2605 |
if (!pEffectControl) |
if (!pEffectControl) |
2606 |
throw Exception( |
throw Exception( |
2607 |
"Effect instance " + ToString(iEffectInstanceIndex) + |
"Effect instance " + ToString(iEffectInstance) + |
2608 |
" does not have an input control with index " + |
" does not have an input control with index " + |
2609 |
ToString(iInputControlIndex) |
ToString(iInputControlIndex) |
2610 |
); |
); |
2616 |
return result.Produce(); |
return result.Produce(); |
2617 |
} |
} |
2618 |
|
|
2619 |
String LSCPServer::CreateEffectInstance(int index) { |
String LSCPServer::CreateEffectInstance(int iEffectIndex) { |
2620 |
dmsg(2,("LSCPServer: CreateEffectInstance()\n")); |
dmsg(2,("LSCPServer: CreateEffectInstance(%d)\n", iEffectIndex)); |
2621 |
LSCPResultSet result; |
LSCPResultSet result; |
2622 |
try { |
try { |
2623 |
EffectInfo* pEffectInfo = EffectFactory::GetEffectInfo(index); |
EffectInfo* pEffectInfo = EffectFactory::GetEffectInfo(iEffectIndex); |
2624 |
if (!pEffectInfo) |
if (!pEffectInfo) |
2625 |
throw Exception("There is no effect with index " + ToString(index)); |
throw Exception("There is no effect with index " + ToString(iEffectIndex)); |
2626 |
Effect* pEffect = EffectFactory::Create(pEffectInfo); |
Effect* pEffect = EffectFactory::Create(pEffectInfo); |
2627 |
result.Add(pEffect->ID()); |
result.Add(pEffect->ID()); |
2628 |
} catch (Exception e) { |
} catch (Exception e) { |
2632 |
} |
} |
2633 |
|
|
2634 |
String LSCPServer::CreateEffectInstance(String effectSystem, String module, String effectName) { |
String LSCPServer::CreateEffectInstance(String effectSystem, String module, String effectName) { |
2635 |
dmsg(2,("LSCPServer: CreateEffectInstance()\n")); |
dmsg(2,("LSCPServer: CreateEffectInstance('%s','%s','%s')\n", effectSystem.c_str(), module.c_str(), effectName.c_str())); |
2636 |
LSCPResultSet result; |
LSCPResultSet result; |
2637 |
try { |
try { |
2638 |
// to allow loading the same LSCP session file on different systems |
// to allow loading the same LSCP session file on different systems |
2677 |
return result.Produce(); |
return result.Produce(); |
2678 |
} |
} |
2679 |
|
|
2680 |
String LSCPServer::DestroyEffectInstance(int iEffectID) { |
String LSCPServer::DestroyEffectInstance(int iEffectInstance) { |
2681 |
dmsg(2,("LSCPServer: DestroyEffectInstance(%d)\n", iEffectID)); |
dmsg(2,("LSCPServer: DestroyEffectInstance(%d)\n", iEffectInstance)); |
2682 |
LSCPResultSet result; |
LSCPResultSet result; |
2683 |
try { |
try { |
2684 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectID); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2685 |
if (!pEffect) |
if (!pEffect) |
2686 |
throw Exception("There is no effect instance with ID " + ToString(iEffectID)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2687 |
EffectFactory::Destroy(pEffect); |
EffectFactory::Destroy(pEffect); |
2688 |
} catch (Exception e) { |
} catch (Exception e) { |
2689 |
result.Error(e); |
result.Error(e); |
2721 |
return result.Produce(); |
return result.Produce(); |
2722 |
} |
} |
2723 |
|
|
2724 |
String LSCPServer::GetMasterEffectChains(int iAudioOutputDevice) { |
String LSCPServer::GetSendEffectChains(int iAudioOutputDevice) { |
2725 |
dmsg(2,("LSCPServer: GetMasterEffectChains(%d)\n", iAudioOutputDevice)); |
dmsg(2,("LSCPServer: GetSendEffectChains(%d)\n", iAudioOutputDevice)); |
2726 |
LSCPResultSet result; |
LSCPResultSet result; |
2727 |
try { |
try { |
2728 |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
2729 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2730 |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
2731 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2732 |
int n = pDevice->MasterEffectChainCount(); |
int n = pDevice->SendEffectChainCount(); |
2733 |
result.Add(n); |
result.Add(n); |
2734 |
} catch (Exception e) { |
} catch (Exception e) { |
2735 |
result.Error(e); |
result.Error(e); |
2737 |
return result.Produce(); |
return result.Produce(); |
2738 |
} |
} |
2739 |
|
|
2740 |
String LSCPServer::ListMasterEffectChains(int iAudioOutputDevice) { |
String LSCPServer::ListSendEffectChains(int iAudioOutputDevice) { |
2741 |
dmsg(2,("LSCPServer: ListMasterEffectChains(%d)\n", iAudioOutputDevice)); |
dmsg(2,("LSCPServer: ListSendEffectChains(%d)\n", iAudioOutputDevice)); |
2742 |
LSCPResultSet result; |
LSCPResultSet result; |
2743 |
String list; |
String list; |
2744 |
try { |
try { |
2746 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2747 |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
2748 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2749 |
int n = pDevice->MasterEffectChainCount(); |
int n = pDevice->SendEffectChainCount(); |
2750 |
for (int i = 0; i < n; i++) { |
for (int i = 0; i < n; i++) { |
2751 |
EffectChain* pEffectChain = pDevice->MasterEffectChain(i); |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
2752 |
if (i) list += ","; |
if (i) list += ","; |
2753 |
list += ToString(pEffectChain->ID()); |
list += ToString(pEffectChain->ID()); |
2754 |
} |
} |
2759 |
return result.Produce(); |
return result.Produce(); |
2760 |
} |
} |
2761 |
|
|
2762 |
String LSCPServer::AddMasterEffectChain(int iAudioOutputDevice) { |
String LSCPServer::AddSendEffectChain(int iAudioOutputDevice) { |
2763 |
dmsg(2,("LSCPServer: AddMasterEffectChain(%d)\n", iAudioOutputDevice)); |
dmsg(2,("LSCPServer: AddSendEffectChain(%d)\n", iAudioOutputDevice)); |
2764 |
LSCPResultSet result; |
LSCPResultSet result; |
2765 |
try { |
try { |
2766 |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
2767 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2768 |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
2769 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2770 |
EffectChain* pEffectChain = pDevice->AddMasterEffectChain(); |
EffectChain* pEffectChain = pDevice->AddSendEffectChain(); |
2771 |
result.Add(pEffectChain->ID()); |
result.Add(pEffectChain->ID()); |
2772 |
} catch (Exception e) { |
} catch (Exception e) { |
2773 |
result.Error(e); |
result.Error(e); |
2775 |
return result.Produce(); |
return result.Produce(); |
2776 |
} |
} |
2777 |
|
|
2778 |
String LSCPServer::RemoveMasterEffectChain(int iAudioOutputDevice, int iMasterEffectChain) { |
String LSCPServer::RemoveSendEffectChain(int iAudioOutputDevice, int iSendEffectChain) { |
2779 |
dmsg(2,("LSCPServer: RemoveMasterEffectChain(%d,%d)\n", iAudioOutputDevice, iMasterEffectChain)); |
dmsg(2,("LSCPServer: RemoveSendEffectChain(%d,%d)\n", iAudioOutputDevice, iSendEffectChain)); |
2780 |
LSCPResultSet result; |
LSCPResultSet result; |
2781 |
try { |
try { |
2782 |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
2783 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2784 |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
throw Exception("There is no audio output device with index " + ToString(iAudioOutputDevice) + "."); |
2785 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2786 |
for (int i = 0; i < pDevice->MasterEffectChainCount(); i++) { |
for (int i = 0; i < pDevice->SendEffectChainCount(); i++) { |
2787 |
EffectChain* pEffectChain = pDevice->MasterEffectChain(i); |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
2788 |
if (pEffectChain->ID() == iMasterEffectChain) { |
if (pEffectChain->ID() == iSendEffectChain) { |
2789 |
pDevice->RemoveMasterEffectChain(i); |
pDevice->RemoveSendEffectChain(i); |
2790 |
return result.Produce(); |
return result.Produce(); |
2791 |
} |
} |
2792 |
} |
} |
2793 |
throw Exception( |
throw Exception( |
2794 |
"There is no master effect chain with ID " + |
"There is no send effect chain with ID " + |
2795 |
ToString(iMasterEffectChain) + " for audio output device " + |
ToString(iSendEffectChain) + " for audio output device " + |
2796 |
ToString(iAudioOutputDevice) + "." |
ToString(iAudioOutputDevice) + "." |
2797 |
); |
); |
2798 |
} catch (Exception e) { |
} catch (Exception e) { |
2801 |
return result.Produce(); |
return result.Produce(); |
2802 |
} |
} |
2803 |
|
|
2804 |
static EffectChain* _getMasterEffectChain(Sampler* pSampler, int iAudioOutputDevice, int iMasterEffectChain) throw (Exception) { |
static EffectChain* _getSendEffectChain(Sampler* pSampler, int iAudioOutputDevice, int iSendEffectChain) throw (Exception) { |
2805 |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
std::map<uint,AudioOutputDevice*> devices = pSampler->GetAudioOutputDevices(); |
2806 |
if (!devices.count(iAudioOutputDevice)) |
if (!devices.count(iAudioOutputDevice)) |
2807 |
throw Exception( |
throw Exception( |
2809 |
ToString(iAudioOutputDevice) + "." |
ToString(iAudioOutputDevice) + "." |
2810 |
); |
); |
2811 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2812 |
for (int i = 0; i < pDevice->MasterEffectChainCount(); i++) { |
for (int i = 0; i < pDevice->SendEffectChainCount(); i++) { |
2813 |
EffectChain* pEffectChain = pDevice->MasterEffectChain(i); |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
2814 |
if (pEffectChain->ID() == iMasterEffectChain) { |
if (pEffectChain->ID() == iSendEffectChain) { |
2815 |
return pEffectChain; |
return pEffectChain; |
2816 |
} |
} |
2817 |
} |
} |
2818 |
throw Exception( |
throw Exception( |
2819 |
"There is no master effect chain with ID " + |
"There is no send effect chain with ID " + |
2820 |
ToString(iMasterEffectChain) + " for audio output device " + |
ToString(iSendEffectChain) + " for audio output device " + |
2821 |
ToString(iAudioOutputDevice) + "." |
ToString(iAudioOutputDevice) + "." |
2822 |
); |
); |
2823 |
} |
} |
2824 |
|
|
2825 |
String LSCPServer::GetMasterEffectChainInfo(int iAudioOutputDevice, int iMasterEffectChain) { |
String LSCPServer::GetSendEffectChainInfo(int iAudioOutputDevice, int iSendEffectChain) { |
2826 |
dmsg(2,("LSCPServer: GetMasterEffectChainInfo(%d,%d)\n", iAudioOutputDevice, iMasterEffectChain)); |
dmsg(2,("LSCPServer: GetSendEffectChainInfo(%d,%d)\n", iAudioOutputDevice, iSendEffectChain)); |
2827 |
LSCPResultSet result; |
LSCPResultSet result; |
2828 |
try { |
try { |
2829 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2830 |
_getMasterEffectChain(pSampler, iAudioOutputDevice, iMasterEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2831 |
String sEffectSequence; |
String sEffectSequence; |
2832 |
for (int i = 0; i < pEffectChain->EffectCount(); i++) { |
for (int i = 0; i < pEffectChain->EffectCount(); i++) { |
2833 |
if (i) sEffectSequence += ","; |
if (i) sEffectSequence += ","; |
2841 |
return result.Produce(); |
return result.Produce(); |
2842 |
} |
} |
2843 |
|
|
2844 |
String LSCPServer::AppendMasterEffectChainEffect(int iAudioOutputDevice, int iMasterEffectChain, int iEffectInstance) { |
String LSCPServer::AppendSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectInstance) { |
2845 |
dmsg(2,("LSCPServer: AppendMasterEffectChainEffect(%d,%d,%d)\n", iAudioOutputDevice, iMasterEffectChain, iEffectInstance)); |
dmsg(2,("LSCPServer: AppendSendEffectChainEffect(%d,%d,%d)\n", iAudioOutputDevice, iSendEffectChain, iEffectInstance)); |
2846 |
LSCPResultSet result; |
LSCPResultSet result; |
2847 |
try { |
try { |
2848 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2849 |
_getMasterEffectChain(pSampler, iAudioOutputDevice, iMasterEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2850 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2851 |
if (!pEffect) |
if (!pEffect) |
2852 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstance)); |
throw Exception("There is no effect instance with ID " + ToString(iEffectInstance)); |
2853 |
pEffectChain->AppendEffect(pEffect); |
pEffectChain->AppendEffect(pEffect); |
2854 |
} catch (Exception e) { |
} catch (Exception e) { |
2855 |
result.Error(e); |
result.Error(e); |
2857 |
return result.Produce(); |
return result.Produce(); |
2858 |
} |
} |
2859 |
|
|
2860 |
String LSCPServer::InsertMasterEffectChainEffect(int iAudioOutputDevice, int iMasterEffectChain, int iEffectInstance, int iEffectChainPosition) { |
String LSCPServer::InsertSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectChainPosition, int iEffectInstance) { |
2861 |
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)); |
2862 |
LSCPResultSet result; |
LSCPResultSet result; |
2863 |
try { |
try { |
2864 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2865 |
_getMasterEffectChain(pSampler, iAudioOutputDevice, iMasterEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2866 |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
Effect* pEffect = EffectFactory::GetEffectInstanceByID(iEffectInstance); |
2867 |
if (!pEffect) |
if (!pEffect) |
2868 |
throw Exception("There is no effect instance with index " + ToString(iEffectInstance)); |
throw Exception("There is no effect instance with index " + ToString(iEffectInstance)); |
2873 |
return result.Produce(); |
return result.Produce(); |
2874 |
} |
} |
2875 |
|
|
2876 |
String LSCPServer::RemoveMasterEffectChainEffect(int iAudioOutputDevice, int iMasterEffectChain, int iEffectInstance) { |
String LSCPServer::RemoveSendEffectChainEffect(int iAudioOutputDevice, int iSendEffectChain, int iEffectChainPosition) { |
2877 |
dmsg(2,("LSCPServer: RemoveMasterEffectChainEffect(%d,%d,%d)\n", iAudioOutputDevice, iMasterEffectChain, iEffectInstance)); |
dmsg(2,("LSCPServer: RemoveSendEffectChainEffect(%d,%d,%d)\n", iAudioOutputDevice, iSendEffectChain, iEffectChainPosition)); |
2878 |
LSCPResultSet result; |
LSCPResultSet result; |
2879 |
try { |
try { |
2880 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2881 |
_getMasterEffectChain(pSampler, iAudioOutputDevice, iMasterEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2882 |
for (int i = 0; i < pEffectChain->EffectCount(); i++) { |
pEffectChain->RemoveEffect(iEffectChainPosition); |
|
Effect* pEffect = pEffectChain->GetEffect(i); |
|
|
if (pEffect->ID() == iEffectInstance) { |
|
|
pEffectChain->RemoveEffect(i); |
|
|
return result.Produce(); |
|
|
} |
|
|
} |
|
|
throw Exception( |
|
|
"There is no effect instance with index " + |
|
|
ToString(iEffectInstance) |
|
|
); |
|
2883 |
} catch (Exception e) { |
} catch (Exception e) { |
2884 |
result.Error(e); |
result.Error(e); |
2885 |
} |
} |