fix: cast sample_rate to u64 in calculations
This commit is contained in:
@@ -295,7 +295,7 @@ pub async fn handle(state: State, interaction: Interaction) {
|
||||
let sample_rate = state.audio_sample_rate.into();
|
||||
|
||||
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];
|
||||
|
||||
@@ -343,7 +343,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)
|
||||
+ (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 progress_by_sample = (origin as f64) / (total_samples as f64);
|
||||
|
||||
Reference in New Issue
Block a user