#[derive(Debug, Clone)]
pub struct KeyProfile {
pub root: u8,
pub is_major: bool,
pub weights: [f32; 12],
}
pub const KEY_PROFILES: [KeyProfile; 24] = [
KeyProfile {
root: 0,
is_major: true,
weights: [
6.35, 2.23, 3.48, 2.33, 4.38, 4.09, 2.52, 5.19, 2.39, 3.66, 2.29, 2.88,
],
},
KeyProfile {
root: 1,
is_major: true,
weights: [
2.88, 6.35, 2.23, 3.48, 2.33, 4.38, 4.09, 2.52, 5.19, 2.39, 3.66, 2.29,
],
},
KeyProfile {
root: 2,
is_major: true,
weights: [
2.29, 2.88, 6.35, 2.23, 3.48, 2.33, 4.38, 4.09, 2.52, 5.19, 2.39, 3.66,
],
},
KeyProfile {
root: 3,
is_major: true,
weights: [
3.66, 2.29, 2.88, 6.35, 2.23, 3.48, 2.33, 4.38, 4.09, 2.52, 5.19, 2.39,
],
},
KeyProfile {
root: 4,
is_major: true,
weights: [
2.39, 3.66, 2.29, 2.88, 6.35, 2.23, 3.48, 2.33, 4.38, 4.09, 2.52, 5.19,
],
},
KeyProfile {
root: 5,
is_major: true,
weights: [
5.19, 2.39, 3.66, 2.29, 2.88, 6.35, 2.23, 3.48, 2.33, 4.38, 4.09, 2.52,
],
},
KeyProfile {
root: 6,
is_major: true,
weights: [
2.52, 5.19, 2.39, 3.66, 2.29, 2.88, 6.35, 2.23, 3.48, 2.33, 4.38, 4.09,
],
},
KeyProfile {
root: 7,
is_major: true,
weights: [
4.09, 2.52, 5.19, 2.39, 3.66, 2.29, 2.88, 6.35, 2.23, 3.48, 2.33, 4.38,
],
},
KeyProfile {
root: 8,
is_major: true,
weights: [
4.38, 4.09, 2.52, 5.19, 2.39, 3.66, 2.29, 2.88, 6.35, 2.23, 3.48, 2.33,
],
},
KeyProfile {
root: 9,
is_major: true,
weights: [
2.33, 4.38, 4.09, 2.52, 5.19, 2.39, 3.66, 2.29, 2.88, 6.35, 2.23, 3.48,
],
},
KeyProfile {
root: 10,
is_major: true,
weights: [
3.48, 2.33, 4.38, 4.09, 2.52, 5.19, 2.39, 3.66, 2.29, 2.88, 6.35, 2.23,
],
},
KeyProfile {
root: 11,
is_major: true,
weights: [
2.23, 3.48, 2.33, 4.38, 4.09, 2.52, 5.19, 2.39, 3.66, 2.29, 2.88, 6.35,
],
},
KeyProfile {
root: 0,
is_major: false,
weights: [
6.33, 2.68, 3.52, 5.38, 2.60, 3.53, 2.54, 4.75, 3.98, 2.69, 3.34, 3.17,
],
},
KeyProfile {
root: 1,
is_major: false,
weights: [
3.17, 6.33, 2.68, 3.52, 5.38, 2.60, 3.53, 2.54, 4.75, 3.98, 2.69, 3.34,
],
},
KeyProfile {
root: 2,
is_major: false,
weights: [
3.34, 3.17, 6.33, 2.68, 3.52, 5.38, 2.60, 3.53, 2.54, 4.75, 3.98, 2.69,
],
},
KeyProfile {
root: 3,
is_major: false,
weights: [
2.69, 3.34, 3.17, 6.33, 2.68, 3.52, 5.38, 2.60, 3.53, 2.54, 4.75, 3.98,
],
},
KeyProfile {
root: 4,
is_major: false,
weights: [
3.98, 2.69, 3.34, 3.17, 6.33, 2.68, 3.52, 5.38, 2.60, 3.53, 2.54, 4.75,
],
},
KeyProfile {
root: 5,
is_major: false,
weights: [
4.75, 3.98, 2.69, 3.34, 3.17, 6.33, 2.68, 3.52, 5.38, 2.60, 3.53, 2.54,
],
},
KeyProfile {
root: 6,
is_major: false,
weights: [
2.54, 4.75, 3.98, 2.69, 3.34, 3.17, 6.33, 2.68, 3.52, 5.38, 2.60, 3.53,
],
},
KeyProfile {
root: 7,
is_major: false,
weights: [
3.53, 2.54, 4.75, 3.98, 2.69, 3.34, 3.17, 6.33, 2.68, 3.52, 5.38, 2.60,
],
},
KeyProfile {
root: 8,
is_major: false,
weights: [
2.60, 3.53, 2.54, 4.75, 3.98, 2.69, 3.34, 3.17, 6.33, 2.68, 3.52, 5.38,
],
},
KeyProfile {
root: 9,
is_major: false,
weights: [
5.38, 2.60, 3.53, 2.54, 4.75, 3.98, 2.69, 3.34, 3.17, 6.33, 2.68, 3.52,
],
},
KeyProfile {
root: 10,
is_major: false,
weights: [
3.52, 5.38, 2.60, 3.53, 2.54, 4.75, 3.98, 2.69, 3.34, 3.17, 6.33, 2.68,
],
},
KeyProfile {
root: 11,
is_major: false,
weights: [
2.68, 3.52, 5.38, 2.60, 3.53, 2.54, 4.75, 3.98, 2.69, 3.34, 3.17, 6.33,
],
},
];
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_key_profiles_count() {
assert_eq!(KEY_PROFILES.len(), 24);
}
#[test]
fn test_major_minor_balance() {
let major_count = KEY_PROFILES.iter().filter(|p| p.is_major).count();
let minor_count = KEY_PROFILES.iter().filter(|p| !p.is_major).count();
assert_eq!(major_count, 12);
assert_eq!(minor_count, 12);
}
#[test]
fn test_profile_weights_length() {
for profile in &KEY_PROFILES {
assert_eq!(profile.weights.len(), 12);
}
}
}