Re: AudioToolbox: shift playback position
Re: AudioToolbox: shift playback position
- Subject: Re: AudioToolbox: shift playback position
- From: Sergey Shapovalov <email@hidden>
- Date: Tue, 31 Mar 2009 16:31:53 +0400
2009/3/31 james mccartney
<email@hidden>
On Mar 30, 2009, at 5:55 AM, Sergey Shapovalov wrote:
Hi all.
I'm working on an audio recording / playback application for iPhone, and use Apple's sample project SpeakHere as a starting point. Everything works all right; however, there's just one thing I can't figure out how to do.
While playback, I want to be able to pause playing (via AudioQueuePause), then move to another time moment in the audio record, and resume playback from the new position (via AudioQueueStart). The problem is that I don't understand how to move to a new position.
AudioQueueStart accepts a pointer to AudioTimeStamp as the second parameter. However, when I manually set it up like this:
AudioTimeStamp ats;
ats.mSampleTime = seconds * audioPlayer.audioFormat.mSampleRate;
and pass it to AudioQueueStart, the playback resumes at the position where it was stopped, not at the specified time moment.
The time stamp argument is not a time in your media, it is a time in real time.
The AudioQueue plays the buffers you enqueue. If you want to play data from a different time in your media, then you should enqueue buffers containing the data from that time.
Thank you! This really makes sense. Starting at this point, I'll try to implement the functionality I want. However, if anybody has a working code snippet by hand and can post it here or provide a link, this would probably save some time for me. If not - well, thank you again; now that I got the general idea, I think I can work out the solution myself.
Best regards,
Sergey Shapovalov.
_______________________________________________
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