Re: Disappearing static pops
Re: Disappearing static pops
- Subject: Re: Disappearing static pops
- From: Todd Heberlein <email@hidden>
- Date: Tue, 02 Apr 2002 18:42:11 -0800
On 4/2/02 6:21 PM, "Todd Heberlein" <email@hidden> wrote:
>
o my application -> static pops
>
o Sound Studio AND my application -> no static pops
>
o quit Sound Studio, and the static pop noise comes back when recording
OK, bad form to reply to your own post, but I think I have found a solution,
but I still do not know *why* this works. Below is the a brief model of the
code that pops and the code that produces clean recordings.
The primary difference is that when I start my program I immediately start
the callback thread with AudioDeviceStart() so the callback is being called
continuously, and now I just use a static BOOL to indicate whether the data
passed to the callback should be recorded or not.
Should we *not* be using AudioDeviceStart() and AudioDeviceStop() to begin
and end recording?
Happy that it works, but confused as to why,
Todd
-------------------------------------------------
Original code model (that produces static pops)
Callback()
{
record all data into a buffer;
}
-init()
{
find default audio;
register callback with AudioDeviceAddIOProc();
}
- pressRecord()
{
if turning on recording, start callback with AudioDeviceStart();
else, stop callback with AudioDeviceStop();
}
-------------------------------------------------
New Code model (that doesn't produce static pops)
Static BOOL Record_the_data = NO;
Callback()
{
if (Record_the_data == NO) return from callback;
else record all the data;
}
- init()
{
find default audio;
register callback with AudioDeviceAddIOProc();
start callback with AudioDeviceStart();
}
- pressRecord()
{
if turning on recording, Record_the_data = YES;
else Record_the_data = NO;
}
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.