Re: kAudioDevicePropertyBufferFrameSizeRange reports wrong values
Re: kAudioDevicePropertyBufferFrameSizeRange reports wrong values
- Subject: Re: kAudioDevicePropertyBufferFrameSizeRange reports wrong values
- From: Jeff Moore <email@hidden>
- Date: Tue, 16 Nov 2004 12:53:23 -0800
I did a little more digging.
The call that was added to change the buffer size is generating two
kAudioHardwareBadDeviceError errors because the AudioDeviceID being
used by mOutputDevice is 0. The same thing happens if I change the 2048
into a 1024. So it would appear that inserting the code to change the
buffer size in that place isn't a valid thing to do in terms of the
application logic.
That being the case, I tried changing the buffer size while IOProcs
were running in HALLab and everything seemed to work OK.
On Nov 16, 2004, at 12:35 PM, Jeff Moore wrote:
I inserted the code you provided into a fresh copy of ComplexPlayThru
and I see what you are seeing. When I run it on top of a debug build
of the HAL, I also see the HAL generating some errors, so it appears
to me that the bug is probably in either the ComplexPlayThru code or
in AUHAL. It's hard for me to tell.
On Nov 16, 2004, at 10:30 AM, Rolf Nilsson wrote:
> Message: 5
> Date: Mon, 15 Nov 2004 11:28:44 -0800
> From: Jeff Moore <email@hidden>
> Subject: Re: kAudioDevicePropertyBufferFrameSizeRange reports wrong
values
> To: CoreAudio API <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> I just played around with my iMic and I could set the buffer frame
size
> to any value within the range the HAL reported, including 2048.
You'll
> need to be more specific about the failure you are seeing and the
code
> you are using before I can give you any advice.
Yes, forgot that. What happens in my own app is that no errors are
reported but
the ioProc for the output device stops being fired
I tried the same thing with your ComplexPlayThru example:
here is a code snippet from that example, my addition is between the
#if 1 and #endif statement:
OSStatus ComplexPlayThru::SetOutputDeviceAsCurrent(AudioDeviceID out)
{
UInt32 size = sizeof(AudioDeviceID);;
OSStatus err = noErr;
if(out == kAudioDeviceUnknown) //Retrieve the default output device
{
err =
AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
&size,
&out);
}
mOutputDevice.Init(out, false);
checkErr(err);
// here is were i try to change frame size for the output device
#if 1
UInt32 outPutFrameSize = 2048; // 1024 work OK, but not 2048
// skipped checking that the frame size is within the correct range
(but it is)
mOutputDevice.SetBufferSize(outPutFrameSize); // in frames
#endif
//Set the Current Device to the Default Output Unit.
err = AudioUnitSetProperty(mOutputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&mOutputDevice.mID,
sizeof(mOutputDevice.mID));
return err;
}
Does not work either.
Am I trying to set a new frame size at the wrong place?
Or am I missing something else?
Thanks for any help
Rolf Nilsson
>
> On Nov 14, 2004, at 11:54 PM, Rolf Nilsson wrote:
>
> >
> > Hi,
> >
> > The following code works fine with the built in audio device on my
> > Dual G4 running OS 10.2.8 (and 10.3.6 as well)
> > but not when using an iMic.
> >
> >
> > UInt32 desiredFrameSize = 2048;
> >
> >
> > AudioValueRange theAudioValueRange;
> >
> > // check that the desired value is within the allowed range
> > UInt32 propsize = sizeof(AudioValueRange);
> > OSErr theErr = AudioDeviceGetProperty(mID, 0, false,
> > kAudioDevicePropertyBufferFrameSizeRange, &propsize, &
> > theAudioValueRange);
> >
> >
> > if (desiredFrameSize < theAudioValueRange.mMinimum)
> > desiredFrameSize = theAudioValueRange.mMinimum;
> > else if (desiredFrameSize > theAudioValueRange.mMaximum)
> > desiredFrameSize = theAudioValueRange.mMaximum;
> >
> > // values is now within correct ranges
> > propsize = sizeof(UInt32);
> > theErr = AudioDeviceSetProperty(mID, NULL, 0, false,
> > kAudioDevicePropertyBufferFrameSize, propsize, &
desiredFrameSize);
> >
> >
> > For the iMic, the reported maximum value is 4608 which is way
below
> > the requested 2048;
> > If I lower the desired frame size to 1024 it works fine (actually
the
> > highest value that works is 1156 which is about 4608/4 but not
> > exactly).
> >
> > Is this a bug in the iMic driver or am I missing something
obvious?
> >
> > Thanks
> > Rolf
> >
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Coreaudio-api mailing list (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
40apple.com
> >
> > This email sent to email@hidden
> >
>
> --
>
> Jeff Moore
> Core Audio
> Apple
>
--
Jeff Moore
Core Audio
Apple
--
Jeff Moore
Core Audio
Apple
_______________________________________________
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