Refactor into engines/formats folders
parent
2e0a07c189
commit
3aa311c8f5
|
@ -8,7 +8,8 @@ use std::error::Error;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use clap::{App, Arg, SubCommand};
|
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::utility;
|
||||||
use reskit::tileset;
|
use reskit::tileset;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
use std::{collections::HashMap, error::Error};
|
||||||
|
|
||||||
|
pub trait EchoFormat {
|
||||||
|
|
||||||
|
fn get_eefs( &self ) -> Result<HashMap<String, Vec<u8>>, Box<dyn Error>>;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
pub mod echo;
|
|
@ -1,8 +1,6 @@
|
||||||
use std::{error::Error, fs::File, io::Read, convert::TryInto, collections::HashMap, cmp::{min, max}};
|
use std::{error::Error, fs::File, io::Read, convert::TryInto, collections::HashMap, cmp::{min, max}};
|
||||||
use flate2::read::ZlibDecoder;
|
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 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}};
|
||||||
|
|
||||||
use super::types::{Sample, Note, PsgSettings};
|
|
||||||
|
|
||||||
const DMF_MAGIC_NUMBER: &'static str = ".DelekDefleMask.";
|
const DMF_MAGIC_NUMBER: &'static str = ".DelekDefleMask.";
|
||||||
const DMF_SUPPORTED_VERSION: u8 = 0x18;
|
const DMF_SUPPORTED_VERSION: u8 = 0x18;
|
||||||
|
@ -596,7 +594,11 @@ impl DmfModule {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_eefs( &self ) -> Result<HashMap<String, Vec<u8>>, Box<dyn Error>> {
|
}
|
||||||
|
|
||||||
|
impl EchoFormat for DmfModule {
|
||||||
|
|
||||||
|
fn get_eefs( &self ) -> Result<HashMap<String, Vec<u8>>, Box<dyn Error>> {
|
||||||
let mut eefs: HashMap<String, Vec<u8>> = HashMap::new();
|
let mut eefs: HashMap<String, Vec<u8>> = HashMap::new();
|
||||||
|
|
||||||
for instrument in &self.instruments {
|
for instrument in &self.instruments {
|
||||||
|
@ -725,11 +727,6 @@ impl DmfModule {
|
||||||
Ok( eefs )
|
Ok( eefs )
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_esf( &self ) -> Result<Vec<u8>, Box<dyn Error>> {
|
|
||||||
// TODO !!
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_eef_volume( dmf_volume: u8 ) -> Result<u8, Box<dyn Error>> {
|
fn get_eef_volume( dmf_volume: u8 ) -> Result<u8, Box<dyn Error>> {
|
|
@ -0,0 +1 @@
|
||||||
|
pub mod dmf;
|
|
@ -1,2 +1,3 @@
|
||||||
pub mod dmf;
|
pub mod formats;
|
||||||
|
pub mod engines;
|
||||||
pub mod types;
|
pub mod types;
|
Loading…
Reference in New Issue