upgrade jack dependency from v0.5 to v0.6

A bunch of stuff got moved around; means of constructing audio output port
changed.

I simply used the commits, mostly from [1], to their examples to figure
out how to address the errors that resulted from compiling after the
version bump. It compiles cleanly again now.

[1]: https://github.com/RustAudio/rust-jack/pull/89
This commit is contained in:
Lyndon Brown 2020-11-27 04:55:47 +00:00
parent 594de54bec
commit 3ba05845d2
3 changed files with 16 additions and 27 deletions

14
Cargo.lock generated
View file

@ -201,11 +201,6 @@ name = "bit-vec"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "0.9.1"
@ -1084,10 +1079,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "jack"
version = "0.5.7"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"jack-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1406,7 +1401,7 @@ dependencies = [
"glib 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
"gstreamer 0.16.5 (registry+https://github.com/rust-lang/crates.io-index)",
"gstreamer-app 0.16.5 (registry+https://github.com/rust-lang/crates.io-index)",
"jack 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
"jack 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)",
"libpulse-binding 2.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libpulse-simple-binding 2.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3299,7 +3294,6 @@ dependencies = [
"checksum bindgen 0.53.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5"
"checksum bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de"
"checksum bit-vec 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
@ -3397,7 +3391,7 @@ dependencies = [
"checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
"checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
"checksum jack 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1e15fc592e2e5a74a105ff507083c04db1aa20ba1b90d425362ba000e57422df"
"checksum jack 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7c1871c91fa65aa328f3bedbaa54a6e5d1de009264684c153eb708ba933aa6f5"
"checksum jack-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d4ca501477fd3cd93a36df581046e5d6338ed826cf7e9b8d302603521e6cc3"
"checksum jni 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1981310da491a4f0f815238097d0d43d8072732b5ae5f8bd0d8eadf5bf245402"
"checksum jni 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "36bcc950632e48b86da402c5c077590583da5ac0d480103611d5374e7c967a3c"

View file

@ -27,7 +27,7 @@ alsa = { version = "0.2", optional = true }
portaudio-rs = { version = "0.3", optional = true }
libpulse-binding = { version = "2.13", optional = true, default-features = false }
libpulse-simple-binding = { version = "2.13", optional = true, default-features = false }
jack = { version = "0.5", optional = true }
jack = { version = "0.6", optional = true }
libc = { version = "0.2", optional = true }
rodio = { version = "0.13", optional = true, default-features = false }
cpal = { version = "0.13", optional = true }

View file

@ -1,7 +1,6 @@
use super::{Open, Sink};
use jack::prelude::{
client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port,
ProcessHandler, ProcessScope,
use jack::{
AsyncClient, AudioOut, Client, ClientOptions, Control, Port, ProcessHandler, ProcessScope,
};
use std::io;
use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
@ -13,8 +12,8 @@ pub struct JackSink {
pub struct JackData {
rec: Receiver<i16>,
port_l: Port<AudioOutSpec>,
port_r: Port<AudioOutSpec>,
port_l: Port<AudioOut>,
port_r: Port<AudioOut>,
}
fn pcm_to_f32(sample: i16) -> f32 {
@ -22,10 +21,10 @@ fn pcm_to_f32(sample: i16) -> f32 {
}
impl ProcessHandler for JackData {
fn process(&mut self, _: &Client, ps: &ProcessScope) -> JackControl {
fn process(&mut self, _: &Client, ps: &ProcessScope) -> Control {
// get output port buffers
let mut out_r = AudioOutPort::new(&mut self.port_r, ps);
let mut out_l = AudioOutPort::new(&mut self.port_l, ps);
let mut out_r = self.port_r.as_mut_slice(ps);
let mut out_l = self.port_l.as_mut_slice(ps);
let buf_r: &mut [f32] = &mut out_r;
let buf_l: &mut [f32] = &mut out_l;
// get queue iterator
@ -36,7 +35,7 @@ impl ProcessHandler for JackData {
buf_r[i] = pcm_to_f32(queue_iter.next().unwrap_or(0));
buf_l[i] = pcm_to_f32(queue_iter.next().unwrap_or(0));
}
JackControl::Continue
Control::Continue
}
}
@ -46,13 +45,9 @@ impl Open for JackSink {
let client_name = client_name.unwrap_or("librespot".to_string());
let (client, _status) =
Client::new(&client_name[..], client_options::NO_START_SERVER).unwrap();
let ch_r = client
.register_port("out_0", AudioOutSpec::default())
.unwrap();
let ch_l = client
.register_port("out_1", AudioOutSpec::default())
.unwrap();
Client::new(&client_name[..], ClientOptions::NO_START_SERVER).unwrap();
let ch_r = client.register_port("out_0", AudioOut::default()).unwrap();
let ch_l = client.register_port("out_1", AudioOut::default()).unwrap();
// buffer for samples from librespot (~10ms)
let (tx, rx) = sync_channel(2 * 1024 * 4);
let jack_data = JackData {