314 |
for (int iChan = 0; iChan < 2; ++iChan) { |
for (int iChan = 0; iChan < 2; ++iChan) { |
315 |
const int iDstChan = pFxSend->DestinationChannel(iChan); |
const int iDstChan = pFxSend->DestinationChannel(iChan); |
316 |
if (iDstChan < 0) { |
if (iDstChan < 0) { |
317 |
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination channel (%d->%d)", ((iChan) ? "R" : "L"), iChan, iDstChan)); |
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination channel (%d->%d)\n", |
318 |
|
((iChan) ? "R" : "L"), iChan, iDstChan)); |
319 |
return false; // error |
return false; // error |
320 |
} |
} |
321 |
AudioChannel* pDstChan = NULL; |
AudioChannel* pDstChan = NULL; |
322 |
|
Effect* pEffect = NULL; |
323 |
if (pFxSend->DestinationEffectChain() >= 0) { // fx send routed to an internal send effect |
if (pFxSend->DestinationEffectChain() >= 0) { // fx send routed to an internal send effect |
324 |
EffectChain* pEffectChain = |
EffectChain* pEffectChain = |
325 |
pAudioOutputDevice->SendEffectChainByID( |
pAudioOutputDevice->SendEffectChainByID( |
326 |
pFxSend->DestinationEffectChain() |
pFxSend->DestinationEffectChain() |
327 |
); |
); |
328 |
if (!pEffectChain) { |
if (!pEffectChain) { |
329 |
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination effect chain %d", ((iChan) ? "R" : "L"), pFxSend->DestinationEffectChain())); |
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination effect chain %d\n", |
330 |
|
((iChan) ? "R" : "L"), pFxSend->DestinationEffectChain())); |
331 |
return false; // error |
return false; // error |
332 |
} |
} |
333 |
Effect* pEffect = |
pEffect = |
334 |
pEffectChain->GetEffect( |
pEffectChain->GetEffect( |
335 |
pFxSend->DestinationEffectChainPosition() |
pFxSend->DestinationEffectChainPosition() |
336 |
); |
); |
337 |
if (!pEffect) { |
if (!pEffect) { |
338 |
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination effect %d of effect chain %d", ((iChan) ? "R" : "L"), pFxSend->DestinationEffectChainPosition(), pFxSend->DestinationEffectChain())); |
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination effect %d of effect chain %d\n", |
339 |
|
((iChan) ? "R" : "L"), pFxSend->DestinationEffectChainPosition(), pFxSend->DestinationEffectChain())); |
340 |
return false; // error |
return false; // error |
341 |
} |
} |
342 |
pDstChan = pEffect->InputChannel(iDstChan); |
pDstChan = pEffect->InputChannel(iDstChan); |
343 |
} else { // FX send routed directly to an audio output channel |
} else { // FX send routed directly to audio output device channel(s) |
344 |
pDstChan = pAudioOutputDevice->Channel(iDstChan); |
pDstChan = pAudioOutputDevice->Channel(iDstChan); |
345 |
} |
} |
346 |
if (!pDstChan) { |
if (!pDstChan) { |
347 |
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination channel (%d->%d)", ((iChan) ? "R" : "L"), iChan, iDstChan)); |
if (pFxSend->DestinationEffectChain() >= 0) { // fx send routed to an internal send effect |
348 |
|
const int iEffectChannels = pEffect ? pEffect->InputChannelCount() : 0; |
349 |
|
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination channel (%d->%d): " |
350 |
|
"FX send is routed to effect %d of effect chain %d and that effect has %d input channels\n", |
351 |
|
((iChan) ? "R" : "L"), iChan, iDstChan, |
352 |
|
pFxSend->DestinationEffectChainPosition(), |
353 |
|
pFxSend->DestinationEffectChain(), iEffectChannels)); |
354 |
|
} else { // FX send routed directly to audio output device channel(s) |
355 |
|
dmsg(1,("Engine::RouteAudio() Error: invalid FX send (%s) destination channel (%d->%d): " |
356 |
|
"FX send is directly routed to audio output device which has %d output channels\n", |
357 |
|
((iChan) ? "R" : "L"), iChan, iDstChan, |
358 |
|
(pAudioOutputDevice ? pAudioOutputDevice->ChannelCount() : 0))); |
359 |
|
} |
360 |
return false; // error |
return false; // error |
361 |
} |
} |
362 |
ppSource[iChan]->MixTo(pDstChan, Samples, FxSendLevel); |
ppSource[iChan]->MixTo(pDstChan, Samples, FxSendLevel); |