summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2017-08-12 19:59:29 +0200
committerJustin Worthe <justin@worthe-it.co.za>2017-08-12 19:59:29 +0200
commitd23fae9da3da625ca87c615a7798570f138aa0f5 (patch)
tree61e4f0fc8555abcd6482ada9c66950430cfd83c9 /src
parent9ff484e2e462d613a3e4746d000e1b0c8f3bd7a1 (diff)
parent88dc9f058bfc40b56372c0e22983b0b979ad964b (diff)
Merge branch 'master' of github.com:JWorthe/rusty_microphone
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);