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 |
|
|
2795 |
|
std::set<EngineChannel*> engineChannels = EngineChannelFactory::EngineChannelInstances(); |
2796 |
|
std::set<EngineChannel*>::iterator itEngineChannel = engineChannels.begin(); |
2797 |
|
std::set<EngineChannel*>::iterator itEnd = engineChannels.end(); |
2798 |
|
for (; itEngineChannel != itEnd; ++itEngineChannel) { |
2799 |
|
AudioOutputDevice* pDev = (*itEngineChannel)->GetAudioOutputDevice(); |
2800 |
|
if (pDev != NULL && pDev->deviceId() == iAudioOutputDevice) { |
2801 |
|
for (int i = 0; i < (*itEngineChannel)->GetFxSendCount(); i++) { |
2802 |
|
FxSend* fxs = (*itEngineChannel)->GetFxSend(i); |
2803 |
|
if(fxs != NULL && fxs->DestinationEffectChain() == iSendEffectChain) { |
2804 |
|
throw Exception("The effect chain is still in use by channel " + ToString((*itEngineChannel)->GetSamplerChannel()->Index())); |
2805 |
|
} |
2806 |
|
} |
2807 |
|
} |
2808 |
|
} |
2809 |
|
|
2810 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2811 |
for (int i = 0; i < pDevice->SendEffectChainCount(); i++) { |
for (int i = 0; i < pDevice->SendEffectChainCount(); i++) { |
2812 |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
2835 |
ToString(iAudioOutputDevice) + "." |
ToString(iAudioOutputDevice) + "." |
2836 |
); |
); |
2837 |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
AudioOutputDevice* pDevice = devices[iAudioOutputDevice]; |
2838 |
for (int i = 0; i < pDevice->SendEffectChainCount(); i++) { |
EffectChain* pEffectChain = pDevice->SendEffectChainByID(iSendEffectChain); |
2839 |
EffectChain* pEffectChain = pDevice->SendEffectChain(i); |
if(pEffectChain != NULL) return pEffectChain; |
|
if (pEffectChain->ID() == iSendEffectChain) { |
|
|
return pEffectChain; |
|
|
} |
|
|
} |
|
2840 |
throw Exception( |
throw Exception( |
2841 |
"There is no send effect chain with ID " + |
"There is no send effect chain with ID " + |
2842 |
ToString(iSendEffectChain) + " for audio output device " + |
ToString(iSendEffectChain) + " for audio output device " + |
2903 |
try { |
try { |
2904 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
2905 |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
_getSendEffectChain(pSampler, iAudioOutputDevice, iSendEffectChain); |
2906 |
|
|
2907 |
|
std::set<EngineChannel*> engineChannels = EngineChannelFactory::EngineChannelInstances(); |
2908 |
|
std::set<EngineChannel*>::iterator itEngineChannel = engineChannels.begin(); |
2909 |
|
std::set<EngineChannel*>::iterator itEnd = engineChannels.end(); |
2910 |
|
for (; itEngineChannel != itEnd; ++itEngineChannel) { |
2911 |
|
AudioOutputDevice* pDev = (*itEngineChannel)->GetAudioOutputDevice(); |
2912 |
|
if (pDev != NULL && pDev->deviceId() == iAudioOutputDevice) { |
2913 |
|
for (int i = 0; i < (*itEngineChannel)->GetFxSendCount(); i++) { |
2914 |
|
FxSend* fxs = (*itEngineChannel)->GetFxSend(i); |
2915 |
|
if(fxs != NULL && fxs->DestinationEffectChain() == iSendEffectChain && fxs->DestinationEffectChainPosition() == iEffectChainPosition) { |
2916 |
|
throw Exception("The effect instance is still in use by channel " + ToString((*itEngineChannel)->GetSamplerChannel()->Index())); |
2917 |
|
} |
2918 |
|
} |
2919 |
|
} |
2920 |
|
} |
2921 |
|
|
2922 |
pEffectChain->RemoveEffect(iEffectChainPosition); |
pEffectChain->RemoveEffect(iEffectChainPosition); |
2923 |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_send_fx_chain_info, iAudioOutputDevice, iSendEffectChain, pEffectChain->EffectCount())); |
LSCPServer::SendLSCPNotify(LSCPEvent(LSCPEvent::event_send_fx_chain_info, iAudioOutputDevice, iSendEffectChain, pEffectChain->EffectCount())); |
2924 |
} catch (Exception e) { |
} catch (Exception e) { |