diff --git a/src/command/render.rs b/src/command/render.rs index 84e9779..52181fe 100644 --- a/src/command/render.rs +++ b/src/command/render.rs @@ -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;