How do you specify a callback for rb->pcm_play_data()
?
Asked
Active
Viewed 895 times
21

Andreas Bonini
- 44,018
- 30
- 122
- 156

num1
- 4,825
- 4
- 31
- 49
1 Answers
8
The prototype for the callback function is as follows:
static void my_audio_callback(const void **start, size_t *size);
*start
should be set to point to the region of memory where your PCM data is stored (16-bit signed integers), and *size
should be the size of this region.
Once you've written your callback, call rb->pcm_play_data()
, and enjoy the music!
rb->pcm_play_data(my_audio_callback, NULL, NULL, 0);
A very late edit: The format of the auto is 16-bit signed integer PCM, with stereo interleave (even indexes: left channel, odd: right).

built1n
- 1,518
- 14
- 25