Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPAL not outputting sound under Mac OS X x86_64. #148

Closed
SirVer opened this issue Feb 7, 2017 · 10 comments
Closed

CPAL not outputting sound under Mac OS X x86_64. #148

SirVer opened this issue Feb 7, 2017 · 10 comments
Labels

Comments

@SirVer
Copy link

SirVer commented Feb 7, 2017

This is the followup bug to RustAudio/rodio#94.
This is a MacBookPro Retina 15 Inch, Early 2013 with Intel Core i7 running OS X El Capitan.

CPAL does not crash, but the examples do not play a sound under my Mac OS X:

$ 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:        0x1084a102a - std::sys::imp::backtrace::tracing::imp::write::hd3b65cdfe843284c
   2:        0x1084a27cf - std::panicking::default_hook::{{closure}}::hf2b7428652613d83
   3:        0x1084a2477 - std::panicking::default_hook::h5da8f27db5582938
   4:        0x1084a2c96 - std::panicking::rust_panic_with_hook::hcef1e67c646c6802
   5:        0x1084a2b34 - std::panicking::begin_panic::hc2e8ca89533cd10d
   6:        0x1084a2a52 - std::panicking::begin_panic_fmt::h60990696c3c3a88d
   7:        0x1084a29b7 - rust_begin_unwind
   8:        0x1084c4c40 - core::panicking::panic_fmt::h10231c789bd0e97d
   9:        0x1084c4cad - core::option::expect_failed::h77d0b34eebcbdfc8
  10:        0x10849808e - beep::main::h7bcc7202bef6bbee
  11:        0x1084a382a - __rust_maybe_catch_panic
  12:        0x1084a2f06 - std::rt::lang_start::h87cb84a8b6cb187e

$ cargo run --release --example enumerate
   Compiling cpal v0.4.4 (file:///private/tmp/cpal)
    Finished release [optimized] target(s) in 0.83 secs
     Running `target/release/examples/enumerate`
Endpoints:
1. Endpoint "Default AudioUnit Endpoint" Audio formats:
1.1. Format { channels: [FrontLeft, FrontRight], samples_rate: SamplesRate(44100), data_type: F32 }
@shockham
Copy link
Contributor

@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.

@SirVer
Copy link
Author

SirVer commented Mar 19, 2017

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

@z3t0
Copy link

z3t0 commented Apr 12, 2017

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

@z3t0
Copy link

z3t0 commented Apr 12, 2017

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

@shockham
Copy link
Contributor

@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?

@mlindner
Copy link

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.

@mlindner
Copy link

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 }

@mlindner
Copy link

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.

@yupferris yupferris mentioned this issue Nov 6, 2017
@jansol
Copy link
Contributor

jansol commented Nov 6, 2017

@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.

@mitchmindtree
Copy link
Member

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants