diff --git a/src/main.rs b/src/main.rs index 4ca8922..64fd307 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,8 @@ use std::error::Error; use std::fs::File; use std::io::Write; use clap::{App, Arg, SubCommand}; -use reskit::soundtrack::dmf::DmfModule; +use reskit::soundtrack::engines::echo::EchoFormat; +use reskit::soundtrack::formats::dmf::DmfModule; use reskit::utility; use reskit::tileset; diff --git a/src/reskit/soundtrack/engines/echo.rs b/src/reskit/soundtrack/engines/echo.rs new file mode 100644 index 0000000..e2a0d91 --- /dev/null +++ b/src/reskit/soundtrack/engines/echo.rs @@ -0,0 +1,7 @@ +use std::{collections::HashMap, error::Error}; + +pub trait EchoFormat { + + fn get_eefs( &self ) -> Result>, Box>; + +} \ No newline at end of file diff --git a/src/reskit/soundtrack/engines/mod.rs b/src/reskit/soundtrack/engines/mod.rs new file mode 100644 index 0000000..8417595 --- /dev/null +++ b/src/reskit/soundtrack/engines/mod.rs @@ -0,0 +1 @@ +pub mod echo; \ No newline at end of file diff --git a/src/reskit/soundtrack/dmf.rs b/src/reskit/soundtrack/formats/dmf.rs similarity index 98% rename from src/reskit/soundtrack/dmf.rs rename to src/reskit/soundtrack/formats/dmf.rs index 0cc8c04..2b3424e 100644 --- a/src/reskit/soundtrack/dmf.rs +++ b/src/reskit/soundtrack/formats/dmf.rs @@ -1,8 +1,6 @@ use std::{error::Error, fs::File, io::Read, convert::TryInto, collections::HashMap, cmp::{min, max}}; use flate2::read::ZlibDecoder; -use crate::reskit::{utility::{get_string, get_u8, skip, get_u32, get_i8, get_i32, get_u16, get_i16, Ring}, soundtrack::types::{SampleRate, SampleFormat, PsgEnvelope}}; - -use super::types::{Sample, Note, PsgSettings}; +use crate::reskit::{utility::{get_string, get_u8, skip, get_u32, get_i8, get_i32, get_u16, get_i16, Ring}, soundtrack::{types::{SampleRate, SampleFormat, PsgEnvelope, Note, Sample, PsgSettings}, engines::echo::EchoFormat}}; const DMF_MAGIC_NUMBER: &'static str = ".DelekDefleMask."; const DMF_SUPPORTED_VERSION: u8 = 0x18; @@ -596,7 +594,11 @@ impl DmfModule { ) } - pub fn get_eefs( &self ) -> Result>, Box> { +} + +impl EchoFormat for DmfModule { + + fn get_eefs( &self ) -> Result>, Box> { let mut eefs: HashMap> = HashMap::new(); for instrument in &self.instruments { @@ -725,11 +727,6 @@ impl DmfModule { Ok( eefs ) } - pub fn get_esf( &self ) -> Result, Box> { - // TODO !! - todo!() - } - } fn get_eef_volume( dmf_volume: u8 ) -> Result> { diff --git a/src/reskit/soundtrack/formats/mod.rs b/src/reskit/soundtrack/formats/mod.rs new file mode 100644 index 0000000..16a4aad --- /dev/null +++ b/src/reskit/soundtrack/formats/mod.rs @@ -0,0 +1 @@ +pub mod dmf; \ No newline at end of file diff --git a/src/reskit/soundtrack/mod.rs b/src/reskit/soundtrack/mod.rs index 3b4ac3e..4ed58f9 100644 --- a/src/reskit/soundtrack/mod.rs +++ b/src/reskit/soundtrack/mod.rs @@ -1,2 +1,3 @@ -pub mod dmf; +pub mod formats; +pub mod engines; pub mod types; \ No newline at end of file