use crate::{FillsNotary, SCOPE, TONIC};
use std::collections::HashMap;
#[derive(Default)]
pub struct NaturalMusicBox {
tonic: f64,
pub notary: HashMap<String, f64>,
}
impl NaturalMusicBox {
pub fn new() -> Self {
let mut music = Self {
tonic: TONIC,
notary: HashMap::new(),
};
music.scoped_fill();
music
}
}
impl FillsNotary for NaturalMusicBox {
fn scoped_fill(&mut self) {
for i in 1..SCOPE {
let harmonic_series: f64 = ((i as f64) + 1.0) / (i as f64);
let overtone = self.tonic * harmonic_series;
self.notary
.insert(format!("{}/{}", i, i + 1), overtone.to_owned());
}
}
fn scoped_lesser(&mut self) {
for i in 1..SCOPE {
let harmonic_series: f64 = ((i as f64) + 1.0) / (i as f64);
let overtone = self.tonic / harmonic_series;
self.notary
.insert(format!("{}/{}", i, i + 1), overtone.to_owned());
}
}
fn piano(&mut self) {}
}