Skip to content

Commit

Permalink
Upgrade bitflags to 1.0 (RustAudio#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmedrano authored Jan 27, 2018
1 parent 414bd22 commit 792d2b0
Show file tree
Hide file tree
Showing 23 changed files with 177 additions and 191 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jack"
version = "0.5.7"
version = "0.6.0rc1"
authors = ["Will S. Medrano <[email protected]>"]
description = "Real time audio and midi using safe JACK bindings."
documentation = "https://RustAudio.github.io/rust-jack/jack/index.html"
Expand All @@ -10,7 +10,7 @@ readme = "README.md"
keywords = ["jack", "realtime", "audio", "midi"]

[dependencies]
bitflags = "0.7.0"
bitflags = "1.0"
jack-sys = { path = "./jack-sys", version = "0.2" }
lazy_static = "1.0"
libc = "0.2"
2 changes: 1 addition & 1 deletion examples/playback_capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io;
fn main() {
// Create client
let (client, _status) =
jack::Client::new("rust_jack_simple", jack::client_options::NO_START_SERVER).unwrap();
jack::Client::new("rust_jack_simple", jack::ClientOptions::NO_START_SERVER).unwrap();

// Register ports. They will be used in a callback that will be
// called when new data is available.
Expand Down
2 changes: 1 addition & 1 deletion examples/show_midi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::io;
fn main() {
// open client
let (client, _status) =
jack::Client::new("rust_jack_show_midi", jack::client_options::NO_START_SERVER).unwrap();
jack::Client::new("rust_jack_show_midi", jack::ClientOptions::NO_START_SERVER).unwrap();

// process logic
let mut maker = client
Expand Down
2 changes: 1 addition & 1 deletion examples/sine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::sync::mpsc::channel;
fn main() {
// 1. open a client
let (client, _status) =
jack::Client::new("rust_jack_sine", jack::client_options::NO_START_SERVER).unwrap();
jack::Client::new("rust_jack_sine", jack::ClientOptions::NO_START_SERVER).unwrap();

// 2. register port
let mut out_port = client
Expand Down
7 changes: 3 additions & 4 deletions src/client/async_client.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use jack_sys as j;
use std::fmt;

use super::callbacks::{NotificationHandler, ProcessHandler};
use super::callbacks::{clear_callbacks, register_callbacks};
use Error;
use client::client::Client;
use client::common::{sleep_on_test, CREATE_OR_DESTROY_CLIENT_MUTEX};
use jack_enums::*;

pub use super::callbacks::{NotificationHandler, ProcessHandler};

/// A JACK client that is processing data asynchronously, in real-time.
///
Expand All @@ -18,7 +17,7 @@ pub use super::callbacks::{NotificationHandler, ProcessHandler};
/// ```
/// // Create a client and a handler
/// let (client, _status) =
/// jack::Client::new("my_client", jack::client_options::NO_START_SERVER).unwrap();
/// jack::Client::new("my_client", jack::ClientOptions::NO_START_SERVER).unwrap();
/// let process_handler = jack::ClosureProcessHandler::new(
/// move |_: &jack::Client, _: &jack::ProcessScope| jack::Control::Continue,
/// );
Expand Down
39 changes: 21 additions & 18 deletions src/client/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ use jack_sys as j;
use libc;
use std::{ffi, mem};

use client::ProcessScope;
use client::client::Client;
use client::client_status::ClientStatus;
use jack_enums::*;
use primitive_types as pt;
use Client;
use ClientStatus;
use Control;
use Error;
use Frames;
use LatencyType;
use PortId;
use ProcessScope;

/// Specifies callbacks for JACK.
pub trait NotificationHandler: Send {
Expand All @@ -32,26 +35,26 @@ pub trait NotificationHandler: Send {

/// Called whenever the size of the buffer that will be passed to `process`
/// is about to change.
fn buffer_size(&mut self, _: &Client, _size: pt::Frames) -> Control {
fn buffer_size(&mut self, _: &Client, _size: Frames) -> Control {
Control::Continue
}

/// Called whenever the system sample rate changes.
fn sample_rate(&mut self, _: &Client, _srate: pt::Frames) -> Control {
fn sample_rate(&mut self, _: &Client, _srate: Frames) -> Control {
Control::Continue
}

/// Called whenever a client is registered or unregistered
fn client_registration(&mut self, _: &Client, _name: &str, _is_registered: bool) {}

/// Called whenever a port is registered or unregistered
fn port_registration(&mut self, _: &Client, _port_id: pt::PortId, _is_registered: bool) {}
fn port_registration(&mut self, _: &Client, _port_id: PortId, _is_registered: bool) {}

/// Called whenever a port is renamed.
fn port_rename(
&mut self,
_: &Client,
_port_id: pt::PortId,
_port_id: PortId,
_old_name: &str,
_new_name: &str,
) -> Control {
Expand All @@ -62,8 +65,8 @@ pub trait NotificationHandler: Send {
fn ports_connected(
&mut self,
_: &Client,
_port_id_a: pt::PortId,
_port_id_b: pt::PortId,
_port_id_a: PortId,
_port_id_b: PortId,
_are_connected: bool,
) {
}
Expand Down Expand Up @@ -196,7 +199,7 @@ unsafe extern "C" fn shutdown<N, P>(
)
}

unsafe extern "C" fn process<N, P>(n_frames: pt::Frames, data: *mut libc::c_void) -> libc::c_int
unsafe extern "C" fn process<N, P>(n_frames: Frames, data: *mut libc::c_void) -> libc::c_int
where
N: NotificationHandler,
P: ProcessHandler,
Expand All @@ -219,7 +222,7 @@ where
obj.0.freewheel(&obj.2, is_starting)
}

unsafe extern "C" fn buffer_size<N, P>(n_frames: pt::Frames, data: *mut libc::c_void) -> libc::c_int
unsafe extern "C" fn buffer_size<N, P>(n_frames: Frames, data: *mut libc::c_void) -> libc::c_int
where
N: NotificationHandler,
P: ProcessHandler,
Expand All @@ -228,7 +231,7 @@ where
obj.0.buffer_size(&obj.2, n_frames).to_ffi()
}

unsafe extern "C" fn sample_rate<N, P>(n_frames: pt::Frames, data: *mut libc::c_void) -> libc::c_int
unsafe extern "C" fn sample_rate<N, P>(n_frames: Frames, data: *mut libc::c_void) -> libc::c_int
where
N: NotificationHandler,
P: ProcessHandler,
Expand All @@ -255,7 +258,7 @@ unsafe extern "C" fn client_registration<N, P>(
}

unsafe extern "C" fn port_registration<N, P>(
port_id: pt::PortId,
port_id: PortId,
register: libc::c_int,
data: *mut libc::c_void,
) where
Expand All @@ -272,7 +275,7 @@ unsafe extern "C" fn port_registration<N, P>(

#[allow(dead_code)] // TODO: remove once it can be registered
unsafe extern "C" fn port_rename<N, P>(
port_id: pt::PortId,
port_id: PortId,
old_name: *const libc::c_char,
new_name: *const libc::c_char,
data: *mut libc::c_void,
Expand All @@ -290,8 +293,8 @@ where
}

unsafe extern "C" fn port_connect<N, P>(
port_id_a: pt::PortId,
port_id_b: pt::PortId,
port_id_a: PortId,
port_id_b: PortId,
connect: libc::c_int,
data: *mut libc::c_void,
) where
Expand Down
Loading

0 comments on commit 792d2b0

Please sign in to comment.