public static int BytesToSamples(int byteCount, NwCodec codec) { switch (codec) { case NwCodec.GcAdpcm: return(GcAdpcmMath.ByteCountToSampleCount(byteCount)); case NwCodec.Pcm16Bit: return(byteCount / 2); case NwCodec.Pcm8Bit: return(byteCount); default: return(0); } }
public static int SamplesToBytes(int sampleCount, NwCodec codec) { switch (codec) { case NwCodec.GcAdpcm: return(GcAdpcmMath.SampleCountToByteCount(sampleCount)); case NwCodec.Pcm16Bit: return(sampleCount * 2); case NwCodec.Pcm8Bit: return(sampleCount); default: return(0); } }
public static AudioFormat FromBxstm(NwCodec codec) { switch (codec) { case NwCodec.Pcm8Bit: return(AudioFormat.Pcm8); case NwCodec.Pcm16Bit: return(AudioFormat.Pcm16); case NwCodec.GcAdpcm: return(AudioFormat.GcAdpcm); case NwCodec.ImaAdpcm: return(AudioFormat.ImaAdpcm); default: throw new ArgumentOutOfRangeException(nameof(codec), codec, null); } }
/// <summary> /// Creates a new RSTMExporter instance that uses the given encoding when it has to re-encode a file. /// </summary> /// <param name="defaultEncoding">The encoding to use</param> public RSTMExporter(NwCodec defaultEncoding) { this.encoding = defaultEncoding; }
/// <summary> /// Creates a new FSTMExporter instance that uses the given encoding when it has to re-encode a file. /// </summary> /// <param name="defaultEncoding">The encoding to use</param> public FSTMExporter(NwCodec encoding, NwTarget target) { this.encoding = encoding; this.target = target; }