Re: A number of simple questions (still a few unanswered)
Re: A number of simple questions (still a few unanswered)
- Subject: Re: A number of simple questions (still a few unanswered)
- From: Jeff Moore <email@hidden>
- Date: Wed, 06 Feb 2013 16:50:08 -0800
Fractional sample times are very useful for doing synchronization calculations. They are useful for dealing with durations that are not an integral number of samples, like the wavelength of a 440hz sine wave playing on a 44100 device.
--
Jeff Moore
Core Audio
Apple
On Feb 6, 2013, at 4:44 PM, Seth Willits <email@hidden> wrote:
> On Feb 6, 2013, at 4:12 PM, René J.V. Bertin wrote:
>
>>>>> - Why is AudioTimeStamp.mSampleTime a float if it's an integer number of samples?
>>>
>>> Still curious why it's a Float64 in the first place. :)
>>
>> Who says there's an integer number of samples in a second, and not in say, 3 seconds? And how else would you represent the sample duration for a rate of, say, 17 samples per second?
>
>
> Forgive me since it's already been a few months since I was knee deep in Core Audio, but …
>
>
> That's what mSampleRate is for not, mSampleTime. mSampleTime is the "n" in "the nth sample."
>
>
> For example:
>
> memset(&timeStamp, 0, sizeof(timestamp));
> timestamp.mSampleTime = 0;
> timestamp.mFlags = kAudioTimeStampSampleTimeValid;
>
> for (int sampleIndex = 0; sampleIndex < 44100; sampleIndex += 512) {
> ...
> timestamp.mSampleTime = (Float64)sampleIndex;
> AudioUnitRender(outputUnit, &actionFlags, ×tamp, 0, 512, audioBufferList);
> ...
> }
>
>
> AFAICT it's always an integer value.
>
>
> --
> Seth Willits
> _______________________________________________
> 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