summaryrefslogtreecommitdiff
path: root/src/gui.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2017-07-15 15:28:53 +0200
committerJustin Worthe <justin@worthe-it.co.za>2017-07-15 15:28:53 +0200
commited89f64962d5de120db26f140c8e027991ab2797 (patch)
tree9248f01037c7e68e9742207464ffcb15b6057cab /src/gui.rs
parent4dd91d7fc35685f4ad4c909ba72a03f21185283d (diff)
Decreased window size and increased framerate
The samller windows size has a few effects: 1. the frequency calculation will be less accurate, because less iterations of the binary search will be effective. 2. 'mixed signals', measures at the start or end of a note where half the signal is one thing and the other half is something else will have less impact, since they will be on the screen for less time. The higher frame rate also looks really nice.
Diffstat (limited to 'src/gui.rs')
-rw-r--r--src/gui.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui.rs b/src/gui.rs
index a75e573..d66c685 100644
--- a/src/gui.rs
+++ b/src/gui.rs
@@ -10,7 +10,7 @@ use std::io::Write;
use std::thread;
use std::sync::mpsc::*;
-const FPS: u32 = 30;
+const FPS: u32 = 60;
struct RustyUi {
dropdown: gtk::ComboBoxText,
@@ -251,7 +251,12 @@ fn setup_oscilloscope_drawing_area_callbacks(state: Rc<RefCell<ApplicationState>
if let Ok(cross_thread_state) = cross_thread_state.read() {
let ref signal = cross_thread_state.signal;
let width = canvas.get_allocated_width() as f64;
- let len = 512.0; //Set as a constant so signal won't change size based on zero point.
+
+ // 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 height = canvas.get_allocated_height() as f64;
let mid_height = height / 2.0;
let max = 1.0;