• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting Failure from kAudioDevicePropertyBufferFrameSize
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Failure from kAudioDevicePropertyBufferFrameSize


  • Subject: Re: Getting Failure from kAudioDevicePropertyBufferFrameSize
  • From: Kevin Vanwulpen <email@hidden>
  • Date: Wed, 16 Nov 2011 07:52:55 -0800

Hi,

Are you on 10.6 or 10.7 ?

Yesterday I ran into the same and found on 10.7 for an input-only device I had to provide it input scope for kAudioDevicePropertyBufferFrameSize.

Global scope worked for the same device on 10.6 for me(same setup, just different boot partition 10.6 vs 10.7)

I didn't try an output-only device to see if that requires output scope as this was something isolated I needed to do on my Mac and not production code.

Hope this helps,
Kevin
Have you tried querying using the AudioObjectPropertyAddress structure?
http://developer.apple.com/library/mac/#technotes/tn2223/_index.html


On Tue, Nov 15, 2011 at 2:30 PM, Seth Willits <email@hidden> wrote:


I'm opening the AudioOutputUnit and setting that up to write the audio out to a file. So one of the steps in that process (the last one below), is to get the number of frames in the audio buffers, using  a simple AudioUnitGetProperty, but for one particularly user of my code, doing so fails with the error kAudioUnitErr_InvalidProperty.

Any idea why? 

Is there another way I should be figuring out how big to make the AudioBufferList?




Code mostly in its entirety just incase it's something I did along the way:


// Open the AudioOutputUnit
description.componentType = kAudioUnitType_Output;
description.componentSubType = kAudioUnitSubType_HALOutput;
description.componentManufacturer = kAudioUnitManufacturer_Apple;
description.componentFlags = 0;
description.componentFlagsMask = 0;
if ((component = FindNextComponent(NULL, &description))) {
err = OpenAComponent(component, &mAudioOutputUnit);
...
}


// Enable input on the AUHAL
param = 1;
err = AudioUnitSetProperty(mAudioOutputUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &param, sizeof(UInt32));


// Disable Output on the AUHAL
param = 0;
err = AudioUnitSetProperty(mAudioOutputUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &param, sizeof(UInt32));


// Set the current device to the default input unit.
err = AudioUnitSetProperty(mAudioOutputUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &mInputDeviceID, sizeof(AudioDeviceID));


// Get the audio format of the input device
param = sizeof(AudioStreamBasicDescription);
err = AudioUnitGetProperty(mAudioOutputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &mDeviceFormat, &param);


// Set the format the AudioOutputUnit will output data in
...
err = AudioUnitSetProperty(mAudioOutputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &mOutputFormat, sizeof(AudioStreamBasicDescription));


// Get the number of frames in the IO buffer(s)
param = sizeof(UInt32);
err = AudioUnitGetProperty(mAudioOutputUnit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, 0, &numFramesInBuffer, &param);

/********* FAILS WITH kAudioUnitErr_InvalidProperty *****/





I'm asking for the number of frames in the buffers because I use that to calculate how big the buffers that I allocate should be. (number of bytes per frame * number of frames in buffer). That comes straight out of the Apple sample code:
http://developer.apple.com/library/mac/#samplecode/RecordAudioToFile/Listings/DCAudioFileRecorder_cpp.html




--
Seth Willits




 _______________________________________________
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




 _______________________________________________
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

 _______________________________________________
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

  • Follow-Ups:
    • Re: Getting Failure from kAudioDevicePropertyBufferFrameSize
      • From: Seth Willits <email@hidden>
References: 
 >Getting Failure from kAudioDevicePropertyBufferFrameSize (From: Seth Willits <email@hidden>)
 >Re: Getting Failure from kAudioDevicePropertyBufferFrameSize (From: kamaldeep tumkur <email@hidden>)

  • Prev by Date: Re: Getting Failure from kAudioDevicePropertyBufferFrameSize
  • Next by Date: Varispeed ios
  • Previous by thread: Re: Getting Failure from kAudioDevicePropertyBufferFrameSize
  • Next by thread: Re: Getting Failure from kAudioDevicePropertyBufferFrameSize
  • Index(es):
    • Date
    • Thread