Re: Very short junk audio signal on 10.5 x86
Re: Very short junk audio signal on 10.5 x86
- Subject: Re: Very short junk audio signal on 10.5 x86
- From: Doug Wyatt <email@hidden>
- Date: Mon, 31 Aug 2009 09:34:26 -0700
You really shouldn't be allocating or disposing memory (or objects
like AudioConverters) on the audio I/O proc, which is the thread on
which the AU render notification is issued. That will block I/O and
cause audible glitches.
Doug
On Aug 30, 2009, at 3:53 , Andreas Falkenhahn wrote:
Update:
Upon further investigating the issue I found out that the crack is
actually caused
by a call to AudioConverterDispose(). The call returns noErr but
still there is
a crack in the audio.
Could it be that AudioConverterDispose() must only be called by the
thread that
created the audio converter? That could be an explanation because
I'm disposing
of the audio converter in my render notification proc on
kAudioUnitRenderAction_PostRender.
When I call AudioConverterDispose() from my main thread (i.e. the
thread that created
the audio converter), there isn't any sound cracking.
So can someone say if it's legal to call AudioConverterDispose()
inside a proc
installed by AudioUnitAddRenderNotify()? Of course, I've taken care
of possible
race conditions by protecting accesses to shared data (as is the
audio converter)
in the NotificationProc, MixerProc, ConverterProc using mutexes. So
joint data
access can be ruled out as the reason because data is protected. The
only reason
for the crack that I could imagine is that only the thread that
created the audio
converter may dispose of it. But I'd like some confirmation before I
start any code
adaptations..
Tks for any help,
Andreas
On 29.08.2009 at 21:57 Andreas Falkenhahn wrote:
Hi,
I've noticed that on an Intel iMac with OS 10.5 my app suddenly has
a very
brief junk audio signal whenever a sound has finished playing.
Under Tiger
on my PPC Mac mini, this doesn't happen though.
Here's my setup:
Whenever a sound is played, I'm starting a new channel on my Audio
Mixer
Unit using kAudioUnitProperty_SetRenderCallback. In the render
callback,
I'm calling AudioConverterFillComplexBuffer(). When there's no more
data
left to play, I let my ACComplexInputProc() return NULL for
everything and
set a flag that indicates that this channel has finished playing.
This flag is then catched by my notification callback that I
installed
using
AudioUnitAddRenderNotify(). On every
kAudioUnitRenderAction_PostRender
event, the notification proc will check if the "channel_finished"
flag is
set
and if it is set, it will stop the render callback on the respective
channel by
calling kAudioUnitProperty_SetRenderCallback with NULL.
And this is the exact point where the very brief junk noise occurs.
When
my notification proc stops the render callback on the respective
channel,
I get a brief junk audio signal. It's just a fragment of a second
in time,
but
clearly audible and annoying. So I'm wondering what can I do about
this?
As I said, it doesn't happen under Tiger on PPC, but under Leopard
on x86
it's there and really annoying.
What can I do to fix this?
Tks
Andreas
--
"Remember: It's nice to be important but it's more important to be
nice!"
_______________________________________________
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
--
"Remember: It's nice to be important but it's more important to be
nice!"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com
This email sent to email@hidden
_______________________________________________
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