libxmp / xmp-cli

Command-line mod player using libxmp
GNU General Public License v2.0
76 stars 22 forks source link

alsa: use snd_pcm_pause() on pause/resume. #12

Closed Artefact2 closed 3 years ago

Artefact2 commented 7 years ago

This might be a bug in alsa-jack, but when pausing in xmp-cli it just plays back the same buffer again and again (demo). Using snd_pcm_pause() fixes the issue.

sezero commented 3 years ago

Is this still a problem? If it is, I suggest something like the following instead: (because snd_pcm_pause() may not be supported on all hardware.)

diff --git a/src/sound_alsa.c b/src/sound_alsa.c
index 4defb06..3ab0dd3 100644
--- a/src/sound_alsa.c
+++ b/src/sound_alsa.c
@@ -103,10 +103,13 @@ static void flush(void)

 static void onpause(void)
 {
+       snd_pcm_drop(pcm_handle);
 }

 static void onresume(void)
 {
+       snd_pcm_prepare(pcm_handle);
+       snd_pcm_start(pcm_handle);
 }

 static const char *const help[] = {

Not tested.

Artefact2 commented 3 years ago

I can't reproduce the issue as of 275aaa9f. The issue has been moot for me a long time though, since I wrote xmpjack to communicate with JACK directly.