pub struct FlacAudio {
pub sample_rate: u32,
pub channels: u8,
pub bits_per_sample: u8,
pub samples: Vec<Vec<i32>>,
}Expand description
Decoded FLAC audio: the stream parameters plus the samples, one vector per channel.
Fields§
§sample_rate: u32Sample rate in hertz.
channels: u8Number of channels (1 to 8).
bits_per_sample: u8Bits per sample (4 to 32).
samples: Vec<Vec<i32>>Decoded samples, samples[channel][index]. Every channel vector has
the same length.
Implementations§
Source§impl FlacAudio
impl FlacAudio
Sourcepub fn samples_per_channel(&self) -> usize
pub fn samples_per_channel(&self) -> usize
Number of samples per channel.
Examples found in repository?
examples/smoke.rs (line 26)
6fn main() {
7 let path = std::env::args()
8 .nth(1)
9 .unwrap_or_else(|| "tests/fixtures/stereo16.flac".to_string());
10
11 let bytes = match std::fs::read(&path) {
12 Ok(b) => b,
13 Err(e) => {
14 eprintln!("could not read {path}: {e}");
15 std::process::exit(1);
16 }
17 };
18
19 match flac_io::decode(&bytes) {
20 Ok(audio) => {
21 println!(
22 "{path}: {} Hz, {} channel(s), {} bit, {} samples/channel",
23 audio.sample_rate,
24 audio.channels,
25 audio.bits_per_sample,
26 audio.samples_per_channel()
27 );
28 }
29 Err(e) => {
30 eprintln!("decode failed: {e}");
31 std::process::exit(1);
32 }
33 }
34}Trait Implementations§
impl Eq for FlacAudio
impl StructuralPartialEq for FlacAudio
Auto Trait Implementations§
impl Freeze for FlacAudio
impl RefUnwindSafe for FlacAudio
impl Send for FlacAudio
impl Sync for FlacAudio
impl Unpin for FlacAudio
impl UnsafeUnpin for FlacAudio
impl UnwindSafe for FlacAudio
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more