use sample_rate in process function

This commit is contained in:
Michael Sippel 2024-12-03 15:46:57 +01:00
parent f5c4ff8c35
commit c22eb1cd8f
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -98,7 +98,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
my_data.time += 1; my_data.time += 1;
t t
}; };
let time_secs = (time_samples as f32) / 48000.0 as f32; let time_secs = (time_samples as f32) / (sample_rate as f32);
let sine_freq = 440.0; let sine_freq = 440.0;
let pi2 = 2.0 * 3.141; let pi2 = 2.0 * 3.141;
let phi = pi2 * time_secs * sine_freq; let phi = pi2 * time_secs * sine_freq;