mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 21:55:34 +08:00
format ids that require conversion are stored in a static HashSet.
This commit is contained in:
parent
792b299037
commit
7b131442ad
@ -23,6 +23,7 @@
|
|||||||
// IN THE SOFTWARE.
|
// IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -49,11 +50,17 @@ namespace GameRes
|
|||||||
|
|
||||||
public override string SourceFormat { get { return "wav"; } }
|
public override string SourceFormat { get { return "wav"; } }
|
||||||
|
|
||||||
|
static readonly HashSet<WaveFormatEncoding> ConversionRequired = new HashSet<WaveFormatEncoding> {
|
||||||
|
WaveFormatEncoding.Adpcm, // 2
|
||||||
|
WaveFormatEncoding.MuLaw, // 7
|
||||||
|
WaveFormatEncoding.DviAdpcm, // 0x11
|
||||||
|
};
|
||||||
|
|
||||||
public WaveInput (Stream file) : base (file)
|
public WaveInput (Stream file) : base (file)
|
||||||
{
|
{
|
||||||
m_reader = new WaveFileReader (file);
|
m_reader = new WaveFileReader (file);
|
||||||
var wf = m_reader.WaveFormat;
|
var wf = m_reader.WaveFormat;
|
||||||
if (WaveFormatEncoding.Adpcm == wf.Encoding || WaveFormatEncoding.MuLaw == wf.Encoding) // 2 || 7
|
if (ConversionRequired.Contains (wf.Encoding))
|
||||||
{
|
{
|
||||||
var wav = WaveFormatConversionStream.CreatePcmStream (m_reader);
|
var wav = WaveFormatConversionStream.CreatePcmStream (m_reader);
|
||||||
wf = wav.WaveFormat;
|
wf = wav.WaveFormat;
|
||||||
|
Loading…
Reference in New Issue
Block a user