Comments (10)
@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.
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.
I cant get it to work on debug either... no crash but no sound either
from cpal.
Also #154 doesn't seem to fix the no sound issue for me..
from cpal.
@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.
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.
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.
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.
@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.
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)
- [Question/Feature] Get channel names of a device for certain platforms
- `NoDevice` error on web
- Audio sampling data problem HOT 2
- ASIO4ALL.org looks... unsafe. HOT 3
- Using Asio4All results in StreamConfigNotSupported
- Adding visionOS support
- Min buffer size range detected on Android is huge (~1sec) HOT 1
- Extremely distorted audio on Windows with Razer 7.1 Surround Sound HOT 3
- record_wav example, question about using Option HOT 1
- example on how to record output device to wav HOT 2
- cannot use my audio input / output after using cpal (need to reboot computer)
- Android `failed to load dynamic library: dlopen failed: library "libc++shared.so" not found` HOT 5
- macOS asks for permission to use the microphone when accessing the default output device HOT 1
- Android won't adhere to fixed buffer size
- how can we financially support the maintenance of cpal?
- How to use multiple output devices in macOS?
- Loopback on Linux
- Is it possible to end the stream from the callback? HOT 5
- How to get mic/system audio volume levels (show 1 bar/2 bar/3 bar) ? HOT 1
- Debian/ALSA unable to init with PulseAudio disable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpal.