Feat: prelude and new words
This commit is contained in:
@@ -27,6 +27,8 @@ struct ProjectFile {
|
||||
tempo: f64,
|
||||
#[serde(default)]
|
||||
playing_patterns: Vec<(usize, usize)>,
|
||||
#[serde(default, skip_serializing_if = "String::is_empty")]
|
||||
prelude: String,
|
||||
}
|
||||
|
||||
fn default_tempo() -> f64 {
|
||||
@@ -41,6 +43,7 @@ impl From<&Project> for ProjectFile {
|
||||
sample_paths: project.sample_paths.clone(),
|
||||
tempo: project.tempo,
|
||||
playing_patterns: project.playing_patterns.clone(),
|
||||
prelude: project.prelude.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,6 +55,7 @@ impl From<ProjectFile> for Project {
|
||||
sample_paths: file.sample_paths,
|
||||
tempo: file.tempo,
|
||||
playing_patterns: file.playing_patterns,
|
||||
prelude: file.prelude,
|
||||
};
|
||||
project.normalize();
|
||||
project
|
||||
|
||||
@@ -452,6 +452,8 @@ pub struct Project {
|
||||
pub tempo: f64,
|
||||
#[serde(default)]
|
||||
pub playing_patterns: Vec<(usize, usize)>,
|
||||
#[serde(default)]
|
||||
pub prelude: String,
|
||||
}
|
||||
|
||||
fn default_tempo() -> f64 {
|
||||
@@ -465,6 +467,7 @@ impl Default for Project {
|
||||
sample_paths: Vec::new(),
|
||||
tempo: default_tempo(),
|
||||
playing_patterns: Vec::new(),
|
||||
prelude: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user