mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
commit
5388565652
2 changed files with 10 additions and 5 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -564,7 +564,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portaudio"
|
name = "portaudio"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/mvdnes/portaudio-rs#0b228f54a16814c52ba1ef449ac439af59f8cab0"
|
source = "git+https://github.com/mvdnes/portaudio-rs#2e1630843551a229bfe6cae6291fd157349bad60"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -574,7 +574,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portaudio_sys"
|
name = "portaudio_sys"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "git+https://github.com/mvdnes/portaudio-rs#0b228f54a16814c52ba1ef449ac439af59f8cab0"
|
source = "git+https://github.com/mvdnes/portaudio-rs#2e1630843551a229bfe6cae6291fd157349bad60"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use super::{Open, Sink};
|
use super::{Open, Sink};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
use std::time::Duration;
|
||||||
use portaudio;
|
use portaudio;
|
||||||
use portaudio::device::{DeviceIndex, DeviceInfo, get_default_output_index};
|
use portaudio::device::{DeviceIndex, DeviceInfo, get_default_output_index};
|
||||||
|
|
||||||
|
@ -53,12 +54,16 @@ impl <'a> Open for PortAudioSink<'a> {
|
||||||
None => get_default_output_index(),
|
None => get_default_output_index(),
|
||||||
}.expect("Could not find device");
|
}.expect("Could not find device");
|
||||||
|
|
||||||
|
let info = portaudio::device::get_info(device_idx);
|
||||||
|
let latency = match info {
|
||||||
|
Some(info) => info.default_high_output_latency,
|
||||||
|
None => Duration::new(0, 0),
|
||||||
|
};
|
||||||
|
|
||||||
let params = StreamParameters {
|
let params = StreamParameters {
|
||||||
device: device_idx,
|
device: device_idx,
|
||||||
channel_count: 2,
|
channel_count: 2,
|
||||||
// Super hacky workaround the fact that Duration is private
|
suggested_latency: latency,
|
||||||
// in portaudio
|
|
||||||
suggested_latency: unsafe { ::std::mem::transmute(0i64) },
|
|
||||||
data: 0i16,
|
data: 0i16,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue