Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
 /// <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;
 }