• 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
Making your own AudioTimeStamp on iOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making your own AudioTimeStamp on iOS


  • Subject: Making your own AudioTimeStamp on iOS
  • From: J Navarro via Coreaudio-api <email@hidden>
  • Date: Fri, 28 Jul 2023 08:33:26 -0700

Hey guys. i have an issue with time stamps. I’ve got a remote IO callback,
and I’m trying to render an AUv3 audio unit from there. I need to actually
render the AU in pieces, so instead of just passing the AudioTimeStamp from
the callback and getting all the frames, I have to make my own time stamp
to pass in to the render block of the audio unit.

So let’s say the remote io callback is for 128 frames, and I’m rendering
the AU 50 frames at a time. After I render the first buffer and I keep
incrementing the mSampleTime by 50. I set the flags member of the time
stamp to
kAudioTimeStampSampleTimeValid, so it should only be looking at
mSampleTime. I’m getting a faint clicking sound with this approach. If I
just render the whole buffer at once and pass the remote in time stamp in,
there’s no clicking. It’s perfect. So I know it’s something with the time
stamp.

Here’s the code that clicks:

void Controller::GetFloatSamples(AudioBufferList *bufferList, int len,
const AudioTimeStamp *timeStamp)
{
    AudioTimeStamp time = *timeStamp;
    time.mFlags = kAudioTimeStampSampleTimeValid;

    int remainingLen = len;
    while (remainingLen > 0)
    {
        // Dont grab samples past the next Tick, or Event, or buffer
        int lenToGet = MIN(tickCounter, remainingLen);

        int sumBufPos = len - remainingLen;

// this renders the audio unit after rendering a sampler. time is passed to
the render block
        mixer->GetBuffers(&lOutput[sumBufPos], &rOutput[sumBufPos],
lenToGet, &time);

        // dec counters
        remainingLen -= lenToGet;
        tickCounter -= lenToGet;

        if (tickCounter < 1)
        {
            EventProc();
            tickCounter += smpPerTick;
        }
        // INCREMENTING TIMESTAMP HERE
        time.mSampleTime = time.mSampleTime + lenToGet;
    }
}

If I just render the whole block at once, no clicks. So I just want to know
how to increment this time stamp inside a render callback. Looking at what
the system is sending me for mSampleTime, it just adds how many samples
were rendered in the last call on each new call, so I think I’m using it
right.

Thanks for any tips on this

--
--
Sonic Kat
 _______________________________________________
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

  • Prev by Date: Re: Not seeing 3rd party AUv3 plugins
  • Previous by thread: Re: Not seeing 3rd party AUv3 plugins
  • Index(es):
    • Date
    • Thread