Skip to content

Commit dda8575

Browse files
committed
0.3: fix import problems that broke stable
1 parent ce4e4a4 commit dda8575

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sqa-jack"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
description = "JACK bindings for Rust (part of the SQA project)"
55
documentation = "https://docs.rs/sqa-jack"
66
repository = "https://github.com/eeeeeta/sqa-jack"

src/handler.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
use *;
1+
use super::{JackNFrames, JackPort, JackStatus, JackConnection, Deactivated};
2+
use jack_sys::*;
23
use std::panic::{AssertUnwindSafe, catch_unwind};
4+
use std::ffi::CStr;
5+
use libc;
6+
use errors::*;
37

48
/// Context for some callbacks.
59
pub struct JackCallbackContext {
6-
nframes: jack_nframes_t
10+
nframes: JackNFrames
711
}
812

913
impl JackCallbackContext {
@@ -61,13 +65,13 @@ pub trait JackHandler: Send {
6165
/// This is called whenever the size of the the buffer that will be passed to the
6266
/// `process()` function is about to change.
6367
/// Clients that depend on knowing the buffer size must implement this callback.
64-
fn buffer_size(&mut self, _new_size: jack_nframes_t) -> JackControl { JackControl::Continue }
68+
fn buffer_size(&mut self, _new_size: JackNFrames) -> JackControl { JackControl::Continue }
6569
/// Called whenever the system sample rate changes.
6670
///
6771
/// Given that the JACK API exposes no way to change the sample rate, the library author
6872
/// would like you to know that this is a decidedly rare occurence. Still, it's worth
6973
/// being prepared ;)
70-
fn sample_rate(&mut self, _new_rate: jack_nframes_t) -> JackControl { JackControl::Continue }
74+
fn sample_rate(&mut self, _new_rate: JackNFrames) -> JackControl { JackControl::Continue }
7175
/// Called just once after the creation of the thread in which all other callbacks are
7276
/// handled.
7377
fn thread_init(&mut self) { }
@@ -104,13 +108,13 @@ impl<F> JackHandler for F where F: FnMut(&JackCallbackContext) -> JackControl +
104108
self(ctx)
105109
}
106110
}
107-
unsafe extern "C" fn buffer_size_callback<T>(frames: jack_nframes_t, user: *mut libc::c_void) -> libc::c_int where T: JackHandler {
111+
unsafe extern "C" fn buffer_size_callback<T>(frames: JackNFrames, user: *mut libc::c_void) -> libc::c_int where T: JackHandler {
108112
let callbacks = &mut *(user as *mut T);
109113
catch_unwind(AssertUnwindSafe(|| {
110114
callbacks.buffer_size(frames) as _
111115
})).unwrap_or(-1)
112116
}
113-
unsafe extern "C" fn sample_rate_callback<T>(frames: jack_nframes_t, user: *mut libc::c_void) -> libc::c_int where T: JackHandler {
117+
unsafe extern "C" fn sample_rate_callback<T>(frames: JackNFrames, user: *mut libc::c_void) -> libc::c_int where T: JackHandler {
114118
let callbacks = &mut *(user as *mut T);
115119
catch_unwind(AssertUnwindSafe(|| {
116120
callbacks.sample_rate(frames) as _
@@ -139,7 +143,7 @@ unsafe extern "C" fn thread_init_callback<T>(user: *mut libc::c_void) where T: J
139143
callbacks.thread_init()
140144
}));
141145
}
142-
unsafe extern "C" fn process_callback<T>(nframes: jack_nframes_t, user: *mut libc::c_void) -> libc::c_int where T: JackHandler {
146+
unsafe extern "C" fn process_callback<T>(nframes: JackNFrames, user: *mut libc::c_void) -> libc::c_int where T: JackHandler {
143147
let callbacks = &mut *(user as *mut T);
144148
let ctx = JackCallbackContext {
145149
nframes: nframes

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ pub mod port;
1313
#[cfg(test)]
1414
mod tests;
1515

16-
use jack_sys::*;
1716
use std::ffi::{CString, CStr};
1817
use std::marker::PhantomData;
19-
use std::borrow::Cow;
2018
use errors::{ErrorKind, ChainErr};
2119
pub use errors::JackResult;
2220
pub use handler::{JackCallbackContext, JackControl, JackHandler};
2321
pub use port::JackPort;
24-
pub use jack_sys::{jack_nframes_t, jack_port_t};
22+
pub use jack_sys::*;
23+
24+
pub type JackNFrames = jack_nframes_t;
25+
pub type JackPortPtr = *mut jack_port_t;
2526
bitflags! {
2627
/// Status of an operation.
2728
///

src/port.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
use *;
2-
1+
use libc;
2+
use errors::{ErrorKind, JackResult};
3+
use super::{JackPortFlags, JackPortPtr, str_to_cstr};
4+
use std::borrow::Cow;
5+
use std::ffi::CStr;
6+
use jack_sys::{jack_port_set_name, jack_port_type, jack_port_flags,
7+
jack_port_short_name, jack_port_name};
38
/// An object used for moving data of any type in or out of the client.
49
///
510
/// Ports may be connected in various ways.
@@ -10,15 +15,15 @@ use *;
1015
/// registration to fail and return `ProgrammerError`.
1116
#[derive(Copy, Clone, Debug)]
1217
pub struct JackPort {
13-
ptr: *mut jack_port_t,
18+
ptr: JackPortPtr,
1419
}
1520
unsafe impl Send for JackPort {}
1621

1722
impl JackPort {
18-
pub fn as_ptr(&self) -> *mut jack_port_t {
23+
pub fn as_ptr(&self) -> JackPortPtr {
1924
self.ptr
2025
}
21-
pub unsafe fn from_ptr(ptr: *mut jack_port_t) -> Self {
26+
pub unsafe fn from_ptr(ptr: JackPortPtr) -> Self {
2227
JackPort {
2328
ptr: ptr
2429
}

0 commit comments

Comments
 (0)