• 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
Varispeed AU configuration with QT audio extraction?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Varispeed AU configuration with QT audio extraction?


  • Subject: Varispeed AU configuration with QT audio extraction?
  • From: Ray Garcia <email@hidden>
  • Date: Fri, 24 Mar 2006 18:53:47 -0600


I've been gnashing my teeth over the problem of feeding data from a QuickTime audio extraction session through an AU graph with an output node and a varispeed node. I've had success directly driving a default audio hardware component with a renderproc grabbing data provided by an audio extraction session, but this appears to be dependent on what the hardware capabilities are (e.g. feeding it a 22kHz sample gets rejected by a lot of newer hardware). Apple's documentation is incomplete (read: infuriating) in its lack of description of the AUs available (a page should be dedicated to describing the inputs, outputs, and error conditions for each component they provide IMHO), so I'm turning to the list in hopes that someone will suggest a solution or resource for me to solve this with.


The code I'm using is based loosely on the ComplexPlayThru example program, which does a similar job, only it uses an AU connected to an input device rather than an QT audio session..

Specifically, the assertion that fails is the setting of the stream characteristics for the varispeed input side. The error is -10868, aka kAudioUnitErr_FormatNotSupported. asbdSession is the stream description for the audio being extracted from QT, which is known to work when used to set the asbd of the output device.

Is there another AU I need to be inserting inline before the varispeed to do a format conversion (and why?)? Where is it documented what formats the varispeed will accept as input? Is there source code for the varispeed available so I can decipher the errors that Apple vaguely hints at the cause of?


Thanks in advance for any light that can be shed on this!

// check that we have matching channel counts
// if not, things get complex
AudioStreamBasicDescription asbdOutput;
UInt32 propertySize = sizeof(AudioStreamBasicDescription);
err = AudioUnitGetProperty(mOutputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &asbdOutput, &propertySize);
NSAssert( (err==noErr) , @"unable to check channel count on output unit" );


NSAssert( (asbdOutput.mChannelsPerFrame == asbdSession.mChannelsPerFrame),
@"mismatched channel count! need more code for channel mapping!" );


// set the input side of the varispeed to match the session
propertySize = sizeof(asbdSession);
err = AudioUnitSetProperty(mVarispeedUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &asbdSession, propertySize);
NSAssert( (err==noErr) , @"unable to set input stream characteristics for varispeed to match session" );


// set the output device ASBD to the session ATBD with the nominal output device sampling rate
Float64 outputRate=0;
propertySize = sizeof(Float64);
AudioDeviceGetProperty(mOutputDev, 0, 0, kAudioDevicePropertyNominalSampleRate, &propertySize, &outputRate);


    asbdOutput = asbdSession;
    asbdOutput.mSampleRate = outputRate;

err = AudioUnitSetProperty(mOutputUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &asbdOutput, propertySize);
NSAssert( (err==noErr) , @"unable to set format on output device" );


// set the rate of the varispeed unit to bridge session to output
Float32 rate = asbdSession.mSampleRate / asbdOutput.mSampleRate;
err = AudioUnitSetParameter (mVarispeedUnit,kVarispeedParam_PlaybackRate,kAudioUnitScope_Global, 0, rate,0);


    // set the callback of the speed converter to be our data shovel
    output.inputProc = dataShovel;
    output.inputProcRefCon = (void *)session;

err = AudioUnitSetProperty(mVarispeedUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0,
&output,
sizeof(output));
NSAssert( (err==noErr) , @"unable to set varispeed input callback" );


_______________________________________________
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: Varispeed AU configuration with QT audio extraction?
      • From: William Stewart <email@hidden>
  • Prev by Date: Simple Mute controls
  • Next by Date: Where to find Error Code -10867 - AUComponent.h
  • Previous by thread: Re: Simple Mute controls
  • Next by thread: Re: Varispeed AU configuration with QT audio extraction?
  • Index(es):
    • Date
    • Thread