PreAnalyzedSong

Struct PreAnalyzedSong 

Source
pub struct PreAnalyzedSong {
    pub path: PathBuf,
    pub artist: Option<String>,
    pub album_artist: Option<String>,
    pub title: Option<String>,
    pub album: Option<String>,
    pub track_number: Option<i32>,
    pub disc_number: Option<i32>,
    pub genre: Option<String>,
    pub duration: Duration,
    pub sample_array: Vec<f32>,
}
Expand description

A struct used to represent a song that has been decoded, but not analyzed yet.

Most users will not need to use it, as most users won’t implement their decoders, but rely on ffmpeg to decode songs, and use FFmpegDecoder::song_from_path.

Since it contains the fully decoded song inside of PreAnalyzedSong::sample_array, it can be very large. Users should convert it to a Song as soon as possible, since it is this structure’s only reason to be.

Fields§

§path: PathBuf

Song’s provided file path

§artist: Option<String>

Song’s artist, read from the metadata

§album_artist: Option<String>

Song’s album’s artist name, read from the metadata

§title: Option<String>

Song’s title, read from the metadata

§album: Option<String>

Song’s album name, read from the metadata

§track_number: Option<i32>

Song’s tracked number, read from the metadata

§disc_number: Option<i32>

Song’s disc number, read from the metadata

§genre: Option<String>

Song’s genre, read from the metadata

§duration: Duration

The song’s duration

§sample_array: Vec<f32>

An array of the song’s decoded sample which should be, prior to analysis, resampled to f32le, one channel, with a sampling rate of 22050 Hz. Anything other than that will yield wrong results. To double-check that your sample array has the right format, you could run ffmpeg -i path_to_your_song.flac -ar 22050 -ac 1 -c:a pcm_f32le -f hash -hash addler32 -, which will give you the addler32 checksum of the sample array if the song has been decoded properly. You can then compute the addler32 checksum of your sample array (see _test_decode in the tests) and make sure both are the same.

(Running ffmpeg -i path_to_your_song.flac -ar 22050 -ac 1 -c:a pcm_f32le will simply give you the raw sample array as it should look like, if you’re not into computing checksums)

Trait Implementations§

Source§

impl Debug for PreAnalyzedSong

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PreAnalyzedSong

Source§

fn default() -> PreAnalyzedSong

Returns the “default value” for a type. Read more
Source§

impl TryFrom<PreAnalyzedSong> for Song

Source§

type Error = BlissError

The type returned in the event of a conversion error.
Source§

fn try_from(raw_song: PreAnalyzedSong) -> BlissResult<Song>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V