Bart Jacobs
Bart Jacobs

Reputation: 9082

AudioQueue trimming and buffer size

Even though the application works as expected, I am getting a message in the console that I'd like to understand in more detail.

The setup is as follows. An AVAudioPlayer is created and an .m4a file (03:22 in length and 618 KB in size) is loaded. The file has a bit rate of 23 kbps. I realize that the bit rate is very low, but this is acceptable for the application.

Whenever, I adjust the audio player's currentTime property, I get the following message logged to the console.

AudioQueue: request to trim 2112 + 0 = 2112 frames from buffer containing 1024 frames

The result of setting the currentTime property is as expected, but I wonder what this message means exactly and what I can do to prevent it from showing up.

Upvotes: 7

Views: 1903

Answers (1)

Maq
Maq

Reputation: 403

Worked for me: Stop player before setting its currentTime property. Then set currentTime, prepareToPlay and play.

[avAudioPlayer stop];
[avAudioPlayer setCurrentTime:newCurrentTime];
[avAudioPlayer prepareToPlay];
[avAudioPlayer play];

source: http://eureka.ykyuen.info/2010/06/10/iphone-add-an-uislider-for-avaudioplayer/

Upvotes: 5

Related Questions