Record/Playback with AudioQueue on iPhone
Posted
by Biranchi
on Stack Overflow
See other posts from Stack Overflow
or by Biranchi
Published on 2010-04-16T06:15:33Z
Indexed on
2010/04/16
6:23 UTC
Read the original article
Hit count: 487
Hi,
I am currently using Audio Queues on the iPhone to record and playback audio.
What I would like to be able to do is to record some audio, allow the user to pause the record queue, and to seek back and forward through the audio to select a position from where they can start recording from again.
I have got over the seeking issue by making the playback AudioQueueBuffer sizes small enough so that the play audio queue callback happens at a rate that allows the user to use a slider control to hear the audio as they adjust the slider back and forth.
I think I can achieve the recording at a new position by setting the inStartingPacket parameter of the AudioFileWritePackets function that I call from the Audio Recording Queue callback.
The trouble is this only inserts audio over the previously recorded audio. The file length obviously doesn't change so if the user were to go backwards and record less audio than before, the old audio still remains after the end of the newly recorded audio.
Is there a way I can get the AudioFile to truncate at the point the user starts to insert the new audio, is there some other way I can remove the old audio starting at the insert position or is there a better way about going about this task?
Thanks
© Stack Overflow or respective owner