pause playback when prompt is active
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 17 Oct 2020 08:08:26 +0000 (10:08 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 17 Oct 2020 08:08:26 +0000 (10:08 +0200)
sndplay/src/main.rs

index 377c2d1b11bb7b134f3a1b9e1bd5ad287a61d175..990507d963cd452e48f1c3e787e19c4725923f73 100644 (file)
@@ -466,8 +466,18 @@ impl Player {
                     Command::Debug => {
                         self.debug = !self.debug;
                     },
-                    Command::PauseDisplay  => { no_display = true; },
-                    Command::ResumeDisplay => { no_display = false; },
+                    Command::PauseDisplay  => {
+                        no_display = true;
+                        if !self.paused {
+                            device.pause();
+                        }
+                    },
+                    Command::ResumeDisplay => {
+                        no_display = false;
+                        if !self.paused {
+                            device.resume();
+                        }
+                    },
                 };
                 if !no_display {
                     print!("\r{:60}\r", ' ');