Skip to content

Commit ec4e265

Browse files
committed
fix tests and typo
1 parent b5cff0e commit ec4e265

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

examples/play_connect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async fn main() -> Result<(), Error> {
5050
})?;
5151

5252
let session = Session::new(session_config, Some(cache));
53-
let mixer = mixer_builder(mixer_config);
53+
let mixer = mixer_builder(mixer_config)?;
5454

5555
let player = Player::new(
5656
player_config,

playback/src/mixer/alsamixer.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const SND_CTL_TLV_DB_GAIN_MUTE: MilliBel = MilliBel(-9999999);
3333
const ZERO_DB: MilliBel = MilliBel(0);
3434

3535
#[derive(Debug, Error)]
36-
enum AslaMixerError {
36+
enum AlsaMixerError {
3737
#[error("Could not open Alsa mixer. {0}")]
3838
CouldNotOpen(AlsaError),
3939
#[error("Could not find Alsa mixer control")]
@@ -48,8 +48,8 @@ enum AslaMixerError {
4848
CouldNotConvertRaw(AlsaError),
4949
}
5050

51-
impl From<AslaMixerError> for Error {
52-
fn from(value: AslaMixerError) -> Self {
51+
impl From<AlsaMixerError> for Error {
52+
fn from(value: AlsaMixerError) -> Self {
5353
Error::failed_precondition(value)
5454
}
5555
}
@@ -64,10 +64,10 @@ impl Mixer for AlsaMixer {
6464
let mut config = config; // clone
6565

6666
let mixer =
67-
alsa::mixer::Mixer::new(&config.device, false).map_err(AslaMixerError::CouldNotOpen)?;
67+
alsa::mixer::Mixer::new(&config.device, false).map_err(AlsaMixerError::CouldNotOpen)?;
6868
let simple_element = mixer
6969
.find_selem(&SelemId::new(&config.control, config.index))
70-
.ok_or(AslaMixerError::CouldNotFindController)?;
70+
.ok_or(AlsaMixerError::CouldNotFindController)?;
7171

7272
// Query capabilities
7373
let has_switch = simple_element.has_playback_switch();
@@ -83,16 +83,16 @@ impl Mixer for AlsaMixer {
8383
// API for hardware and software mixers
8484
let (min_millibel, max_millibel) = if is_softvol {
8585
let control =
86-
Ctl::new(&config.device, false).map_err(AslaMixerError::CouldNotOpenWithDevice)?;
86+
Ctl::new(&config.device, false).map_err(AlsaMixerError::CouldNotOpenWithDevice)?;
8787
let mut element_id = ElemId::new(ElemIface::Mixer);
8888
element_id.set_name(
8989
&CString::new(config.control.as_str())
90-
.map_err(AslaMixerError::CouldNotOpenWithName)?,
90+
.map_err(AlsaMixerError::CouldNotOpenWithName)?,
9191
);
9292
element_id.set_index(config.index);
9393
let (min_millibel, mut max_millibel) = control
9494
.get_db_range(&element_id)
95-
.map_err(AslaMixerError::NoDbRange)?;
95+
.map_err(AlsaMixerError::NoDbRange)?;
9696

9797
// Alsa can report incorrect maximum volumes due to rounding
9898
// errors. e.g. Alsa rounds [-60.0..0.0] in range [0..255] to
@@ -122,7 +122,7 @@ impl Mixer for AlsaMixer {
122122
debug!("Alsa mixer reported minimum dB as mute, trying workaround");
123123
min_millibel = simple_element
124124
.ask_playback_vol_db(min + 1)
125-
.map_err(AslaMixerError::CouldNotConvertRaw)?;
125+
.map_err(AlsaMixerError::CouldNotConvertRaw)?;
126126
}
127127
(min_millibel, max_millibel)
128128
};

0 commit comments

Comments
 (0)