fix: cast sample_rate to u64 in calculations

This commit is contained in:
2026-06-01 23:23:43 -04:00
parent 4fa25305b5
commit a7f11a7202

View File

@@ -295,7 +295,7 @@ pub async fn handle(state: State, interaction: Interaction) {
let sample_rate = state.audio_sample_rate.into(); let sample_rate = state.audio_sample_rate.into();
let total_samples = (duration.whole_seconds() as u64 * sample_rate) let total_samples = (duration.whole_seconds() as u64 * sample_rate)
+ (duration.subsec_microseconds() as u64 * sample_rate / 1_000_000); + (duration.subsec_microseconds() as u64 * sample_rate as u64 / 1_000_000);
let mut composite = vec![0; total_samples as usize]; let mut composite = vec![0; total_samples as usize];
@@ -343,7 +343,7 @@ pub async fn handle(state: State, interaction: Interaction) {
let progress_by_time = after_start / duration; let progress_by_time = after_start / duration;
let origin = (after_start.whole_seconds() as u64 * sample_rate) let origin = (after_start.whole_seconds() as u64 * sample_rate)
+ (after_start.subsec_microseconds() as u64 * sample_rate / 1_000_000); + (after_start.subsec_microseconds() as u64 * sample_rate as u64 / 1_000_000);
let origin = origin as usize; let origin = origin as usize;
let progress_by_sample = (origin as f64) / (total_samples as f64); let progress_by_sample = (origin as f64) / (total_samples as f64);