From a26c2acc49a03b544d54a088b660618b5de9a64c Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Tue, 26 Dec 2017 14:02:25 +0200 Subject: Updated GTK version and fixed linting issues from Clippy --- Cargo.lock | 225 +++++++++++++++++++++++++------------------------- Cargo.toml | 4 +- benches/transforms.rs | 6 +- src/audio.rs | 9 +- src/gui.rs | 72 ++++++++-------- src/transforms.rs | 8 +- 6 files changed, 162 insertions(+), 162 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b55058d..38b27e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,11 +1,11 @@ [[package]] name = "atk-sys" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -15,11 +15,6 @@ name = "bencher" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "bitflags" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "bitflags" version = "0.7.0" @@ -27,7 +22,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bitflags" -version = "0.8.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -37,19 +32,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cairo-rs" -version = "0.1.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cairo-sys-rs" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -59,156 +55,158 @@ dependencies = [ [[package]] name = "gdk" -version = "0.5.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-pixbuf" -version = "0.1.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-pixbuf-sys" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-sys" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio" -version = "0.1.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio-sys" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glib" -version = "0.1.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glib-sys" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gobject-sys" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gtk" -version = "0.1.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gtk-sys" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "atk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "atk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -256,23 +254,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pango" -version = "0.1.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pango-sys" -version = "0.3.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -298,8 +298,8 @@ name = "rusty_microphone" version = "0.1.0" dependencies = [ "bencher 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "portaudio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -309,33 +309,32 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum atk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7a9635b2b56a4925bf9c9b14cb7cad91eb2c3ca1eb04671a525b9e729b5c0a2" +"checksum atk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33a67fd81e1922dddc335887516f2f5254534e89c9d39fa89bca5d79bd150d34" "checksum bencher 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1668b311500dd3b240933ee5ca5a80505e8378a4fa0a6457f629760e97d6c992" -"checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23" "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" -"checksum bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1370e9fc2a6ae53aea8b7a5110edbd08836ed87c88736dfabccade1c2b44bff4" +"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" "checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13" -"checksum cairo-rs 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0180a8b65dc13e78479c6a47c4d5f094d64dc34465a9433c6daef9ae2fbfb3ee" -"checksum cairo-sys-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2414b86c20c40dfb56a98b1dbca05bde56411f488d268c4289a86df1b648c61" -"checksum gdk 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f5cc612be763b8a63cee5fb8d444d9869a8690f12c199535329bcba716de5e5" -"checksum gdk-pixbuf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65506bc318d83947c3ee458cec22c35377a941770e0b762e35fbb491e91d012f" -"checksum gdk-pixbuf-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3c977528255ba4f1dfaecfb697c630996c4f5a6a3b1fbc08ff7bdeb3f754c3" -"checksum gdk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c11dcde28f6ddf0bc6a93cec5205aafb034c318d99147a9668d455d66e5ba749" -"checksum gio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1b5f3ca1ee702ff9f5fea73ebb33ad8d007f2e77b8179d90689c919ef328da32" -"checksum gio-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "963cf38f6575843b98fe7d39d426c4c0025b6f965a9a8b8c0165aface866400a" -"checksum glib 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "81f514a8abd315ede0e94e39ce5987fdb99191c5f812e5066bc5bdb965104fc4" -"checksum glib-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8826cbc94631507bdd91ee40f7e099bfaa3cc4f43c086b4d1c15cff5b4e8220b" -"checksum gobject-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "87373f64e136e9ea192ff5d3ef676a51e9ac6ab06b629223a081e0523c5f04e2" -"checksum gtk 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78d69fb7425fd6efba3b0c99f952b130fa4a0fdfdffbceb2b40ba018b2ed6a77" -"checksum gtk-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9391d0b50af734dbd54582d1836d0346d8daf6dc5e7f272afea96f4dcaf50b74" +"checksum cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6b5695f59fd036fe5741bc5a4eb20c78fbe42256e3b08a2af26bbcbe8070bf3" +"checksum cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c6e18fecaeac51809db57f45f4553cc0975225a7eb435a7a7e91e5e8113a84d" +"checksum gdk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e51db95be6565011bcd5cd99f9b17fdd585001057a999b21e09f1e8c28deb9" +"checksum gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16160d212ae91abe9f3324c3fb233929ba322dde63585d15cda3336f8c529ed1" +"checksum gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "798f97101eea8180da363d0e80e07ec7ec6d1809306601c0100c1de5bc8b4f52" +"checksum gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4ee916f5f25c5f4b21bd9dcb12a216ae697406940ff9476358c308a8ececada" +"checksum gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84ba5a2beb559059a0c9c2bd3681743cdede8d9a36c775840bca800333b22867" +"checksum gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a303bbf7a5e75ab3b627117ff10e495d1b9e97e1d68966285ac2b1f6270091bc" +"checksum glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "450247060df7d52fdad31e1d66f30d967e925c9d1d26a0ae050cfe33dcd00d08" +"checksum glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9693049613ff52b93013cc3d2590366d8e530366d288438724b73f6c7dc4be8" +"checksum gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60d507c87a71b1143c66ed21a969be9b99a76df234b342d733e787e6c9c7d7c2" +"checksum gtk 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0847c507e52c1feaede13ef56fb4847742438602655449d5f1f782e8633f146f" +"checksum gtk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "905fcfbaaad1b44ec0b4bba9e4d527d728284c62bc2ba41fccedace2b096766f" "checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" "checksum libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "2370ca07ec338939e356443dac2296f581453c35fe1e3a3ed06023c49435f915" "checksum num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "a311b77ebdc5dd4cf6449d81e4135d9f0e3b153839ac90e648a8ef538f923525" "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba" "checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01" "checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" -"checksum pango 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4215233226ff03c9a3ed7c85cbc3c58257203723e3a93d5a20ce3560f66261b7" -"checksum pango-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e401ee469540e60a80d1df63dcea4e9c201115e79344b77529fa3705ea8eadcd" +"checksum pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e81c404ab81ea7ea2fc2431a0a7672507b80e4b8bf4b41eac3fc83cc665104e" +"checksum pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34f34a1be107fe16abb2744e0e206bee4b3b07460b5fddd3009a6aaf60bd69ab" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" "checksum portaudio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d289315f6155a7608b6d8757786c79ed2243afeab8a5eda8989effda3fdc5c3" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/Cargo.toml b/Cargo.toml index 95dee5f..f448215 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,8 @@ bencher = "0.1.2" [target.'cfg(not(target_os = "emscripten"))'.dependencies] portaudio = "0.7.0" -gtk = "0.1.1" -cairo-rs = "0.1.1" +gtk = "0.3.0" +cairo-rs = "0.3.0" [[bench]] name = "transforms" diff --git a/benches/transforms.rs b/benches/transforms.rs index a6be9fd..8771492 100644 --- a/benches/transforms.rs +++ b/benches/transforms.rs @@ -8,7 +8,7 @@ use bencher::Bencher; use std::f32::consts::PI; const SAMPLE_RATE: f32 = 44100.0; -const FRAMES: usize = 1024; +const FRAMES: u16 = 512; fn sin_arg(f: f32, t: f32, phase: f32) -> f32 { @@ -18,13 +18,13 @@ fn sin_arg(f: f32, t: f32, phase: f32) -> f32 { fn sample_sinusoud(amplitude: f32, frequency: f32, phase: f32) -> Vec { (0..FRAMES) .map(|x| { - let t = x as f32 / SAMPLE_RATE; + let t = f32::from(x) / SAMPLE_RATE; sin_arg(frequency, t, phase).sin() * amplitude }).collect() } fn bench_correlation_on_sine_wave(b: &mut Bencher) { - let frequency = 440.0 as f32; //concert A + let frequency = 440.0f32; //concert A let samples = sample_sinusoud(1.0, frequency, 0.0); b.iter(|| { diff --git a/src/audio.rs b/src/audio.rs index e3100ae..01273d7 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -3,7 +3,10 @@ use portaudio as pa; use std::sync::mpsc::*; pub const SAMPLE_RATE: f32 = 44100.0; -pub const FRAMES: usize = 512; +// I want to use the frames constant in contexts where I need to cast +// it to f32 (eg for generating a sine wave). Therefore its type must +// be convertable to f32 losslessly. Hence the type of u16. +pub const FRAMES: u16 = 512; pub fn init() -> Result { pa::PortAudio::new() @@ -43,10 +46,10 @@ pub fn start_listening(pa: &pa::PortAudio, device_index: u32, let input_params = pa::StreamParameters::::new(pa::DeviceIndex(device_index), 1, true, latency); // Check that the stream format is supported. - try!(pa.is_input_format_supported(input_params, SAMPLE_RATE as f64)); + try!(pa.is_input_format_supported(input_params, f64::from(SAMPLE_RATE))); // Construct the settings with which we'll open our stream. - let stream_settings = pa::InputStreamSettings::new(input_params, SAMPLE_RATE as f64, FRAMES as u32); + let stream_settings = pa::InputStreamSettings::new(input_params, f64::from(SAMPLE_RATE), u32::from(FRAMES)); // This callback A callback to pass to the non-blocking stream. let callback = move |pa::InputStreamCallbackArgs { buffer, .. }| { diff --git a/src/gui.rs b/src/gui.rs index f0d998e..10f788d 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -11,6 +11,7 @@ use std::thread; use std::sync::mpsc::*; use model::Model; +use audio::SAMPLE_RATE; const FPS: u32 = 60; @@ -47,15 +48,15 @@ pub fn start_gui() -> Result<(), String> { let (mic_sender, mic_receiver) = channel(); - connect_dropdown_choose_microphone(mic_sender, state.clone()); + connect_dropdown_choose_microphone(mic_sender, Rc::clone(&state)); - start_processing_audio(mic_receiver, cross_thread_state.clone()); - setup_pitch_label_callbacks(state.clone(), cross_thread_state.clone()); - setup_pitch_error_indicator_callbacks(state.clone(), cross_thread_state.clone()); - setup_oscilloscope_drawing_area_callbacks(state.clone(), cross_thread_state.clone()); - setup_correlation_drawing_area_callbacks(state.clone(), cross_thread_state.clone()); + start_processing_audio(mic_receiver, Arc::clone(&cross_thread_state)); + setup_pitch_label_callbacks(Rc::clone(&state), Arc::clone(&cross_thread_state)); + setup_pitch_error_indicator_callbacks(&state, Arc::clone(&cross_thread_state)); + setup_oscilloscope_drawing_area_callbacks(&state, Arc::clone(&cross_thread_state)); + setup_correlation_drawing_area_callbacks(&state, Arc::clone(&cross_thread_state)); - setup_chart_visibility_callbacks(state.clone()); + setup_chart_visibility_callbacks(Rc::clone(&state)); gtk::main(); Ok(()) @@ -127,13 +128,13 @@ fn set_dropdown_items(dropdown: >k::ComboBoxText, microphones: Vec<(u32, Strin fn connect_dropdown_choose_microphone(mic_sender: Sender>, state: Rc>) { let dropdown = state.borrow().ui.dropdown.clone(); - start_listening_current_dropdown_value(&dropdown, mic_sender.clone(), state.clone()); + start_listening_current_dropdown_value(&dropdown, mic_sender.clone(), &state); dropdown.connect_changed(move |dropdown: >k::ComboBoxText| { - start_listening_current_dropdown_value(dropdown, mic_sender.clone(), state.clone()) + start_listening_current_dropdown_value(dropdown, mic_sender.clone(), &state) }); } -fn start_listening_current_dropdown_value(dropdown: >k::ComboBoxText, mic_sender: Sender>, state: Rc>) { +fn start_listening_current_dropdown_value(dropdown: >k::ComboBoxText, mic_sender: Sender>, state: &Rc>) { if let Some(ref mut stream) = state.borrow_mut().pa_stream { stream.stop().ok(); } @@ -154,7 +155,7 @@ fn start_processing_audio(mic_receiver: Receiver>, cross_thread_state: //just in case we hit performance difficulties, clear out the channel while mic_receiver.try_recv().ok() != None {} - let new_model = Model::from_signal(&samples, ::audio::SAMPLE_RATE); + let new_model = Model::from_signal(&samples, SAMPLE_RATE); match cross_thread_state.write() { Ok(mut model) => { @@ -183,19 +184,18 @@ fn setup_pitch_label_callbacks(state: Rc>, cross_threa }); } -fn setup_pitch_error_indicator_callbacks(state: Rc>, cross_thread_state: Arc>) { - let outer_state = state.clone(); - let canvas = &outer_state.borrow().ui.pitch_error_indicator; +fn setup_pitch_error_indicator_callbacks(state: &Rc>, cross_thread_state: Arc>) { + let canvas = &state.borrow().ui.pitch_error_indicator; canvas.connect_draw(move |canvas, context| { - let width = canvas.get_allocated_width() as f64; + let width = f64::from(canvas.get_allocated_width()); let midpoint = width / 2.0; let line_indicator_height = 20.0; - let color_indicator_height = canvas.get_allocated_height() as f64 - line_indicator_height; + let color_indicator_height = f64::from(canvas.get_allocated_height()) - line_indicator_height; match cross_thread_state.read().map(|state| state.error) { Ok(Some(error)) => { - let error_line_x = midpoint + error as f64 * midpoint / 50.0; + let error_line_x = midpoint + f64::from(error) * midpoint / 50.0; context.new_path(); context.move_to(error_line_x, 0.0); context.line_to(error_line_x, line_indicator_height); @@ -203,12 +203,12 @@ fn setup_pitch_error_indicator_callbacks(state: Rc>, c //flat on the left - context.set_source_rgb(0.0, 0.0, if error < 0.0 {-error as f64/50.0} else {0.0}); + context.set_source_rgb(0.0, 0.0, if error < 0.0 {-f64::from(error)/50.0} else {0.0}); context.rectangle(0.0, line_indicator_height, midpoint, color_indicator_height+line_indicator_height); context.fill(); //sharp on the right - context.set_source_rgb(if error > 0.0 {error as f64/50.0} else {0.0}, 0.0, 0.0); + context.set_source_rgb(if error > 0.0 {f64::from(error)/50.0} else {0.0}, 0.0, 0.0); context.rectangle(midpoint, line_indicator_height, width, color_indicator_height+line_indicator_height); context.fill(); }, @@ -223,20 +223,19 @@ fn setup_pitch_error_indicator_callbacks(state: Rc>, c }); } -fn setup_oscilloscope_drawing_area_callbacks(state: Rc>, cross_thread_state: Arc>) { - let outer_state = state.clone(); - let canvas = &outer_state.borrow().ui.oscilloscope_chart; +fn setup_oscilloscope_drawing_area_callbacks(state: &Rc>, cross_thread_state: Arc>) { + let canvas = &state.borrow().ui.oscilloscope_chart; canvas.connect_draw(move |canvas, context| { if let Ok(cross_thread_state) = cross_thread_state.read() { let signal = &cross_thread_state.signal; - let width = canvas.get_allocated_width() as f64; + let width = f64::from(canvas.get_allocated_width()); // Set as a constant so signal won't change size based on // zero point, but don't take the window size exactly // since some will be cropped off the beginning. - let len = ::audio::FRAMES as f64 * 0.8; + let len = f64::from(::audio::FRAMES) * 0.7; - let height = canvas.get_allocated_height() as f64; + let height = f64::from(canvas.get_allocated_height()); let mid_height = height / 2.0; let max = 1.0; @@ -245,7 +244,7 @@ fn setup_oscilloscope_drawing_area_callbacks(state: Rc for (i, &intensity) in signal.iter().enumerate() { let x = i as f64 * width / len; - let y = mid_height - (intensity as f64 * mid_height / max); + let y = mid_height - (f64::from(intensity) * mid_height / max); context.line_to(x, y); } @@ -256,12 +255,11 @@ fn setup_oscilloscope_drawing_area_callbacks(state: Rc }); } -fn setup_correlation_drawing_area_callbacks(state: Rc>, cross_thread_state: Arc>) { - let outer_state = state.clone(); - let canvas = &outer_state.borrow().ui.correlation_chart; +fn setup_correlation_drawing_area_callbacks(state: &Rc>, cross_thread_state: Arc>) { + let canvas = &state.borrow().ui.correlation_chart; canvas.connect_draw(move |canvas, context| { - let width = canvas.get_allocated_width() as f64; - let height = canvas.get_allocated_height() as f64; + let width = f64::from(canvas.get_allocated_width()); + let height = f64::from(canvas.get_allocated_height()); //draw zero context.new_path(); @@ -273,7 +271,7 @@ fn setup_correlation_drawing_area_callbacks(state: Rc> let correlation = &cross_thread_state.correlation; let len = correlation.len() as f64; let max = match correlation.first() { - Some(&c) => c as f64, + Some(&c) => f64::from(c), None => 1.0 }; @@ -281,7 +279,7 @@ fn setup_correlation_drawing_area_callbacks(state: Rc> context.move_to(0.0, height); for (i, &val) in correlation.iter().enumerate() { let x = i as f64 * width / len; - let y = height/2.0 - (val as f64 * height / max / 2.0); + let y = height/2.0 - (f64::from(val) * height / max / 2.0); context.line_to(x, y); } context.stroke(); @@ -289,7 +287,7 @@ fn setup_correlation_drawing_area_callbacks(state: Rc> //draw the fundamental if let Some(fundamental) = cross_thread_state.fundamental_frequency { context.new_path(); - let fundamental_x = ::audio::SAMPLE_RATE as f64 / fundamental as f64 * width / len; + let fundamental_x = f64::from(SAMPLE_RATE) / f64::from(fundamental) * width / len; context.move_to(fundamental_x, 0.0); context.line_to(fundamental_x, height); context.stroke(); @@ -301,17 +299,17 @@ fn setup_correlation_drawing_area_callbacks(state: Rc> } fn setup_chart_visibility_callbacks(state: Rc>) { - let outer_state = state.clone(); + let outer_state = Rc::clone(&state); let oscilloscope_toggle_button = &outer_state.borrow().ui.oscilloscope_toggle_button; let correlation_toggle_button = &outer_state.borrow().ui.correlation_toggle_button; - let oscilloscope_state = state.clone(); + let oscilloscope_state = Rc::clone(&state); oscilloscope_toggle_button.connect_clicked(move |_| { let chart = &oscilloscope_state.borrow().ui.oscilloscope_chart; chart.set_visible(!chart.get_visible()); }); - let correlation_state = state.clone(); + let correlation_state = state; correlation_toggle_button.connect_clicked(move |_| { let chart = &correlation_state.borrow().ui.correlation_chart; chart.set_visible(!chart.get_visible()); diff --git a/src/transforms.rs b/src/transforms.rs index caa1480..a5df637 100644 --- a/src/transforms.rs +++ b/src/transforms.rs @@ -116,10 +116,10 @@ mod tests { use std::f32::consts::PI; const SAMPLE_RATE: f32 = 44100.0; - const FRAMES: usize = 512; + const FRAMES: u16 = 512; fn frequency_resolution() -> f32 { - SAMPLE_RATE / 2.0 / FRAMES as f32 + SAMPLE_RATE / 2.0 / f32::from(FRAMES) } fn sin_arg(f: f32, t: f32, phase: f32) -> f32 { @@ -129,14 +129,14 @@ mod tests { fn sample_sinusoud(amplitude: f32, frequency: f32, phase: f32) -> Vec { (0..FRAMES) .map(|x| { - let t = x as f32 / SAMPLE_RATE; + let t = f32::from(x) / SAMPLE_RATE; sin_arg(frequency, t, phase).sin() * amplitude }).collect() } #[test] fn correlation_on_sine_wave() { - let frequency = 440.0 as f32; //concert A + let frequency = 440.0f32; //concert A let samples = sample_sinusoud(1.0, frequency, 0.0); let fundamental = find_fundamental_frequency(&samples, SAMPLE_RATE).expect("Find fundamental returned None"); -- cgit v1.2.3