Hi all,

I develop an Audio Unit of the ‘aufx’ type that requires to read some data 
ahead, e.g. to output N frames I need 2 * N frames.

I have a class derived from AUBase with the overloaded AUBase::Render

> OSStatus DeclipUnit::Render(AudioUnitRenderActionFlags &ioActionFlags,
>                             const AudioTimeStamp &inTimeStamp,
>                             UInt32 nFrames)

and have the following snippet of code in it. I simplified the code, actually I 
need to buffer several packets before applying an effect. Here I just 
demonstrate the problem:

>     newTimeStamp.mSampleTime += nFrames;
>     result = m_pMainInput->PullInput(ioActionFlags, newTimeStamp, 0, nFrames);
>     if (result != noErr)
>         return result;


where m_pMainInput == GetInput(0);
so I pull from the upstream object the same amount of frames but at another 
timestamp. Then I initialize the output buffers like this:

> m_pMainOutput->PrepareBuffer(nFrames);

and fill them with data, for simplicity like this:

>     for (UInt32 channel = 0; channel < 
> GetOutput(0)->GetStreamFormat().mChannelsPerFrame; ++channel)
>     {
>         const AudioBuffer *srcBuffer = 
> &m_pMainInput->GetBufferList().mBuffers[channel];
>         const AudioBuffer *dstBuffer = 
> &m_pMainOutput->GetBufferList().mBuffers[channel];
>         
>         memcpy(dstBuffer->mData, srcBuffer->mData, srcBuffer->mDataByteSize);
>     }

This works pretty well in the AULab application but auval tool fails with the 
following error:

> Input Format: AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' 
> (0x00000029) 32-bit little-endian float, deinterleaved
> Output Format: AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' 
> (0x00000029) 32-bit little-endian float, deinterleaved
> Render Test at 512 frames
> ERROR:   AU is not passing time stamp correctly. Was given: 0, but input 
> received: 512
> 
> * * FAIL
> --------------------------------------------------
> AU VALIDATION FAILED: CORRECT THE ERRORS ABOVE.
> --------------------------------------------------


If I remove the line that changes the timestamp and call just

>     result = m_pMainInput->PullInput(ioActionFlags, newTimeStamp, 0, nFrames);
>     if (result != noErr)
>         return result;


then auvall validates my plugin successfully. So I’m pretty sure that auval 
concerns that my Audio Unit pulls data from a different timestamp. I found a 
property that looks like to what I need to make auval sure that all is fine 
with the timestamps: kAudioUnitProperty_InputSamplesInOutput
but auval never sets this property for my audio unit, so it looks useless.

Does anybody know if reading data at appropriate timestamps is possible for 
‘aufx’ audio units? I tried to look at ‘auol’ (offline) units, but they seem to 
be of no use, at least neither AULab, nor Final Cut Pro uses this type of audio 
units.

--
Please help!
Roman
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to