diff --git a/Cargo.toml b/Cargo.toml index 9389907..637394e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,5 @@ clap = "^2.33" flate2 = "1.0.26" samplerate = "0.2.4" hound = "3.5.0" -pitch_shift = "1.0.0" \ No newline at end of file +pitch_shift = "1.0.0" +uuid = { version = "1.4.1", features = [ "v4" ] } \ No newline at end of file diff --git a/src/reskit/soundtrack/formats/dmf.rs b/src/reskit/soundtrack/formats/dmf.rs index ee5e56e..d119b8d 100644 --- a/src/reskit/soundtrack/formats/dmf.rs +++ b/src/reskit/soundtrack/formats/dmf.rs @@ -1,6 +1,7 @@ use std::{error::Error, fs::File, io::Read, convert::TryInto, collections::HashMap, cmp::{min, max}}; use flate2::read::ZlibDecoder; use samplerate::convert; +use uuid::Uuid; use crate::reskit::{utility::{get_string, get_u8, skip, get_u32, get_i8, get_i32, get_u16, get_i16, Ring, print_warning}, soundtrack::{types::{SampleFormat, PsgEnvelope, Note, Sample, PsgSettings}, engines::echo::EchoFormat}}; const DMF_MAGIC_NUMBER: &'static str = ".DelekDefleMask."; @@ -734,7 +735,7 @@ impl EchoFormat for DmfModule { // Echo end loop command envelope.push( 0xFF ); - eefs.insert( format!( "{}.eef", instrument.name ), envelope ); + eefs.insert( format!( "{}.eef", if instrument.name.is_empty() { Uuid::new_v4().to_string() } else { instrument.name.to_owned() } ), envelope ); } } @@ -798,7 +799,7 @@ impl EchoFormat for DmfModule { eif.extend( rr_sl ); eif.extend( ssg_eg ); - eifs.insert( format!( "{}.eif", instrument.name), eif ); + eifs.insert( format!( "{}.eif", if instrument.name.is_empty() { Uuid::new_v4().to_string() } else { instrument.name.to_owned() } ), eif ); } } @@ -858,7 +859,7 @@ impl EchoFormat for DmfModule { // Terminate stream data.push( 0xFF ); - ewfs.insert( format!( "{}.ewf", sample.name ), data ); + ewfs.insert( format!( "{}.ewf", if sample.name.is_empty() { Uuid::new_v4().to_string() } else { sample.name.to_owned() } ), data ); } Ok( ewfs )