• 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: HALOutputUnit (Pt 1)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HALOutputUnit (Pt 1)


  • Subject: Re: HALOutputUnit (Pt 1)
  • From: Doug Wyatt <email@hidden>
  • Date: Tue, 3 Feb 2004 15:47:08 -0800

On Feb 3, 2004, at 15:35, Bob Stuller wrote:
Doug, Greetings!

At 12:17 PM -0800 2/3/04, Doug Wyatt wrote:
On Feb 3, 2004, at 10:47, Bob Stuller wrote:
Okay, I'm stuck. I'm trying to use the HALOutputUnit to pull 16-bit audio at 16 kHz and,
when I get to the point of trying to set these settings, I get a kAudioUnitErr_PropertyNotWritable error. Here is sketch of the code that I am using.
AudioStreamBasicDescription format;
memset(&format, 0, sizeof(AudioStreamBasicDescription));
format.mSampleRate = 16000.0;
format.mBytesPerFrame = 2;
format.mFramesPerPacket = 1;
format.mBytesPerPacket = 2;
format.mChannelsPerFrame = 1;
format.mBitsPerChannel = 16;
format.mFormatID = kAudioFormatLinearPCM;
format.mFormatFlags = kLinearPCMFormatFlagIsBigEndian
// | kLinearPCMFormatFlagIsSignedInteger
| kLinearPCMFormatFlagIsPacked
| kLinearPCMFormatFlagIsNonInterleaved;

status = AudioUnitSetProperty(mHALOutInstance,
kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
1, &format, sizeof(format));

This is the AudioUnitSetProperty call that returns the NotWritable error. Where did I go wrong here?

element 1's input scope is the hardware input format -- you want to be changing its format in the output scope

Changing the code above to:

status = AudioUnitSetProperty(mHALOutInstance,
kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output,
1, &format, sizeof(format));
<<
... gets me a kAudioFormatUnsupportedDataFormatError. Adding the kLinearPCMFormatFlagIsSignedInteger flag to the format makes that error go away however. Going back to my requirements, I find that I need signed integers but was left wondering: Can't the HALOutputUnit make that particular conversion?

Hi Bob,

(The I/O unit uses an AudioConverter under the hood to do these conversions)

The AudioConverter does support 8-bit unsigned since that can be found in WAVE files, but I'm not aware of any common PCM file formats that use unsigned integers for 2-byte and larger sample words.

Doug

--
Doug Wyatt
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.

References: 
 >Re: HALOutputUnit (Pt 1) (From: Bob Stuller <email@hidden>)
 >Re: HALOutputUnit (Pt 1) (From: Doug Wyatt <email@hidden>)
 >Re: HALOutputUnit (Pt 1) (From: Bob Stuller <email@hidden>)

  • Prev by Date: Re: HALOutputUnit (Pt 1)
  • Next by Date: Re: multithreaded mixer
  • Previous by thread: Re: HALOutputUnit (Pt 1)
  • Next by thread: Re: HALOutputUnit (Pt 1)
  • Index(es):
    • Date
    • Thread