Skip to content

Commit

Permalink
better arg name
Browse files Browse the repository at this point in the history
  • Loading branch information
abique committed Sep 21, 2024
1 parent 0e6f6dd commit 431a0aa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/host/alsa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ struct DeviceHandles {
impl DeviceHandles {
/// Create `DeviceHandles` for `name` and try to open a handle for both
/// directions. Returns `Ok` if either direction is opened successfully.
fn open(name: &str) -> Result<Self, alsa::Error> {
fn open(pcm_id: &str) -> Result<Self, alsa::Error> {
let mut handles = Self::default();
let playback_err = handles.try_open(name, alsa::Direction::Playback).err();
let capture_err = handles.try_open(name, alsa::Direction::Capture).err();
let playback_err = handles.try_open(pcm_id, alsa::Direction::Playback).err();
let capture_err = handles.try_open(pcm_id, alsa::Direction::Capture).err();
if let Some(err) = capture_err.and(playback_err) {
Err(err)
} else {
Expand All @@ -202,7 +202,7 @@ impl DeviceHandles {
/// `Option` is guaranteed to be `Some(..)`.
fn try_open(
&mut self,
name: &str,
pcm_id: &str,
stream_type: alsa::Direction,
) -> Result<&mut Option<alsa::PCM>, alsa::Error> {
let handle = match stream_type {
Expand All @@ -211,7 +211,7 @@ impl DeviceHandles {
};

if handle.is_none() {
*handle = Some(alsa::pcm::PCM::new(name, stream_type, true)?);
*handle = Some(alsa::pcm::PCM::new(pcm_id, stream_type, true)?);
}

Ok(handle)
Expand Down

0 comments on commit 431a0aa

Please sign in to comment.