#openbsd #sound #audio #sndio

bin+lib sioctl

An interface for reading the state of sndio controls

2 releases

0.0.2 May 28, 2020
0.0.1 May 2, 2020

#221 in Multimedia

Download history 3/week @ 2024-12-04 38/week @ 2024-12-11 1/week @ 2024-12-18 5/week @ 2025-01-15 14/week @ 2025-02-05 24/week @ 2025-02-12 4/week @ 2025-02-19 16/week @ 2025-02-26

58 downloads per month
Used in cnx-contrib

MIT license

19KB
234 lines

sioctl-rs

An interface for reading the state of sndio controls.

This crate provides a wrapper around the sioctl_open(3) APIs for reading and watching the state of sndio controls.

An inteface to the defautl sndio device can be opened by Sioctl::new(). The initial state of controls can be read by calling Sioctl::controls() and callbacks for subsequent changes can be requested via Sioctl::watch().

There is currently way to set the value of controls. If this would be useful to you, please feel free to submit a PR.

Example

use sioctl::Sioctl;

fn main() {
    let s = Sioctl::new();

    // Initial state of all controls.
    for control in s.controls() {
        println!("{:?}", control);
    }

    // Watch for changes to all controls:
    let mut watcher = s.watch(|control| println!("{:?}", control));

    // ...

    // When done, call join() to shutdown watching.
    watcher.join();
}

A more complete example is available in src/bin/sioctl.rs.

Installation

The sndio-sys crate requires libclang.so which is present in the llvm package:

doas pkg_add llvm

License

MIT

Dependencies

~1.6–3.5MB
~73K SLoC