• 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
Re: AudioQueue newbie : Handling Forward , Rewind , etc..,
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioQueue newbie : Handling Forward , Rewind , etc..,


  • Subject: Re: AudioQueue newbie : Handling Forward , Rewind , etc..,
  • From: William Stewart <email@hidden>
  • Date: Tue, 29 Jul 2008 12:57:27 -0700


On Jul 29, 2008, at 12:22 PM, Devon Tucker wrote:

Raj,

I'm currently grappling with the exact same issues. I think I know how to solve these problems conceptually but I'm not sure about the implementation. Keep in mind that I know very little about digital audio so I hope someone will correct me if I'm wrong (Which I very well could be).

For forward and rewind, seeking, you need to determine the packet index given the time in seconds you wish to seek to. For example given that you want to seek to time "pos" you would calculate the necessary packet index like this:

packetIndex = (pos * sampleRate) / framesPerPacket

Implementation-wise, I guess, depends on how you want to do it. You could stop playback, clear your buffers, start buffering from then new packet index and start playback again. You could also simply reset your packetIndex to the desired index and keep playing normally.

Yes - that's pretty much it. You can implement a skip-type fast forward by just feeding in bits of data as you skip through the file.


As for tracking the position through the song, this can be accomplished much the same way. Given the currently playing packet we can determine the position by:

AudioQueueGetCurrentTime

An audio queue always starts at sample time == 0.

position = (packetIndex * framesPerPacket) / sampleRate

In order to keep track of the position in the audio file, with respect to implementation, we need to keep track of our current packet index. This packet index could be different from the packet index needed for your buffer callback however, due to buffer priming. I recommend keeping a separate packet index for playback, which starts at zero when playback starts and gets incremented by the number of packets read in your buffer callback.

Hope this helps,
Devon

On 28-Jul-08, at 5:56 AM, Rajeswar Rao wrote:

Hi ,

Im trying to paly audio file, using AudioQueue ,
I could Play , Pause using AudioQueueStart and AudioQueuePause ;

Now im trying to implement 'Forward/Rewind' functionality also the duration played so far .....
How can I achieve this ? Do I have to handle these things in "Callback function" ? if so , how ?


any suggestions are appreciated.

Thanks in Adavance
~Raj
_______________________________________________
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


Cheers,
Devon




_______________________________________________ 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
References: 
 >AudioQueue newbie : Handling Forward , Rewind , etc.., (From: Rajeswar Rao <email@hidden>)
 >Re: AudioQueue newbie : Handling Forward , Rewind , etc.., (From: Devon Tucker <email@hidden>)

  • Prev by Date: Re: AudioQueue newbie : Handling Forward , Rewind , etc..,
  • Next by Date: Re: Problem creating and using aggregate device
  • Previous by thread: Re: AudioQueue newbie : Handling Forward , Rewind , etc..,
  • Next by thread: AudioConverter's algorithm vs complexity vs quality
  • Index(es):
    • Date
    • Thread