aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cubase_project.rs3
-rw-r--r--src/main.rs41
2 files changed, 43 insertions, 1 deletions
diff --git a/src/cubase_project.rs b/src/cubase_project.rs
index 49c73a7..498936d 100644
--- a/src/cubase_project.rs
+++ b/src/cubase_project.rs
@@ -38,3 +38,6 @@ pub struct PAppVersion {
pub applocale: String,
}
+#[derive(Debug, Default)]
+pub struct PArrangement {
+}
diff --git a/src/main.rs b/src/main.rs
index 58b6a86..6eb105b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -21,7 +21,7 @@ use cubase_project::*;
use nom::{
bytes::complete::*,
- multi::length_data,
+ multi::{length_data, many1},
number::complete::*,
sequence::tuple,
Finish,
@@ -90,6 +90,12 @@ fn p_app_version<'a>(data: &'a [u8]) -> IResult<&'a [u8], PAppVersion> {
Ok((r, v))
}
+fn p_arrangement<'a>(data: &'a [u8]) -> IResult<&'a [u8], PArrangement> {
+ let mut v = PArrangement::default();
+
+ Ok((data, v))
+}
+
fn fourcc<'a>(data: &'a [u8]) -> IResult<&'a [u8], &'a str> {
let (rest, tag) = take(4usize)(data)?;
Ok((rest, std::str::from_utf8(tag).unwrap()))
@@ -161,6 +167,11 @@ fn cpr_file<'a>(data: &'a [u8]) -> IResult<&'a [u8], CubaseProject> {
proj.app_version = v;
payload = r2;
},
+ "Arrangement1" => {
+ let (r2, a) = arrangement_chunk(r)?;
+ println!("[*] {:?}", a);
+ payload = r2;
+ },
_ => {
let (r2, _) = riff_chunk(r)?;
payload = r2;
@@ -223,6 +234,34 @@ fn version_chunk<'a>(data: &'a [u8]) -> IResult<&'a [u8], PAppVersion> {
Ok((r, v))
}
+
+fn arrangement_chunk<'a>(data: &'a [u8]) -> IResult<&'a [u8], PArrangement> {
+ let (r, chunk) = riff_chunk(data)?;
+ assert_eq!(chunk.fourcc, "ARCH");
+
+ // It varies a bit how many levels deep the actual PArrangement object is.
+ //
+ // File created with Cubase 4.5.x (file version 310?) seems to have this
+ // structure:
+ //
+ // GDocument -> GModel -> CmObject
+ //
+ // While Cubase version 5.x (file version 400?) seems to have the CmObject
+ // directly under the GDocument container.
+ let (odata, c) = many1(container_node)(chunk.payload)?;
+ println!("[*] {:?}", c);
+
+ // This is the actual PArrangeent object
+ let (r2, o) = object_node(odata)?;
+ println!("[*] {:?}: {} ({} bytes)", o.node_type, o.name, o.payload.unwrap().len());
+ assert_eq!(r2.len(), 0);
+
+ let (r2, v) = p_arrangement(o.payload.unwrap())?;
+ // assert_eq!(r2.len(), 0);
+
+ Ok((r, PArrangement::default()))
+}
+
pub fn parse_cubase_project<P>(filename: P) -> Result<CubaseProject, Box<dyn Error>>
where
P: AsRef<Path>