OpenAL plays back original sound from source ALONGSIDE the sound with the applied effect
YanniZ06 opened this issue · 2 comments
I have tried and tried about everything I could have done wrong and could not figure it out myself, despite being decently sure this is a me-issue.
I'm playing back audio from a source with an auxiliary send filter applied that is supposed to apply the EFFECT_PITCH_SHIFTER, which it does!
However, the final playback mix has both the ORIGINAL sound AND the DOWNPITCHED sound, which I do not want.
Now, after days and days of research and trying to find anything on this issue, I stumbled across the following reply under an issue from 2017 here:
"This will effectively give you three copies of the sound. The first is normal on the direct path (with any panning or distance attenuation that may be applied), the second will be an equalized copy on send path 0, and the third will be a reverberation of the first on send path 1.
If you want to change the volume of the three outputs independently, you can use direct and send filters."
Originally posted by @kcat in #93 (comment)
So to me it seems like this is by design and not an "accident" or "failure" on my side directly, and to me this ALSO implies there is a way to change this, to get rid of the original output. However I don't see how filters do the work for me here so I wholeheartedly BEG to be graced with an example on how to silence the original output, so ONLY the one with the effect can be heard.
I reckon this isnt really an issue and shouldnt exactly belong here but I can imagine others might at some point come across this aswell, and itd be better to have it as help for them aswell.
Thanks in advance
A filter is needed on the source's direct path, to silence the normal sound and leave the applied effect. Like this:
ALint silence_filter = 0;
alGenFilters(1, &silence_filter);
alFilteri(silence_filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
alFilterf(silence_filter, AL_LOWPASS_GAIN, 0.0f);
alSourcei(source, AL_DIRECT_FILTER, silence_filter);
silence_filter
can be reused for however many sources you need. Make sure to delete it when finishing up with the context.
Thank you again, God this took unnecessarily long to figure out.
If I could suggest anything it would be to make it abundantly clear that there is multiple outputs and that to only mute the main one you NEED a filter, because figuring that out on your own is quite a task.
And when I say clear I don't mean the output mixer graphic on the openal-soft efx docs, because even though it shows the direct filter output going directly to the final mix (which I have recognized while fixing this issue but didn't know how to fix/stop) i feel it doesn't emphasize this enough.
Regardless thanks for the quick reply, you rock