• 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 2)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HALOutputUnit (Pt 2)


  • Subject: Re: HALOutputUnit (Pt 2)
  • From: Aaron Eppolito <email@hidden>
  • Date: Tue, 24 Feb 2004 11:33:55 -0800

On Feb 24, 2004, at 7:20 AM, Bob Stuller wrote:

> At 7:13 PM -0800 2/23/04, Aaron Eppolito wrote:
>> This sounds like the same problem I was having. You must set the
>> sample rate of the OutputScope of the InputBus equal to the
>> InputScope of the InputBus, otherwise, you'll get the CannotDo error.
>
> How is the sample rate of the InputScope of the InputBus set? When I
> do a AUSetProperty-SampleRate on the input side of the HALAU, i.e. the
> side the device is hooked up to, I get a
> kAudioUnitErr_PropertyNotWritable error. Going to Global scope (still
> on the input element) gives a kAudioUnitErr_InvalidElement error.

Here's what I did:

// get the "input of input" stream description
AudioStreamBasicDescription asbd;
size = sizeof(asbd);
result = AudioUnitGetProperty (unit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, 1, &asbd, &size);
THROW_RESULT ("AudioUnitGetProperty");

// get the "output of input" stream description
AudioStreamBasicDescription outputOfInput;
size = sizeof(outputOfInput);
result = AudioUnitGetProperty (unit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output, 1, &outputOfInput, &size);
THROW_RESULT ("AudioUnitGetProperty");

// set the output of the input to be the right sample rate
// as well as the number of channels
outputOfInput.mSampleRate = asbd.mSampleRate;
if(asbd.mChannelsPerFrame == 1) outputOfInput.mChannelsPerFrame = 1;
result = AudioUnitSetProperty (unit, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output, 1, &outputOfInput, size);
THROW_RESULT ("AudioUnitSetProperty");

Better to do would be to skip the second chunk and instead explicitly
set the stream format you want.

> I'd assumed that setting the device's format via the HALAU would set
> both the device's sample rate &, necessarily, that of the HALAU's
> input side (of element == 1).

I assumed that too. Alas, it is an incorrect assumption. All Audio
Units initialize to 44.1kHz de-interleaved stereo float.

-Aaron
_______________________________________________
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.

  • Follow-Ups:
    • Re: HALOutputUnit (Pt 2)
      • From: Bob Stuller <email@hidden>
References: 
 >Re: HALOutputUnit (Pt 2) (From: Bob Stuller <email@hidden>)
 >Re: HALOutputUnit (Pt 2) (From: Doug Wyatt <email@hidden>)
 >Re: HALOutputUnit (Pt 2) (From: Bob Stuller <email@hidden>)
 >Re: HALOutputUnit (Pt 2) (From: Doug Wyatt <email@hidden>)
 >Re: HALOutputUnit (Pt 2) (From: Bob Stuller <email@hidden>)
 >Re: HALOutputUnit (Pt 2) (From: Doug Wyatt <email@hidden>)
 >Re: HALOutputUnit (Pt 2) (From: Bob Stuller <email@hidden>)
 >Re: HALOutputUnit (Pt 2) (From: Aaron Eppolito <email@hidden>)
 >Re: HALOutputUnit (Pt 2) (From: Bob Stuller <email@hidden>)

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