Merge pull request #9 from Polochon-street/minor-fixes

Make `Analysis::new` public
This commit is contained in:
Polochon-street 2021-06-06 12:34:10 +02:00 committed by GitHub
commit 7c19057b88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -2,6 +2,11 @@
## 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
index it easily.
* Changed some logging parameters for the Library trait.

View file

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

View file

@ -104,6 +104,7 @@ pub enum AnalysisIndex {
}
const NUMBER_FEATURES: usize = AnalysisIndex::COUNT;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Default, PartialEq, Clone, Copy)]
/// Object holding the results of the song's analysis.
///
@ -143,7 +144,12 @@ impl fmt::Debug for 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 {
internal_analysis: analysis,
}