OpenAL AL_GAIN unwanted ramping
OpenAL AL_GAIN unwanted ramping
- Subject: OpenAL AL_GAIN unwanted ramping
- From: Zack Morris <email@hidden>
- Date: Fri, 12 Nov 2010 11:20:41 -0700
Hi All, I emailed the OpenAL dev list about this here:
http://opensource.creative.com/pipermail/openal-devel/2010-November/005756.html
There is a bug on the Mac where if you play a sound at one volume,
stop the channel, change the gain with alSourcef( mySource, AL_GAIN,
myGain ) and play it again. The sound fades in over time, like
enveloping is happening. They suggested trying to update the code
myself and submit a patch.
I downloaded the only OpenAL code I could find that worked at:
http://www.assembla.com/code/OpenALCoreAudioDeviceEnumeration/git/nodes?rev=master
With:
git clone git://git.assembla.com/OpenALCoreAudioDeviceEnumeration.git
It compiles and I'm able to include the framework in my app. It shows
the same gain enveloping. I tracked down the issue to line 2173 of
oalSource.cpp:
OSStatus result = AudioUnitSetParameter ( mOwningContext-
>GetMixerUnit(), k3DMixerParam_Gain, kAudioUnitScope_Input,
mCurrentPlayBus, db, 0);
So k3DMixerParam_Gain is being used down the road internally. I tried
putting returns in RampUp() and RampDown() on line 2813 of
oalSource.cpp:
void OALSource::RampDown (AudioBufferList *ioData)
void OALSource::RampUp (AudioBufferList *ioData)
But it didn't fix the issue, because the enveloping happens inside
CoreAudio.
My question is, does anyone know how to set the duration of the gain
enveloping in CoreAudio? I also worry that this issue may have
nothing to do with gain, and may be some sort of filter that is always
running, that prevents things like popping on a looped buffer. I
found these parameters that might control filters:
k3DMixerParam_ReverbBlend
k3DMixerParam_GlobalReverbGain
k3DMixerParam_OcclusionAttenuation
k3DMixerParam_ObstructionAttenuation
I see why it makes sense to adjust gain over time so there is no
popping. But if a source isn't playing, then the gain needs to change
immediately. I just need to be able to tell CoreAudio to turn off
ramping, set the gain, and turn ramping back on, for the case where no
sound is currently playing.
I've also tried the OpenAL from the 10.5 SDK but it looks like it's
the same 1.2 version as 10.4. It's works fine in WinXP in Parallels,
but I haven't tried iOS yet.
Thanx for any help,
--Zack
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden