mirror of
https://github.com/talwat/lowfi
synced 2025-02-05 15:21:28 +00:00
fix: only run the hack on linux targets
This commit is contained in:
parent
c2baa53ded
commit
6b85a83749
@ -86,8 +86,8 @@ unsafe impl Send for Player {}
|
|||||||
unsafe impl Sync for Player {}
|
unsafe impl Sync for Player {}
|
||||||
|
|
||||||
impl Player {
|
impl Player {
|
||||||
/// This gets the output stream while also shutting up alsa.
|
/// This gets the output stream while also shutting up alsa with [libc].
|
||||||
fn get_output_stream() -> eyre::Result<(OutputStream, OutputStreamHandle)> {
|
fn silent_get_output_stream() -> eyre::Result<(OutputStream, OutputStreamHandle)> {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static stderr: *mut libc::FILE;
|
static stderr: *mut libc::FILE;
|
||||||
}
|
}
|
||||||
@ -110,7 +110,12 @@ impl Player {
|
|||||||
|
|
||||||
/// Initializes the entire player, including audio devices & sink.
|
/// Initializes the entire player, including audio devices & sink.
|
||||||
pub async fn new() -> eyre::Result<Self> {
|
pub async fn new() -> eyre::Result<Self> {
|
||||||
let (_stream, handle) = Self::get_output_stream()?;
|
let (_stream, handle) = if cfg!(target_os = "linux") {
|
||||||
|
Self::silent_get_output_stream()?
|
||||||
|
} else {
|
||||||
|
OutputStream::try_default()?
|
||||||
|
};
|
||||||
|
|
||||||
let sink = Sink::try_new(&handle)?;
|
let sink = Sink::try_new(&handle)?;
|
||||||
|
|
||||||
let player = Self {
|
let player = Self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user