Skip to content

Commit cd561d9

Browse files
wmedranoBe-ing
andauthored
Dynamically load JACK. (RustAudio#162)
Makes it easier to compile, especially for Windows. Also updated tests to build more feature combinations. Co-authored-by: Be <[email protected]>
1 parent 981cdd1 commit cd561d9

22 files changed

+1006
-411
lines changed

.github/workflows/rust.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,34 @@ env:
1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15-
1615
steps:
1716
- name: Checkout
1817
uses: actions/checkout@v2
1918
- name: Install dependencies
2019
run: sudo apt update && sudo apt install jackd libjack0 libjack-dev
20+
21+
# This is required for the tests, but we start it earlier since it may
22+
# take a while to initialize.
2123
- name: Start dummy JACK server
2224
run: jackd -r -ddummy -r44100 -p1024 &
23-
- name: Lint
24-
run: cargo clippy --all-targets --all-features -- -D clippy::all
25-
- name: Build
26-
run: cargo build --verbose
25+
26+
- name: Lint (No Features)
27+
run: cargo clippy --all-targets --no-default-features -- -D clippy::all
28+
- name: Lint (All Features)
29+
run: cargo clippy --all-targets --no-default-features --features dlopen,metadata -- -D clippy::all
30+
- name: Lint (dlopen)
31+
run: cargo clippy --all-targets --no-default-features --features dlopen -- -D clippy::all
32+
- name: Lint (metadata)
33+
run: cargo clippy --all-targets --no-default-features --features metadata -- -D clippy::all
34+
35+
- name: Build (No Features)
36+
run: cargo build --verbose --no-default-features
37+
- name: Build (All Features)
38+
run: cargo build --verbose --no-default-features --features dlopen,metadata
39+
- name: Build (dlopen)
40+
run: cargo build --verbose --no-default-features --features dlopen
41+
- name: Build (metadata)
42+
run: cargo build --verbose --no-default-features --features metadata
43+
2744
- name: Run Tests
28-
run: RUST_TEST_THREADS=1 cargo test --verbose
45+
run: RUST_TEST_THREADS=1 cargo test --verbose --all-features

CHANGELOG

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Changelog
22

3-
## HEAD
4-
- Updated dependencies to latest as of 2021/11/17.
3+
## 0.9.0
4+
5+
- Jack library can be loaded dynamically from libjack.so.0 or libjack.dll.
6+
- Updated dependencies to latest as of 2022/02/05.
57

68
## 0.8.2
9+
710
- `MidiIter` is now `Sync`.
811

912
## 0.8.1
13+
1014
- `AsyncClient` and `Client` are `Sync`.
1115

1216
## 0.8.0

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT"
88
name = "jack"
99
readme = "README.md"
1010
repository = "https://github.com/RustAudio/rust-jack"
11-
version = "0.8.4"
11+
version = "0.9.0"
1212

1313
[dependencies]
1414
bitflags = "1"
@@ -22,5 +22,6 @@ log = "0.4"
2222
crossbeam-channel = "0.5"
2323

2424
[features]
25-
default = []
25+
default = ["dlopen"]
26+
dlopen = ["jack-sys/dlopen"]
2627
metadata = []

README.md

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,21 @@ Check out the `examples` directory for usage.
1616

1717
```toml
1818
[dependencies]
19-
jack = "0.8"
19+
jack = "0.9"
2020
```
2121

2222
### Windows
2323

2424
Install `JACK` from the [official website](http://jackaudio.org/downloads/).
25-
Link the installed library in your rust code. For example:
26-
27-
```rust
28-
#[cfg(target_os = "windows")]
29-
#[link(name = "C:/Program Files/JACK2/lib/libjack64")]
30-
extern "C" {}
31-
```
25+
libjack64.dll (or libjack.dll for 32bit) is required for Windows to work.
3226

3327
## Running
3428

35-
* `libjack` is required. Consult your package manager or the [official](http://jackaudio.org/downloads/) website.
29+
- `libjack` is required. Consult your package manager or the [official](http://jackaudio.org/downloads/) website.
3630

37-
* The general workflow for a JACK application is to start up a JACK daemon and connect the client to it. [qjackctl](http://qjackctl.sourceforge.net/) is a convinient way to configure and bring up a JACK server through a GUI.
31+
- The general workflow for a JACK application is to start up a JACK daemon and connect the client to it. [qjackctl](http://qjackctl.sourceforge.net/) is a convinient way to configure and bring up a JACK server through a GUI.
3832

39-
* [JACK FAQ](http://jackaudio.org/faq/)
33+
- [JACK FAQ](http://jackaudio.org/faq/)
4034

4135
## Testing
4236

@@ -59,29 +53,6 @@ If the tests are failing, a possible gotcha may be timing issues.
5953

6054
1. Increase the value used by `sleep_on_test` in `client/common.rs`.
6155

62-
Another case is that libjack may be broken on your setup. Try switching between
56+
Another case is that libjack may be broken on your setup. Try switching between
6357
libjack and libjack2 (they have the same API and libjack2 isn't necessarily
6458
newer than libjack), or using a different version.
65-
66-
## "C" & Rust API differences
67-
68-
* String lengths in the "C" API include the `NULL` character while these Rust
69-
bindings do not. generally `rust_size(x) = c_size(x) - 1`.
70-
* "C" bindings require functions to be registered while Rust bindings register
71-
an object with a trait.
72-
* `jack_on_shutdown` has been removed, uses only `jack_on_info_shutdown`.
73-
* Rust enums vs C enums
74-
* Rust bitflags vs C integers used as flags
75-
* deprecated JACK functions are not used/implemented in Rust bindings
76-
77-
## Completeness
78-
79-
For details on which functions from the JACK headers have been implemented, see `ffi_completeness.md`.
80-
81-
More high-level, creating clients, creating/reading/writing/connecting ports, audio, and midi are supported.
82-
83-
Missing categories include, JACK threading, synchronous processing, transport and control functionality.
84-
85-
## C JACK API
86-
87-
[API documentation](https://jackaudio.org/api/)

jack-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
66
links = "jack"
77
name = "jack-sys"
88
repository = "https://github.com/RustAudio/rust-jack/tree/main/jack-sys"
9-
version = "0.3.0"
9+
version = "0.3.3"
1010

1111
[dependencies]
1212
dlib = "0.5"

jack-sys/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
# jack-sys
1+
# jack-sys
22

33
[![crates.io](https://img.shields.io/crates/v/jack-sys.svg)](https://crates.io/crates/jack-sys)
44

55
Low-level bindings for the [JACK Audio Connection Kit](http://jackaudio.org/). Generated using [rust-bindgen](https://github.com/rust-lang/rust-bindgen).
66

77
Requires JACK to be installed on the system.
8+
9+
## C JACK API
10+
11+
[API documentation](https://jackaudio.org/api/)

jack-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ fn main() {
33
// Refer to https://github.com/RustAudio/rust-jack/issues/142 for details.
44
// Do not unwrap this because linking might still work if pkg-config is
55
// not installed, for example on Windows.
6+
#[cfg(not(feature = "dlopen"))]
67
let _ = pkg_config::probe_library("jack");
78
}

0 commit comments

Comments
 (0)