mirror of
https://github.com/ivabus/speakersafetyd
synced 2024-11-22 00:05:06 +03:00
types: Do not prefix speaker name "Mono"
For single-speaker devices, there is no control prefix. So treat the special name "Mono" as a null prefix in that case. Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
83a53ba99f
commit
91e7c14b8e
1 changed files with 10 additions and 4 deletions
14
src/types.rs
14
src/types.rs
|
@ -79,8 +79,14 @@ struct Mixer {
|
|||
impl Mixer {
|
||||
// TODO: implement turning on V/ISENSE
|
||||
fn new(name: &str, card: &Ctl, globals: &Globals) -> Mixer {
|
||||
let prefix = if name == "Mono" {
|
||||
"".to_string()
|
||||
} else {
|
||||
name.to_owned() + " "
|
||||
};
|
||||
|
||||
let mut vs = Elem::new(
|
||||
name.to_owned() + " " + &globals.ctl_vsense,
|
||||
prefix.clone() + &globals.ctl_vsense,
|
||||
card,
|
||||
alsa::ctl::ElemType::Boolean,
|
||||
);
|
||||
|
@ -91,7 +97,7 @@ impl Mixer {
|
|||
assert!(vs.val.get_boolean(0).unwrap());
|
||||
|
||||
let mut is = Elem::new(
|
||||
name.to_owned() + " " + &globals.ctl_isense,
|
||||
prefix.clone() + &globals.ctl_isense,
|
||||
card,
|
||||
alsa::ctl::ElemType::Boolean,
|
||||
);
|
||||
|
@ -104,12 +110,12 @@ impl Mixer {
|
|||
Mixer {
|
||||
drv: name.to_owned(),
|
||||
level: Elem::new(
|
||||
name.to_owned() + " " + &globals.ctl_volume,
|
||||
prefix.clone() + &globals.ctl_volume,
|
||||
card,
|
||||
alsa::ctl::ElemType::Integer,
|
||||
),
|
||||
amp_gain: Elem::new(
|
||||
name.to_owned() + " " + &globals.ctl_amp_gain,
|
||||
prefix + &globals.ctl_amp_gain,
|
||||
card,
|
||||
alsa::ctl::ElemType::Integer,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue