Giter Club home page Giter Club logo

soundio-rs's Introduction

soundio

Build Status Build status Crates.io Docs

This is a Rust wrapper for the amazing libsoundio library by Andrew Kelly. It is still a work in progress and the design is still in flux. Playback and recording do work though, and the raw bindings in libsoundio-sys are complete.

There is another Rust wrapper for libsoundio here.

This project is a fork of, and was originally created by Timmmm. The project now lives here, and is under active development again.

Changelog

0.2.1

  • Updated to latest version of libsoundio-sys.
  • Fixed hang with CoreAudio if creating context then immediately destroying it.
  • Fixed Rust 1.40 clippy warnings.

soundio-rs's People

Contributors

ramihg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

soundio-rs's Issues

Missing Examples

The docs list the following examples:
list_devices,recorder,player,sine

Tho there is no example code below the descriptions.

example failes to build, undefined reference

When trying to build the example from the docs, I receive countless "undefined reference to snd_pcm_sw_params, snd_pcm_close', snd_pcm_poll_descriptors' and many more.

/nix/store/zsvpmlddl2i5mpzm031a99xfpn410m5b-binutils-2.40/bin/ld: (.text+0x3d51): undefined reference to `snd_pcm_sw_params'
/nix/store/zsvpmlddl2i5mpzm031a99xfpn410m5b-binutils-2.40/bin/ld: (.text+0x3d7a): undefined reference to `snd_pcm_poll_descriptors_count'
/nix/store/zsvpmlddl2i5mpzm031a99xfpn410m5b-binutils-2.40/bin/ld: (.text+0x3dc3): undefined reference to `snd_pcm_poll_descriptors'
/nix/store/zsvpmlddl2i5mpzm031a99xfpn410m5b-binutils-2.40/bin/ld: 
/nix/store/zsvpmlddl2i5mpzm031a99xfpn410m5b-binutils-2.40/bin/ld: (.text+0x40a1): undefined reference to `snd_pcm_close'
/nix/store/zsvpmlddl2i5mpzm031a99xfpn410m5b-binutils-2.40/bin/ld: (.text+0x4152): undefined reference to `snd_pcm_close'

collect2: error: ld returned 1 exit status

  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

Note: I am using NixOS, which is why the paths look so weird and why i suppose the error occurs.

The missing symbols appear to belong to alsa-lib, which I've installed and also tried to add to the linker list with the -L flag without success.
The fix from #2 doesn't work for me.

What do I need to change for the project to compile properly?

Project doesn't build, linker error

I have a minimal project which fails to build when the call to ctx.connect() is added to the code. This is my src/main.rs:

extern crate soundio;

fn main() -> Result<(), String> {
    let mut ctx = soundio::Context::new();
    ctx.set_app_name("mytest");
    ctx.connect()?;  // builds when this line is removed
    Ok(())
}

And Cargo.toml:

[package]
name = "mytest"
version = "0.1.0"
authors = ["xrudelis"]

[dependencies]
soundio = "0.2.1"

The output of cargo build ends like this, after many similar errors:

/usr/bin/ld: /home/xrudelis/mytest/target/debug/deps/liblibsoundio_sys-28f43b51c120f186.rlib(alsa.c.o): in function `instream_pause_alsa':
/home/xrudelis/.cargo/registry/src/github.com-1ecc6299db9ec823/libsoundio-sys-0.3.0/libsoundio/src/alsa.c:1843: undefined reference to `snd_pcm_pause'
/usr/bin/ld: /home/xrudelis/mytest/target/debug/deps/liblibsoundio_sys-28f43b51c120f186.rlib(alsa.c.o): in function `instream_get_latency_alsa':
/home/xrudelis/.cargo/registry/src/github.com-1ecc6299db9ec823/libsoundio-sys-0.3.0/libsoundio/src/alsa.c:1858: undefined reference to `snd_pcm_delay'
collect2: error: ld returned 1 exit status

I've attached the full output here of running cargo build --verbose on this project. Tested with Rust 1.40.0 and also a newer nightly. I am not very familiar with the rust compiler / linker but I have verified that I can build C projects with libsoundio just fine on this machine.

cross build

I'm trying to cross build this library for raspberry pi, but I always end up with the dummy backend. I have a feeling I need to configure something in build.rs to indicate where the alsa library is located in the docker image used to build, but I'm not sure exactly what to add there. Do you have any examples of cross building with different backends?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.