Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 944
Bart Jacobs Avatar asked May 12 '12 08:05

Bart Jacobs


1 Answers

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/

like image 123
Maq Avatar answered Sep 29 '22 06:09

Maq