GithubHelp home page GithubHelp logo

Comments (10)

shockham avatar shockham commented on September 27, 2024

@SirVer Do you get any sound with a debug build?

Had a look into this (on Mid 2012 15" mbp running yosemite) and appeared to be to do with the empty loop (presumably being optimized out in a release build?) at: https://github.com/tomaka/cpal/blob/master/src/coreaudio/mod.rs#L53

So if a statement is put inside it, like thread::sleep for example, it worked for me. Though that doesn't really feel like a clean fix.

from cpal.

SirVer avatar SirVer commented on September 27, 2024

Sorry for the late reply, life is busy right now. @shockham bingo, that is it.

cargo run --example beep
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/examples/beep`
<beeps roughly once per second>

cargo run --release --example beep
    Finished release [optimized] target(s) in 0.0 secs
     Running `target/release/examples/beep`
thread 'main' panicked at 'Failed to get default endpoint', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/option.rs:715
stack backtrace:
   1:        0x1049858ac - std::sys::imp::backtrace::tracing::imp::write::h21ca2762819c7ae8
   2:        0x10498706e - std::panicking::default_hook::{{closure}}::h38f99a37d00bb19b
   3:        0x104986d10 - std::panicking::default_hook::ha2186ee24b50729c
   4:        0x104987527 - std::panicking::rust_panic_with_hook::h979db19ee91d2a53
   5:        0x1049873d4 - std::panicking::begin_panic::h6a69f5b54391c64d
   6:        0x1049872f2 - std::panicking::begin_panic_fmt::h9de2343580b3c2c4
   7:        0x104987257 - rust_begin_unwind
   8:        0x1049a95a0 - core::panicking::panic_fmt::haa2997386017a96f
   9:        0x1049a962d - core::option::expect_failed::h6cd7e4444435a838
  10:        0x10497c958 - beep::main::h1e5c3d7705718ed0
  11:        0x1049880da - __rust_maybe_catch_panic
  12:        0x1049877a6 - std::rt::lang_start::hfc9882558f9403bf

from cpal.

z3t0 avatar z3t0 commented on September 27, 2024

I cant get it to work on debug either... no crash but no sound either

from cpal.

z3t0 avatar z3t0 commented on September 27, 2024

Also #154 doesn't seem to fix the no sound issue for me..

from cpal.

shockham avatar shockham commented on September 27, 2024

@z3t0 Sounds like that might be something different to the problem #154 fixed. Could you provide a little bit more information? does cargo run --release --example enumerate print something similar to the original post in the thread?

from cpal.

mlindner avatar mlindner commented on September 27, 2024

Also having this issue here trying to use rodio. I wasn't seeing this until I tried using an external library that used cpal. If I used cpal directly I didn't have the issue, presumably because I was always in debug mode.

from cpal.

mlindner avatar mlindner commented on September 27, 2024

Some additional info.
Running cargo run --example beep runs and produces sound but produces warnings.

   Compiling cpal v0.4.4 (file:///Users/mlindner/projects/cpal)
warning: unused `#[macro_use]` import, #[warn(unused_imports)] on by default
  --> src/lib.rs:73:1
   |
73 | #[macro_use]
   | ^^^^^^^^^^^^

warning: type alias is never used: `NumChannels`, #[warn(dead_code)] on by default
  --> src/coreaudio/mod.rs:87:1
   |
87 | type NumChannels = usize;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: type alias is never used: `NumFrames`, #[warn(dead_code)] on by default
  --> src/coreaudio/mod.rs:88:1
   |
88 | type NumFrames = usize;
   | ^^^^^^^^^^^^^^^^^^^^^^^

    Finished dev [unoptimized + debuginfo] target(s) in 1.47 secs
     Running `target/debug/examples/beep`

Running cargo run --release --example beep panics.

    Finished release [optimized] target(s) in 0.0 secs
     Running `target/release/examples/beep`
thread 'main' panicked at 'Failed to get default endpoint', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/option.rs:715
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Running your example cargo run --release --example enumerate prints the following.

Endpoints: 
1. Endpoint "Default AudioUnit Endpoint" Audio formats: 
1.1. Format { channels: [FrontLeft, FrontRight], samples_rate: SamplesRate(44100), data_type: F32 }

from cpal.

mlindner avatar mlindner commented on September 27, 2024

I tried @shockham's build and that seems to have fixed this issue but when trying to use rodio I get the same issue as @z3t0.

from cpal.

jansol avatar jansol commented on September 27, 2024

@mlindner Are you still having this issue? I tuned the beep example on macOS 10.13.1 (MacBookPro13,3) a couple of weeks ago and it worked perfectly.

from cpal.

mitchmindtree avatar mitchmindtree commented on September 27, 2024

Closing this as the original issue has been confirmed fixed in #196. If any commenters on this thread still have problems feel free to open up a new issue for your specific issue :)

from cpal.

Related Issues (20)

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.