1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use super::note::Note;
use crate::NbsFormat;
use std::collections::HashMap;
#[derive(Debug)]
pub struct Layer {
pub name: String,
pub locked: Option<bool>,
pub volume: Option<i8>,
pub stereo: Option<i8>,
pub notes: HashMap<i16, Note>,
}
impl Layer {
pub fn new() -> Self {
Layer {
name: String::new(),
locked: None,
volume: None,
stereo: None,
notes: HashMap::new(),
}
}
pub fn from_format(format: NbsFormat) -> Self {
let mut layer = Layer::new();
layer.name = String::new();
if format.version() >= 4 {
layer.locked = Some(false);
}
if format.version() >= 2 {
layer.volume = Some(100);
layer.stereo = Some(100);
}
layer
}
}