Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the `read_metrics_from_flac_by_bloc' #79

Merged
merged 5 commits into from
Nov 22, 2023

Conversation

joshuabvarghese
Copy link
Contributor

  • Converted channels to usize for better compatibility.
  • Used a dynamic vector sample_channel_data to hold samples for each channel.
  • Iterated over channels using channel as u32 to avoid type mismatches.
  • Pushed each channel's sample to the sample_vec vector.
  • Updated the debug print statement to display the sample_channel_data vector.

@joshuabvarghese joshuabvarghese marked this pull request as ready for review November 21, 2023 12:18
Ok(Some(next_block)) => block = next_block,
Ok(None) => break, // EOF.
Err(error) => panic!("[DEBUG][READ][FLAC] {}", error),
}
for sample in 0..block.duration() {
#[allow(clippy::needless_range_loop)]
for channel in 0..channels {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you have is fine but for reference we can resolve the clippy lint like this:

            for (i, channel) in sample_channel_data.iter_mut().enumerate() {
                *channel = block.sample(i as u32, sample) as u16;
            }

}

// Process the sample_channel_data as needed
for &sample in &sample_channel_data {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could shorten this to: sample_vec.extend(&sample_channel_data);

@joshuabvarghese joshuabvarghese merged commit 01e02dd into main Nov 22, 2023
2 checks passed
@joshuabvarghese joshuabvarghese deleted the TODO/flac-reader-upgrade- branch November 26, 2023 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants