mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
fixes duration, oops (#447)
This commit is contained in:
committed by
Aiden McClelland
parent
0886cd91a3
commit
ecd4687bde
@@ -223,7 +223,7 @@ pub enum TimeSlice {
|
|||||||
}
|
}
|
||||||
impl TimeSlice {
|
impl TimeSlice {
|
||||||
pub fn to_duration(&self, tempo_qpm: u16) -> Duration {
|
pub fn to_duration(&self, tempo_qpm: u16) -> Duration {
|
||||||
let micros_per_quarter = (tempo_qpm as f64) * 1_000_000f64;
|
let micros_per_quarter = 1_000_000f64 * 60f64 / tempo_qpm as f64;
|
||||||
match &self {
|
match &self {
|
||||||
&Self::Sixteenth => Duration::from_micros((micros_per_quarter / 4.0) as u64),
|
&Self::Sixteenth => Duration::from_micros((micros_per_quarter / 4.0) as u64),
|
||||||
&Self::Eighth => Duration::from_micros((micros_per_quarter / 2.0) as u64),
|
&Self::Eighth => Duration::from_micros((micros_per_quarter / 2.0) as u64),
|
||||||
|
|||||||
Reference in New Issue
Block a user