Compare commits

...

2 Commits

2 changed files with 13 additions and 6 deletions

View File

@@ -294,8 +294,8 @@ pub async fn handle(state: State, interaction: Interaction) {
let channels = state.audio_channels.into(); let channels = state.audio_channels.into();
let sample_rate = state.audio_sample_rate.into(); let sample_rate = state.audio_sample_rate.into();
let total_samples = (duration.whole_seconds() as u32 * sample_rate) let total_samples = (duration.whole_seconds() as u64 * sample_rate)
+ (duration.subsec_microseconds() as u32 * sample_rate / 1_000_000); + (duration.subsec_microseconds() as u64 * sample_rate / 1_000_000);
let mut composite = vec![0; total_samples as usize]; 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 progress_by_time = after_start / duration;
let origin = (after_start.whole_seconds() as u32 * sample_rate) let origin = (after_start.whole_seconds() as u64 * sample_rate)
+ (after_start.subsec_microseconds() as u32 * sample_rate / 1_000_000); + (after_start.subsec_microseconds() as u64 * sample_rate / 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);
let samples_length = samples.len();
let extent = origin + samples_length;
tracing::debug!( tracing::debug!(
progress_by_time, progress_by_time,
progress_by_sample, progress_by_sample,
?after_start, ?after_start,
?duration, ?duration,
origin, origin,
total_samples total_samples,
samples_length,
extent
); );
for (i, sample) in samples.into_iter().enumerate() { for (i, sample) in samples.into_iter().enumerate() {
@@ -372,6 +377,8 @@ pub async fn handle(state: State, interaction: Interaction) {
?second, ?second,
?microsecond, ?microsecond,
origin, origin,
samples_length,
extent,
i, i,
total_samples, total_samples,
"out of range" "out of range"

View File

@@ -71,7 +71,7 @@ async fn initialize_server_vcs(
} }
} }
#[tracing::instrument(skip(discord_client), ret)] #[tracing::instrument(skip(vcs_sender, discord_client))]
pub async fn initialize_vcs(vcs_sender: &VCsSender, discord_client: &twilight_http::Client) { pub async fn initialize_vcs(vcs_sender: &VCsSender, discord_client: &twilight_http::Client) {
if let Ok(guilds_res) = discord_client.current_user_guilds().limit(200).await if let Ok(guilds_res) = discord_client.current_user_guilds().limit(200).await
&& let Ok(guilds) = guilds_res.model().await && let Ok(guilds) = guilds_res.model().await