diff --git a/src/command/render.rs b/src/command/render.rs index 6e9a144..0b87fe2 100644 --- a/src/command/render.rs +++ b/src/command/render.rs @@ -294,8 +294,8 @@ 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 u32 * sample_rate) - + (duration.subsec_microseconds() as u32 * sample_rate / 1_000_000); + let total_samples = (duration.whole_seconds() as u64 * sample_rate) + + (duration.subsec_microseconds() as u64 * sample_rate / 1_000_000); let mut composite = vec![0; total_samples as usize]; @@ -342,19 +342,24 @@ pub async fn handle(state: State, interaction: Interaction) { let progress_by_time = after_start / duration; - let origin = (after_start.whole_seconds() as u32 * sample_rate) - + (after_start.subsec_microseconds() as u32 * sample_rate / 1_000_000); + let origin = (after_start.whole_seconds() as u64 * sample_rate) + + (after_start.subsec_microseconds() as u64 * sample_rate / 1_000_000); let origin = origin as usize; let progress_by_sample = (origin as f64) / (total_samples as f64); + let samples_length = samples.len(); + let extent = origin + samples_length; + tracing::debug!( progress_by_time, progress_by_sample, ?after_start, ?duration, origin, - total_samples + total_samples, + samples_length, + extent ); for (i, sample) in samples.into_iter().enumerate() { @@ -372,6 +377,8 @@ pub async fn handle(state: State, interaction: Interaction) { ?second, ?microsecond, origin, + samples_length, + extent, i, total_samples, "out of range"