Make Analysis::new public

This commit is contained in:
Polochon-street 2021-06-05 23:56:01 +02:00
parent 95476ee86e
commit dce2bb4295
3 changed files with 13 additions and 2 deletions

View file

@ -2,6 +2,11 @@
## bliss 0.2.1 ## bliss 0.2.1
* Made `Analysis::new` public.
* Made `Analysis` serializable.
## bliss 0.2.0
* Added an `Analysis` struct to `Song`, as well as an `AnalysisIndex` to * Added an `Analysis` struct to `Song`, as well as an `AnalysisIndex` to
index it easily. index it easily.
* Changed some logging parameters for the Library trait. * Changed some logging parameters for the Library trait.

View file

@ -1,6 +1,6 @@
[package] [package]
name = "bliss-audio" name = "bliss-audio"
version = "0.2.0" version = "0.2.1"
authors = ["Polochon-street <polochonstreet@gmx.fr>"] authors = ["Polochon-street <polochonstreet@gmx.fr>"]
edition = "2018" edition = "2018"
license = "GPL-3.0-only" license = "GPL-3.0-only"

View file

@ -104,6 +104,7 @@ pub enum AnalysisIndex {
} }
const NUMBER_FEATURES: usize = AnalysisIndex::COUNT; const NUMBER_FEATURES: usize = AnalysisIndex::COUNT;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Default, PartialEq, Clone, Copy)] #[derive(Default, PartialEq, Clone, Copy)]
/// Object holding the results of the song's analysis. /// Object holding the results of the song's analysis.
/// ///
@ -143,7 +144,12 @@ impl fmt::Debug for Analysis {
} }
impl Analysis { impl Analysis {
pub(crate) fn new(analysis: [f32; NUMBER_FEATURES]) -> Analysis { /// Create a new Analysis object.
///
/// Usually not needed, unless you have already computed and stored
/// features somewhere, and need to recreate a Song with an already
/// existing Analysis yourself.
pub fn new(analysis: [f32; NUMBER_FEATURES]) -> Analysis {
Analysis { Analysis {
internal_analysis: analysis, internal_analysis: analysis,
} }