[openal] Filtering a single channel in a stereo source
chris.kcat at gmail.com
Thu Apr 7 03:25:58 EDT 2016
On 04/06/2016 09:07 PM, Ian Reed wrote:
> I'd like to apply a filter to a single channel in a stereo sound source.
> Is this possible?
> If not, is there a good way for me to start each channel as its own mono
> source and somehow keep them in sync?
There's currently no method to set a specific source channel's filter
properties, just for all source channels. It would theoretically be
doable, with the right method (having a source method to tweak specific
properties for specific channels would actually be nice beyond just
filters), although I have concerns. Specifically, filters can effect the
phase of the output, which if they can be set separately for separate
channels, may cause the channels to sound slightly out of sync, or worse
cancel out so the lower frequencies are cut in the middle. It might be
something worth testing, at any rate.
You can play two mono sources separately in sync with each other.
alSourcePlayv allows you to play multiple sources at once, with the
guarantee that they start at the same time. Just ensure they have the
same offset to start with when calling it. If you want to change any
pitch-related properties while it's playing, such as AL_PITCH or
AL_VELOCITY, you need to make sure the changes are batched using the
AL_SOFT_deferred_updates extension, or hoping alcSuspendContext and
alcProcessContext will make sure property changes get batched.
More information about the openal