This commit is contained in:
Breval Ferrari 2025-03-19 01:16:08 -04:00
parent 19c6ee71d5
commit ba9443fc08
No known key found for this signature in database
GPG key ID: F71E304D6400AB8E
2 changed files with 6 additions and 8 deletions

View file

@ -20,5 +20,5 @@ strum = { version = "0.26", features = ["derive"] }
derive_wrapper = "0.1"
symphonia = { version = "0.5", features = ["all"] }
[dev_dependencies]
[dev-dependencies]
project-root = "0.2.2"

View file

@ -10,7 +10,6 @@ use symphonia::{
audio::Signal,
codecs::{Decoder, CODEC_TYPE_NULL},
conv::FromSample,
errors::Error,
formats::FormatReader,
io::MediaSourceStream,
probe::Hint,
@ -20,7 +19,7 @@ use symphonia::{
};
use thiserror::Error;
use crate::{IntoDataBytes, TryFromDataBytes};
use crate::IntoDataBytes;
use super::{RawSamples, Sample};
@ -58,11 +57,10 @@ impl Audio {
let mss = MediaSourceStream::new(Box::new(mediasource), Default::default());
let reader = probe
.format(
&Hint::new().with_extension(
Hint::new().with_extension(
path.as_ref()
.extension()
.map(|os_str| os_str.to_str())
.flatten()
.and_then(|os_str| os_str.to_str())
.unwrap_or("mp3"),
),
mss,
@ -71,7 +69,7 @@ impl Audio {
)?
.format;
let decoder = registry.make(
&reader
reader
.tracks()
.iter()
.find(|t| t.codec_params.codec != CODEC_TYPE_NULL)
@ -148,7 +146,7 @@ where
.flat_map(|ch| audio_buffer
.chan(ch)
.iter()
.map(|s| S::from_sample(s.clone()))
.map(|s| S::from_sample(*s))
.collect::<Vec<S>>())
.collect::<Vec<S>>()
)