Re: Using AudioDeviceRead?
Re: Using AudioDeviceRead?
- Subject: Re: Using AudioDeviceRead?
- From: Dirk Musfeldt <email@hidden>
- Date: Tue, 04 Mar 2003 07:24:15 +0100
Hi, Jeff, hi all,
I have trouble re-initializing my AudioDevice if it is not running anywhere
else in the system, e.g. in the Sound Preferences.
This is what I do to initialize the device:
{
AudioDeviceGetPropertyInfo( kAudioDevicePropertyStreamConfiguration);
AllocBufferList();
AudioDeviceGetProperty(kAudioDevicePropertyStreamConfiguration, bufferList);
AllocBuffers();
AudioDeviceSetProperty( kAudioDevicePropertyRegisterBufferList, bufferList);
AudioDeviceStart();
}
And from within my callback:
{
AudioDeviceRead();
}
And then to stop the device:
{
AudioDeviceGetProperty(kAudioDevicePropertyRegisterBufferList);
ReleaseBuffers();
AudioDeviceStop();
}
This pseudo-code works the first time but every following time I get only a
metallic hum if the device was not already running.
Anything else to reset the input device? As it is my own device driver I can
see that the device is started correctly. But it seems as if the HAL doesn't
copy the buffer as intended.
With kind regards
Dirk Musfeldt
Meilenstein Mac OS Software
Neue Strasse 5
D-31582 Nienburg
Germany
Tel: +49 (0) 5021 91 24 44
Fax: +49 (0) 5021 91 24 45
<
http://www.meilenstein.de/>
>
Von: Jeff Moore <email@hidden>
>
Datum: Fri, 28 Feb 2003 12:23:38 -0800
>
An: Dirk Musfeldt <email@hidden>
>
Betreff: Re: Using AudioDeviceRead?
>
>
I don't recall if there was a bug fix in the HAL that made it work
>
correctly or not, but there is pretty much no chance of getting a fix
>
that went in to the HAL for 10.2 back on 10.1.x.
>
>
On Friday, February 28, 2003, at 08:16 AM, Dirk Musfeldt wrote:
>
>
> Hi, Jeff,
>
>
>
> I found out that the problem was 10.1.5... The same code works like a
>
> charm
>
> on 10.2.
>
>
>
> Is there any chance to get AudioDeviceRead working on 10.1.5?
>
>
>
>
>
> With kind regards
>
>
>
> Dirk Musfeldt
>
> Meilenstein Mac OS Software
>
>
>
> Neue Strasse 5
>
> D-31582 Nienburg
>
> Germany
>
> Tel: +49 (0) 5021 91 24 44
>
> Fax: +49 (0) 5021 91 24 45
>
> <http://www.meilenstein.de/>
>
>
>
>
>
>> Von: Jeff Moore <email@hidden>
>
>> Datum: Wed, 19 Feb 2003 12:04:15 -0800
>
>> An: email@hidden
>
>> Betreff: Re: Using AudioDeviceRead?
>
>>
>
>> On Wednesday, February 19, 2003, at 04:21 AM, Dirk Musfeldt wrote:
>
>>
>
>>> Hi Jeff,
>
>>>
>
>>>> Have you started the device you are reading from?
>
>>>
>
>>> I double-checked the IDs used with the various AudeDeviceXXX calls
>
>>> and
>
>>> they
>
>>> matched.
>
>>
>
>> But have you actually called AudioDeviceStart on the device you are
>
>> going to read from? This is absolutely required in order to engage the
>
>> device's timing services. You can pass NULL as the IOProc to just
>
>> start
>
>> things up if you don't have an IOProc.
>
>>
>
>>>> Is the address of the AudioBufferList you are passing to
>
>>>> AudioDeviceRead() the same as the one that you registered with
>
>>>> kAudioDevicePropertyRegisterBufferList?
>
>>>
>
>>> I double-checked the addresses of the AudioBufferList and they
>
>>> matched, too.
>
>>>
>
>>>> Does the device you are reading from really have inputs?
>
>>>
>
>>> I checked that.
>
>>>
>
>>>> Is the time stamp valid and for a time far enough in the past?
>
>>>
>
>>> Maybe that could be the error. I start with
>
>>>
>
>>> AudioDeviceGetCurrentTime()
>
>>> - AudioDeviceGetProperty (... kAudioDevicePropertySafetyOffset ...)
>
>>> - totalReadBufferLength / frameSize
>
>>>
>
>>> Does that make sense?
>
>>
>
>>
>
>> That should be reasonable, except if the device isn't running, you
>
>> won't be getting valid time stamps.
>
>>
>
>> You should also take a look at the PlayEffect sample code to see an
>
>> example of how it's done.
>
>>
>
>> --
>
>>
>
>> Jeff Moore
>
>> Core Audio
>
>> Apple
>
>> _______________________________________________
>
>> 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.
>
>>
>
>
>
>
>
>
--
>
>
Jeff Moore
>
Core Audio
>
Apple
_______________________________________________
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.