From c22eb1cd8f450faa716599951b24288d68854efb Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Tue, 3 Dec 2024 15:46:57 +0100 Subject: [PATCH] use `sample_rate` in process function --- 01-play-sine/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01-play-sine/src/main.rs b/01-play-sine/src/main.rs index 6ede0bf..be2a3bd 100644 --- a/01-play-sine/src/main.rs +++ b/01-play-sine/src/main.rs @@ -98,7 +98,7 @@ fn main() -> Result<(), Box> { my_data.time += 1; 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 pi2 = 2.0 * 3.141; let phi = pi2 * time_secs * sine_freq;