I'm using libsoundio to play notification sounds. These notification sounds are played once every 10 minutes, so I keep the stream paused in between notifications. When a notification sound needs to be played, I un-pause the stream, stream the samples, and then pause the stream again.
This works fine with CoreAudio on macOS, but fails with ALSA on Ubuntu: when I un-pause a stream that's been paused for a long time, the first few seconds worth of samples are not streamed to output. So, I tend to miss the entire notification sound.
Anyone know what this is down to? It feels like ALSA is 'detaching' streams that have been inactive for a long time, and then takes a bit of time to reattach them when un-paused. This seems fine to me, as long as I can tell when exactly I can actually start streaming sound. Any suggestions for what to do? Maybe manage it myself by completely opening and closing the stream when it's not in use?
I'm using libsoundio to play notification sounds. These notification sounds are played once every 10 minutes, so I keep the stream paused in between notifications. When a notification sound needs to be played, I un-pause the stream, stream the samples, and then pause the stream again.
This works fine with CoreAudio on macOS, but fails with ALSA on Ubuntu: when I un-pause a stream that's been paused for a long time, the first few seconds worth of samples are not streamed to output. So, I tend to miss the entire notification sound.
Anyone know what this is down to? It feels like ALSA is 'detaching' streams that have been inactive for a long time, and then takes a bit of time to reattach them when un-paused. This seems fine to me, as long as I can tell when exactly I can actually start streaming sound. Any suggestions for what to do? Maybe manage it myself by completely opening and closing the stream when it's not in use?
Thanks, Bartholomew