diff options
-rw-r--r-- | main.c | 15 | ||||
-rw-r--r-- | palsa.c | 2 |
2 files changed, 13 insertions, 4 deletions
@@ -330,9 +330,18 @@ player_thread (uintptr_t ctx) { while (messagepump_pop(&msg, &ctx, &p1, &p2) != -1) { switch (msg) { case M_REINIT_SOUND: - palsa_free (); - palsa_init (); - palsa_play (); + { + int play = 0; + if (!palsa_ispaused () && !palsa_isstopped ()) { + play = 1; + } + + palsa_free (); + palsa_init (); + if (play) { + palsa_play (); + } + } break; case M_TERMINATE: GDK_THREADS_ENTER(); @@ -308,7 +308,7 @@ palsa_thread (uintptr_t context) { /* wait till the interface is ready for data, or 1 second has elapsed. */ - if ((err = snd_pcm_wait (audio, 1000)) < 0) { + if ((err = snd_pcm_wait (audio, 1000)) < 0 && state == 1) { messagepump_push (M_REINIT_SOUND, 0, 0, 0); mutex_unlock (mutex); break; |