fix: coerce sample_rate to u64 correctly

This commit is contained in:
2026-06-01 23:27:46 -04:00
parent a7f11a7202
commit ba0450e999

View File

@@ -294,7 +294,7 @@ pub async fn handle(state: State, interaction: Interaction) {
let channels = state.audio_channels.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 as u64)
+ (duration.subsec_microseconds() as u64 * sample_rate as u64 / 1_000_000);
let mut composite = vec![0; total_samples as usize];
@@ -342,7 +342,7 @@ pub async fn handle(state: State, interaction: Interaction) {
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 as u64)
+ (after_start.subsec_microseconds() as u64 * sample_rate as u64 / 1_000_000);
let origin = origin as usize;