• 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: Limitations on DefaultOutput unit format converter?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limitations on DefaultOutput unit format converter?


  • Subject: Re: Limitations on DefaultOutput unit format converter?
  • From: William Stewart <email@hidden>
  • Date: Fri, 16 Oct 2009 15:10:56 -0700

I'd actually round up (probably to a multiple of 16), so in simple terms:

maxFrames += 16;
maxFrames &= 0xFFFFFFF0;

I'd go up here as sometimes the rate conversions are at odd rates and so the pull sizes from pull to pull are slightly different. an even multiple of 16 samples should be more than enough padding to deal with this.

Bill

On Oct 16, 2009, at 2:19 PM, Christopher Liscio wrote:

Bill, Doug,

It appears this problem was also occurring in my other code that discovered this issue swapping out the GenericOutput unit.

So what I've done is the following, in both cases: (apologies if the code doesn't come across)

UInt32 maxFrames;
UInt32 mfSize = sizeof(maxFrames);
NSXThrowError( AudioUnitGetProperty( outputUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 0, &maxFrames, &mfSize ) );


Float64 israte, osrate;
UInt32 srSize = sizeof(israte);
NSXThrowError( AudioUnitGetProperty( outputUnit, kAudioUnitProperty_SampleRate, kAudioUnitScope_Input, 0, &israte, &srSize ) );
srSize = sizeof(osrate);
NSXThrowError( AudioUnitGetProperty( outputUnit, kAudioUnitProperty_SampleRate, kAudioUnitScope_Output, 0, &osrate, &srSize ) );


DEBUG( @"israte %f, osrate %f", israte, osrate );
maxFrames = maxFrames * MAX( 1.0, ceil( israte / osrate ) );
DEBUG( @"Adjusting maxFrames to %d", maxFrames );

// Set the maximum frames on the other audio units to jive with the output unit's conversion rate

If you guys see any trouble in my logic above, please let me know.

Thanks for the great help, as usual!

Chris Liscio
http://supermegaultragroovy.com
Learn _your_ music with Capo: http://capoapp.com

On Oct 16, 2009, at 4:18 PM, Christopher Liscio wrote:

Bill,

On Oct 16, 2009, at 3:56 PM, William Stewart wrote:

I think what you are seeing is a max frames error.
...

Awesome. You are correct. However, ...

to fix this on the varispeed AU, you should set MaxFramesPerSlice to be big enough to handle the IO request the output unit will make on it (in the case above, I would set this to 2280)

...how would I programmatically determine what the proper value is here?


I was under the assumption that I queried the output device for its MaxFramesPerSlice and it'd give me a value that'd make sense given the sample rate multiplier. I was using this Q&A article as my basis:

http://developer.apple.com/mac/library/qa/qa2007/qa1533.html

...that, combined with the fact that the DefaultOutputUnit basically wraps an AUConverter (among other things).

Do I instead want to query the input/output rates, and use their difference as a multiplier to choose the value?

(Can you tell I hate magic numbers?)

I don't know why the 176.4kHz case is failing though, but if you fix the above, I suspect that will work as well.

Your suspicion is correct. It fixed the problem here as well.

Thanks,

Chris Liscio
http://supermegaultragroovy.com
Learn _your_ music with Capo: http://capoapp.com


_______________________________________________ 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
References: 
 >Limitations on DefaultOutput unit format converter? (From: Christopher Liscio <email@hidden>)
 >Re: Limitations on DefaultOutput unit format converter? (From: William Stewart <email@hidden>)
 >Re: Limitations on DefaultOutput unit format converter? (From: Christopher Liscio <email@hidden>)
 >Re: Limitations on DefaultOutput unit format converter? (From: Christopher Liscio <email@hidden>)

  • Prev by Date: Re: Use of RegisterComponent
  • Next by Date: Re: CAPlayThrough questions
  • Previous by thread: Re: Limitations on DefaultOutput unit format converter?
  • Next by thread: iPhone OS: AVAudioRecorder .aif format
  • Index(es):
    • Date
    • Thread