Account for blank instrument names/sample names

master
Ashley N. 2023-08-20 19:47:27 -04:00
parent 34e4bbb3db
commit 73d0f77718
2 changed files with 6 additions and 4 deletions

View File

@ -13,4 +13,5 @@ clap = "^2.33"
flate2 = "1.0.26" flate2 = "1.0.26"
samplerate = "0.2.4" samplerate = "0.2.4"
hound = "3.5.0" hound = "3.5.0"
pitch_shift = "1.0.0" pitch_shift = "1.0.0"
uuid = { version = "1.4.1", features = [ "v4" ] }

View File

@ -1,6 +1,7 @@
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 samplerate::convert; 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}}; 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."; const DMF_MAGIC_NUMBER: &'static str = ".DelekDefleMask.";
@ -734,7 +735,7 @@ impl EchoFormat for DmfModule {
// Echo end loop command // Echo end loop command
envelope.push( 0xFF ); 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( rr_sl );
eif.extend( ssg_eg ); 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 // Terminate stream
data.push( 0xFF ); 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 ) Ok( ewfs )