• 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
Audio Unit pull data at different timestamp
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Audio Unit pull data at different timestamp


  • Subject: Audio Unit pull data at different timestamp
  • From: Roman <email@hidden>
  • Date: Fri, 24 Jul 2015 21:00:41 +0300

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Audio Unit pull data at different timestamp
      • From: Brian Willoughby <email@hidden>
  • Prev by Date: Re: AU base class for Instrument/Effect
  • Next by Date: playing a growing file
  • Previous by thread: Re: AU base class for Instrument/Effect
  • Next by thread: Re: Audio Unit pull data at different timestamp
  • Index(es):
    • Date
    • Thread