summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c15
-rw-r--r--palsa.c2
2 files changed, 13 insertions, 4 deletions
diff --git a/main.c b/main.c
index 4aa9d88b..bde856ee 100644
--- a/main.c
+++ b/main.c
@@ -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();
diff --git a/palsa.c b/palsa.c
index 2fe0c374..8c68366a 100644
--- a/palsa.c
+++ b/palsa.c
@@ -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;