0

Can anyone help decipher the correct implementation of the libspotify get_audio_buffer_stats callback. Specifically, we are supposed to populate a sp_audio_buffer_stats buffer, consisting of samples and stutter?

According to the Docs:

int samples - Samples in buffer.

int stutter - Number of stutters (audio dropouts) since last query.

I'm wondering about "samples." What exactly is this referring to?

The music playback (audio_delivery) callback has a num_frames variable, but then you have the issue of audio format (channels and/or sample_rate).

Is it correct to set "samples" to total amount of "num_frames" currently in my buffer? Or do I need to run some math based on total "num_samples", "channels", and "sample_rate"

mox1
  • 614
  • 3
  • 10

1 Answers1

2

It should be the number of frames in your output buffer. I.e. int samples is slightly misnamed and should probably be called int frames instead.

andoma
  • 176
  • 1
  • 3
  • After a bit of testing this appears to be correct. Also note that the "stutter" variable should be reset to 0 after each call. I was **NOT** doing that, and ended up with some weird behavior. Thanks andoma. – mox1 Sep 16 '13 at 21:48