summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2017-08-02 23:57:23 +0200
committerJustin Worthe <justin@worthe-it.co.za>2017-08-02 23:57:23 +0200
commit88dc9f058bfc40b56372c0e22983b0b979ad964b (patch)
treeb8eb3a52a4a24e9d0ad64535c5d88ee0bd0840a3 /src
parent51061dc55da54f9990a72eed815ff53394305a59 (diff)
Readded frame skipping
This was becoming an issue on debug builds on the laptop. Really, it's for the best to skip frames rather than getting stuck in a perpetual time delay.
Diffstat (limited to 'src')
-rw-r--r--src/gui.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui.rs b/src/gui.rs
index 3b2bfab..796b341 100644
--- a/src/gui.rs
+++ b/src/gui.rs
@@ -163,6 +163,9 @@ fn start_listening_current_dropdown_value(dropdown: &gtk::ComboBoxText, mic_send
fn start_processing_audio(mic_receiver: Receiver<Vec<f32>>, cross_thread_state: Arc<RwLock<CrossThreadState>>) {
thread::spawn(move || {
while let Ok(samples) = mic_receiver.recv() {
+ //just in case we hit performance difficulties, clear out the channel
+ while mic_receiver.try_recv().ok() != None {}
+
let signal = ::transforms::align_to_rising_edge(&samples);
let correlation = ::transforms::correlation(&samples);
let fundamental = ::transforms::find_fundamental_frequency_correlation(&samples, ::audio::SAMPLE_RATE);