Skip to content

Commit cc49e0f

Browse files
committed
feat(alsa): enumerate up to 64 channels (AES10 maximum)
1 parent f9cd814 commit cc49e0f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8888
- **ALSA**: Streams no longer start automatically on creation; call `play()` manually.
8989
- **ALSA**: The `realtime` feature now skips RT promotion for ineligible PCM types (null,
9090
I/O plugins, wrapper types); `audio_thread_priority` promoted unconditionally.
91+
- **ALSA**: Supported configurations are now enumerated up to 64 channels (AES10 maximum).
9192
- **ASIO**: `Device::driver`, `asio_streams`, and `current_callback_flag` are no longer `pub`.
9293
- **ASIO**: Timestamps now include driver-reported hardware latency.
9394
- **ASIO**: Hardware latency is now re-queried when the driver reports `kAsioLatenciesChanged`.

src/host/alsa/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,11 @@ impl Device {
516516
};
517517

518518
let min_channels = hw_params.get_channels_min()?;
519-
let max_channels = hw_params.get_channels_max()?.min(32); // TODO: cap at 32 or too many configs
519+
// 64 = AES10 (MADI) maximum; also prevents spinning on plugins like plughw that report u32::MAX.
520+
const CHANNEL_ENUM_CAP: u32 = 64;
521+
let max_channels = hw_params
522+
.get_channels_max()?
523+
.min(min_channels.max(CHANNEL_ENUM_CAP));
520524

521525
let mut output = Vec::new();
522526
let mut seen_formats: Vec<SampleFormat> = Vec::new();
@@ -1685,7 +1689,8 @@ impl From<alsa::Error> for Error {
16851689
libc::ENODEV | libc::ENOENT | LIBC_ENOTSUPP => ErrorKind::DeviceNotAvailable.into(),
16861690
libc::EPERM | libc::EACCES => ErrorKind::PermissionDenied.into(),
16871691
libc::EBUSY | libc::EAGAIN => ErrorKind::DeviceBusy.into(),
1688-
libc::EINVAL | libc::ENOSYS => ErrorKind::UnsupportedConfig.into(),
1692+
libc::EINVAL => ErrorKind::UnsupportedConfig.into(),
1693+
libc::ENOSYS => ErrorKind::UnsupportedOperation.into(),
16891694
libc::EPIPE => ErrorKind::Xrun.into(),
16901695
_ => Error::with_message(ErrorKind::BackendError, err.to_string()),
16911696
}

0 commit comments

Comments
 (0)