diff --git a/BizHawk.Emulation/DiscSystem/CUE_format.cs b/BizHawk.Emulation/DiscSystem/CUE_format.cs index 963ea8c640..0808f03197 100644 --- a/BizHawk.Emulation/DiscSystem/CUE_format.cs +++ b/BizHawk.Emulation/DiscSystem/CUE_format.cs @@ -51,24 +51,33 @@ namespace BizHawk.DiscSystem try { - //check for the specified file - if (!File.Exists(blobPath)) + //check whether we can load the wav directly + bool loaded = false; + if (File.Exists(blobPath) && Path.GetExtension(blobPath).ToUpper() == ".WAV") + { + try + { + blob.Load(blobPath); + loaded = true; + } + catch + { + } + } + + //if that didnt work or wasnt possible, try loading it through ffmpeg + if (!loaded) { - //if it doesn't exist, then it may be encoded. FFMpeg ffmpeg = new FFMpeg(); if (!ffmpeg.QueryServiceAvailable()) { - throw new InvalidOperationException("No decoding service was available (make sure ffmpeg.exe is available)"); + throw new InvalidOperationException("No decoding service was available (make sure ffmpeg.exe is available. even though this may be a wav, ffmpeg is used to load oddly formatted wave files)"); } AudioDecoder dec = new AudioDecoder(); byte[] buf = dec.AcquireWaveData(blobPath); blob.Load(new MemoryStream(buf)); WasSlowLoad = true; } - else - { - blob.Load(blobPath); - } } catch (Exception ex) { diff --git a/BizHawk.Emulation/DiscSystem/Decoding.cs b/BizHawk.Emulation/DiscSystem/Decoding.cs index 7a76b96cb7..bb41bdb602 100644 --- a/BizHawk.Emulation/DiscSystem/Decoding.cs +++ b/BizHawk.Emulation/DiscSystem/Decoding.cs @@ -75,7 +75,7 @@ namespace BizHawk.DiscSystem string tempfile = Path.GetTempFileName(); try { - string runResults = Run("-i", path, "-f", "wav", "-y", tempfile); + string runResults = Run("-i", path, "-f", "wav", "-ar", "44100", "-ac", "2", "-acodec", "pcm_s16le", "-y", tempfile); byte[] ret = File.ReadAllBytes(tempfile); if (ret.Length == 0) throw new InvalidOperationException("Failure running ffmpeg for audio decode. here was its output:\r\n" + runResults);