Re: SetCurrentPosition
Re: SetCurrentPosition
- Subject: Re: SetCurrentPosition
- From: Doug Wyatt <email@hidden>
- Date: Mon, 3 May 2004 10:26:44 -0700
Rob,
You could add a method to CAAudioFileReader to start play at a
specified packet number. Notice that SetCurrentPosition is already
translating the double into a packet number, which shows you what to do
to start play at a specific packet.
As for where to stop playing ... you could add a member to
CAAudioFileRead to say where to stop, then modify
CAAudioFileReader::ReadBuffer to notice when it's reached that point
and limit / stop reading accordingly. Notice that the call to
b->UpdateAfterRead with nPackets==0 will signify that you've reached
the end.
For linear PCM, packets == frames; the code uses packets everywhere
because it does handle seeking within a file by packet number for
encoded formats, but for those formats, it doesn't quite know how to
get to a specific frame index.
Doug
On Apr 30, 2004, at 22:33, email@hidden wrote:
Hi,
This should be easy.. All I want to do is modify afplay
(/Developer/Examples/CoreAudio/Services/AudioFileTools/) (well it
doesn't have
to be afplay, it just has to work already), in order to play a part of
an audio
file. I just want a command line utility that plays from starttime to
endtime.
It shouldn't be hard, but SetCurrentPosition is a double between 0-1,
and I
can't seem to find a divisor that will allow me to quantify start time
in
seconds into this double value.
I know I need sleep, but can anyone help?
Kind Regards,
Rob
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.