From 8556a4390f5b894a8dbe81b1b73f9f8aa2bf5083 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Tue, 23 Jun 2020 14:34:49 +0200 Subject: [PATCH] Try to use second sound if sound not found In wave banks with two entries the second sound should be the full song. --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index add2fd8..5c1ac63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use anyhow::{anyhow, Result}; use clap::Clap; -use log::{debug, error, info}; +use log::{debug, error, info, warn}; use brd::converter; use brd::ddr::ssq::SSQ; @@ -161,9 +161,15 @@ fn main() -> Result<()> { let audio_data = if wave_bank.sounds.contains_key(sound_name) { wave_bank.sounds.get(sound_name).unwrap().to_wav()? + } else if wave_bank.sounds.contains_key("1") { + warn!( + "Sound {} not found in wave bank, using second entry", + sound_name + ); + wave_bank.sounds.get("1").unwrap().to_wav()? } else { return error(format!( - "Could not find sound with chart name {} in wave bank", + "Could not find sound with chart name {} or second numbered entry in wave bank", sound_name, )); };