]> git.nihav.org Git - nihav-player.git/commitdiff
sndplay: add option to set volume from command line
authorKostya Shishkov <kostya.shiskov@gmail.com>
Fri, 3 Oct 2025 18:55:28 +0000 (20:55 +0200)
committerKostya Shishkov <kostya.shiskov@gmail.com>
Fri, 3 Oct 2025 18:55:28 +0000 (20:55 +0200)
sndplay/src/main.rs

index 4baf2ac3553cff18baf21e777d0334183489d1cc..78f8fcfe8cc19a0c5fb55935fa199d57d0a7af30 100644 (file)
@@ -553,6 +553,15 @@ fn main() {
                     println!("argument is required");
                 }
             },
+            "-vol" => {
+                if let Some(arg) = aiter.next() {
+                    if let Ok(vol) = arg.parse::<u8>() {
+                        player.volume = vol.min(200);
+                    } else {
+                        println!("wrong volume");
+                    }
+                }
+            },
             _ => {
                 player.play_file(arg, &cmd_receiver, start_time);
                 if player.ended {