diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2017-08-02 23:57:23 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2017-08-02 23:57:23 +0200 |
commit | 88dc9f058bfc40b56372c0e22983b0b979ad964b (patch) | |
tree | b8eb3a52a4a24e9d0ad64535c5d88ee0bd0840a3 /src/gui.rs | |
parent | 51061dc55da54f9990a72eed815ff53394305a59 (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/gui.rs')
-rw-r--r-- | src/gui.rs | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -163,6 +163,9 @@ fn start_listening_current_dropdown_value(dropdown: >k::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); |