Re: looking for copy of Doug Wyatt's note on from 2006 was : How do you pause, stop and reset an AUFilePlayer in IOS5?
Re: looking for copy of Doug Wyatt's note on from 2006 was : How do you pause, stop and reset an AUFilePlayer in IOS5?
- Subject: Re: looking for copy of Doug Wyatt's note on from 2006 was : How do you pause, stop and reset an AUFilePlayer in IOS5?
- From: Brian Hall <email@hidden>
- Date: Fri, 27 Jul 2012 17:31:14 -0400
http://lists.apple.com/archives/coreaudio-api/2005/Dec/msg00010.html
On Fri, Jul 27, 2012 at 4:05 PM, Andy Davidson
<email@hidden> wrote:
> Does any one know where I can find a copy of Doug Wyatt's notes about
> using the AUFilePlayer ?
>
> I did not find much using google or searching this mail lists archives
>
> Thanks
>
> Andy
>
> On 7/18/12 10:13 PM, "Robert Martin" <email@hidden> wrote:
>
>>It's a bit more complicated than that.
>>
>>What you'll get from 'getting' kAudioUnitProperty_CurrentPlayTime is the
>>-offset- time from when you last set
>>kAudioUnitProperty_ScheduledFileRegion.
>>
>>If you schedule a new region with that time, you won't resume at the
>>correct place if you pause/resume more than once.
>>
>>Here is a copy of Doug Wyatt's note on this from 2006, since I no longer
>>have the link:
>>
>>"To change the play position:
>>
>>[1] obtain the current play position:
>>AudioTimeStamp ts;
>>UInt32 size = sizeof(ts);
>>AudioUnitGetProperty(mFilePlayerAU,
>>kAudioUnitProperty_CurrentPlayTime, kAudioUnitScope_Global, 0, &ts,
>>&size);
>>Float64 sampleFrame = ts.mSampleTime;
>>
>>Now you know where playback is, relative to the beginning of the
>>event timeline that you scheduled. If you scheduled the beginning of
>>a file to play at the beginning of the timeline, then the play
>>position is the same as the position in the file (except in the case
>>of sample rate conversion, which is another wrinkle.....)
>>
>>[2] stop:
>>
>>AudioUnitReset(mFilePlayerAU, kAudioUnitScope_Global, 0);
>>
>>[3] start again. Here you can specify the starting sample offset in
>>the file.
>>
>>For example, to implement pause/resume, you'd obtain the play
>>position before pausing, and add that to the position in the file
>>where you last started. That would be the playRegion.mStartFrame when
>>scheduling the first event when you resume."
>>
>>Rob
>>
>>
>>
>>On Jul 18, 2012, at 7:36 PM, Aran Mulholland <email@hidden>
>>wrote:
>>
>>> You can't pause the AUFilePlayer. What you can do is call something like
>>>
>>> AudioTimeStamp ts;
>>> UInt32 size = sizeof(ts);
>>> AudioUnitGetProperty(filePlayerUnit_,
>>> kAudioUnitProperty_CurrentPlayTime, kAudioUnitScope_Global, 0, &ts,
>>> &size);
>>> Float64 sampleFrame = ts.mSampleTime;
>>>
>>> to get the currently playing sample frame, then call
>>>
>>> AudioUnitReset(filePlayerUnit_, kAudioUnitScope_Global, 0);
>>>
>>> To stop it and if you want to resume playback (from pause), schedule a
>>> new region with the sample time you had before you called
>>> AudioUnitReset. Be nice if it had a pause, but not hard to implement
>>> yourself.
>>
>> _______________________________________________
>>Do not post admin requests to the list. They will be ignored.
>>Coreaudio-api mailing list (email@hidden)
>>Help/Unsubscribe/Update your Subscription:
>>gration.com
>>
>>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
_______________________________________________
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