https://github.com/mjkillough/sioctl-rs
Rust bindings around OpenBSD's sndio/sioctl_*.
https://github.com/mjkillough/sioctl-rs
audio openbsd rust sioctl sndio sound
Last synced: about 2 months ago
JSON representation
Rust bindings around OpenBSD's sndio/sioctl_*.
- Host: GitHub
- URL: https://github.com/mjkillough/sioctl-rs
- Owner: mjkillough
- License: mit
- Created: 2020-04-26T22:03:12.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-28T17:52:44.000Z (about 5 years ago)
- Last Synced: 2025-04-12T06:18:43.667Z (about 2 months ago)
- Topics: audio, openbsd, rust, sioctl, sndio, sound
- Language: Rust
- Size: 11.7 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.[`sndio`]: http://www.sndio.org/
[`sioctl_open(3)`]: https://man.openbsd.org/sioctl_open.3
[`Sioctl::new()`]: struct.Sioctl.html#method.new
[`Sioctl::controls()`]: struct.Sioctl.html#method.controls
[`Sioctl::watch()`]: struct.Sioctl.html#method.watch## Example
```rust
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`].
[`src/bin/sioctl.rs`]: https://github.com/mjkillough/sioctl-rs/blob/master/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