Is it possible to write write (); function without blocking without using threads?
short buffer[BUFFER_LEN];
int readcount;
while ((readcount = sounds[index].read(buffer, BUFFER_LEN)))
write(audio_device, buffer, readcount * sizeof(short));
Sounds are being played, but it blocks the program until it finishes playing.
source
share