disc-more robust waveification
This commit is contained in:
parent
66ccd1eadc
commit
bde8365563
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue