Skip to content

Commit 76a59a1

Browse files
authored
Merge branch 'main' into dependabot/cargo/ndarray-0.17.1
2 parents 9ba6d57 + 4bbc884 commit 76a59a1

12 files changed

Lines changed: 60 additions & 26 deletions

File tree

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fmt:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v5
16+
- uses: actions/checkout@v6
1717
- name: Install dependencies (Linux)
1818
run: sudo apt install libasound2-dev libspa-0.2-dev libpipewire-0.3-dev
1919
- name: Install Rust 1.88
@@ -31,7 +31,7 @@ jobs:
3131
os: [windows, ubuntu, macos]
3232
runs-on: ${{ matrix.os }}-latest
3333
steps:
34-
- uses: actions/checkout@v5
34+
- uses: actions/checkout@v6
3535
- name: Install dependencies (Linux)
3636
if: ${{ matrix.os == 'ubuntu' }}
3737
run: sudo apt install libasound2-dev libspa-0.2-dev libpipewire-0.3-dev
@@ -61,7 +61,7 @@ jobs:
6161
feature-pipewire: true
6262
runs-on: ${{ matrix.os }}
6363
steps:
64-
- uses: actions/checkout@v5
64+
- uses: actions/checkout@v6
6565
- name: Install dependencies (Linux)
6666
if: ${{ matrix.os == 'ubuntu-latest' }}
6767
run: sudo apt install libasound2-dev libspa-0.2-dev libpipewire-0.3-dev

.github/workflows/build_nix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414
- uses: cachix/install-nix-action@v31
1515
- name: Building package
1616
run: nix build

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jobs:
1818
run: |
1919
sudo apt-get update
2020
sudo apt-get install -y libasound2-dev libspa-0.2-dev libpipewire-0.3-dev
21-
- uses: actions/cache@v4
21+
- uses: actions/cache@v5
2222
with:
2323
path: |
2424
~/.cargo/registry/index/
2525
~/.cargo/registry/cache/
2626
~/.cargo/git/db/
2727
target/
2828
key: ${{ matrix.name }}-${{ matrix.cross-target }}
29-
- uses: actions/checkout@v5
29+
- uses: actions/checkout@v6
3030
- name: Fetch all git history
3131
run: git fetch --force --prune --tags --unshallow
3232
- name: Set up Rust toolchain

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ license = "MIT"
99
bitflags = "2.10.0"
1010
duplicate = "2.0.1"
1111
fixed-resample = "0.9.2"
12-
log = { version = "0.4.28", features = ["kv"] }
12+
log = { version = "0.4.29", features = ["kv"] }
1313
ndarray = "0.17.1"
1414
oneshot = "0.1.11"
1515
rtrb = "0.3.2"
1616
thiserror = "2.0.17"
17-
zerocopy = { version = "0.8.27", optional = true }
17+
zerocopy = { version = "0.8.31", optional = true }
1818

1919
[dev-dependencies]
2020
anyhow = "1.0.100"
2121
env_logger = "0.11.8"
22-
indicatif = "0.18.2"
22+
indicatif = "0.18.3"
2323

2424
[build-dependencies]
2525
cfg_aliases = "0.2.1"
@@ -29,7 +29,7 @@ pipewire = ["dep:pipewire", "dep:libspa", "dep:libspa-sys", "dep:zerocopy"]
2929

3030
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd"))'.dependencies]
3131
alsa = "0.10.0"
32-
libc = "0.2.177"
32+
libc = "0.2.178"
3333
libspa = { version = "0.8.0", optional = true }
3434
libspa-sys = { version = "0.8.0", optional = true }
3535
nix = "0.30.1"

src/audio_buffer.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ where
351351
Some(Self { storage })
352352
}
353353

354+
/// Create an audio buffer reference from non-interleaved data. This does *not* copy the data,
355+
/// but creates a view over it, so that it can be accessed as any other audio buffer.
354356
pub fn from_noninterleaved(data: &'a [T], channels: usize) -> Option<Self> {
355357
let buffer_size = data.len() / channels;
356358
let storage = ArrayView2::from_shape((channels, buffer_size), data).ok()?;
@@ -373,6 +375,12 @@ impl<'a, T: 'a> AudioMut<'a, T> {
373375
Some(Self { storage })
374376
}
375377

378+
/// Create an audio buffer mutable reference from interleaved data. This does *not* copy the
379+
/// data, but creates a view over it, so that it can be accessed as any other audio buffer.
380+
///
381+
/// Writes to the resulting buffer directly map to the provided slice, and asking an
382+
/// interleaved view out of the resulting buffer (with [`AudioBufferBase::as_interleaved`])
383+
/// means the same slice is returned.
376384
pub fn from_noninterleaved_mut(data: &'a mut [T], channels: usize) -> Option<Self> {
377385
let buffer_size = data.len() / channels;
378386
let storage = ArrayViewMut2::from_shape((channels, buffer_size), data).ok()?;

src/backends/alsa/stream.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ impl<Callback: 'static + Send> AlsaStream<Callback> {
4949
let mut poll_descriptors = {
5050
let mut buf = vec![rx.as_pollfd()];
5151
let num_descriptors = device.pcm.count();
52-
buf.extend(
53-
std::iter::repeat(libc::pollfd {
52+
buf.extend(std::iter::repeat_n(
53+
libc::pollfd {
5454
fd: 0,
5555
events: 0,
5656
revents: 0,
57-
})
58-
.take(num_descriptors),
59-
);
57+
},
58+
num_descriptors,
59+
));
6060
buf
6161
};
6262
let (hwp, _, io) = device.apply_config(&stream_config)?;
@@ -70,7 +70,7 @@ impl<Callback: 'static + Send> AlsaStream<Callback> {
7070
let stream_config = StreamConfig {
7171
samplerate,
7272
channels: ChannelMap32::default()
73-
.with_indices(std::iter::repeat(1).take(num_channels)),
73+
.with_indices(std::iter::repeat_n(1, num_channels)),
7474
buffer_size_range: (Some(period_size), Some(period_size)),
7575
exclusive: false,
7676
};

src/backends/pipewire/device.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! PipeWire device abstraction.
2+
13
use super::stream::StreamHandle;
24
use crate::backends::pipewire::error::PipewireError;
35
use crate::{
@@ -12,15 +14,21 @@ use std::cell::{Cell, RefCell};
1214
use std::collections::HashMap;
1315
use std::rc::Rc;
1416

17+
/// A device (like a sound card) in PipeWire.
1518
pub struct PipewireDevice {
1619
pub(super) target_node: Option<u32>,
20+
/// Additive flags describing the device (input/output/...)
1721
pub device_type: DeviceType,
22+
/// Serial number of the device node in the PipeWire graph.
1823
pub object_serial: Option<String>,
24+
/// Name to be used for the next created stream.
1925
pub stream_name: Cow<'static, str>,
26+
/// Properties for the next created stream.
2027
pub stream_properties: HashMap<Vec<u8>, Vec<u8>>,
2128
}
2229

2330
impl PipewireDevice {
31+
/// Get PipeWire properties of the PipeWire device node.
2432
pub fn properties(&self) -> Result<Option<Properties>, PipewireError> {
2533
let Some(node_id) = self.target_node else {
2634
return Ok(None);

src/backends/pipewire/driver.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! PipeWire driver abstraction.
2+
13
use super::error::PipewireError;
24
use crate::backends::pipewire::device::PipewireDevice;
35
use crate::backends::pipewire::utils;
@@ -6,6 +8,7 @@ use std::borrow::Cow;
68
use std::collections::HashMap;
79
use std::marker::PhantomData;
810

11+
/// The Interflow PipeWire backend driver.
912
pub struct PipewireDriver {
1013
__init: PhantomData<()>,
1114
}

src/backends/pipewire/error.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
//! PipeWire errors.
2+
13
use thiserror::Error;
24

5+
/// PipeWire error.
36
#[derive(Debug, Error)]
47
pub enum PipewireError {
8+
/// Error originating in the PipeWire backend.
59
#[error("Pipewire error: {0}")]
610
BackendError(#[from] pipewire::Error),
11+
/// Error creating a pipewire stream (SPA pod serialization problem).
712
#[error("Cannot create Pipewire stream: {0}")]
813
GenError(#[from] libspa::pod::serialize::GenError),
914
}

0 commit comments

Comments
 (0)