Re: AUVarispeed strangeness
Re: AUVarispeed strangeness
- Subject: Re: AUVarispeed strangeness
- From: William Stewart <email@hidden>
- Date: Tue, 1 Apr 2008 19:16:30 -0700
On Apr 1, 2008, at 6:52 PM, Kevin Dixon wrote:
I'm trying to render a file through an AUVarispeed (its just
floating in a
AUGraph, with no connections).
I am using a callback to supply the AU with data, set as so:
AURenderCallbackStruct cb = { SFEngine::AudioSupplyCallback, this };
AudioUnitSetProperty(mVarispeedUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input, 0, &cb, sizeof(cb));
which returns noErr.
Then, I set the stream description for the input/output as well as the
channel layouts.
You can't do that while you have a callback on the input. So, you need
to set the format first, then establish the callback.
I set the parameters for playback rate to "1" and pitch cents to
"0", just
to try and pass audio.
I set the kAudioOfflineUnitProperty_InputSize and
kAudioOfflineUnitProperty_OutputSize on the Global scope to the same
size
as my kNumFramesPerSlice (512)
I then perform the rendering as such:
UInt32 kNumFramesPerSlice = 512;
//run until the SMPTE file is out of data
while((!inputFileEOFReached) && (processStatus !=
kSFEngineStatus_Abort)) {
AudioUnitRenderActionFlags actionFlags =
kAudioOfflineUnitRenderAction_Render;
AudioUnitSetProperty(mVarispeedUnit,
kAudioUnitOfflineProperty_StartOffset, kAudioUnitScope_Global, 0,
&(curTime.mSampleTime), sizeof(curTime.mSampleTime));
//TODO: schedule parameters
err = AudioUnitRender(mVarispeedUnit, &actionFlags, &curTime, 0,
kNumFramesPerSlice, theAudioData);
if((actionFlags == kAudioOfflineUnitRenderAction_Render |
kAudioOfflineUnitRenderAction_Complete) &&
(theAudioData->mBuffers[0].mDataByteSize != 0)) {
ExtAudioFileWrite(outputFile, theAudioData-
>mBuffers[0].mDataByteSize /
sizeof(Float32), theAudioData);
}
curTime.mSampleTime += kNumFramesPerSlice;
}
the Varispeed reports Render | Complete, but the mDataByteSize is
always
something in the neighborhood of 4294965248, which I find hard to
believe,
given a 512 input size.
Apparently I've neglected to set some property or something correctly.
This same style of Render loop has worked fine for me with other
AudioUnits before.
Offline render units have a slightly different semantic - including a
notion of preflighting them.
In the auprocess example (in AudioFileTools) there's an au wrapper
(CAAUProcessor which is in Public Utility) object that is used to
handle this - its has all the code to render with effects, converters
or offline units, so its more complicated than to deal with just one
type of audio unit, but you should be able to sort it out from that I
think.
Thanks
Bill
Any suggestions would be appreciated! Thanks,
-Kevin
_______________________________________________
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