public WavFormat(int SamplesPerSecond = 44100, int BitsPerSample = 16, int Channels = 1, WaveFormatType WaveFormat = WaveFormatType.Pcm) { this.SamplesPerSecond = SamplesPerSecond; this.BitsPerSample = BitsPerSample; this.Channels = Channels; this.WaveFormat = WaveFormat; }
public AudioFormatEx(WaveFormatType format, int channels, int bitsPerSample, int samplesPerSecond) { this._format = format; this._channels = channels; this._bitsPerSample = bitsPerSample; this._samplesPerSecond = samplesPerSecond; }
internal AudioFormat (int bitsPerSample, int channels, int samplesPerSecond, WaveFormatType waveFormat) { this.bitsPerSample = bitsPerSample; this.channels = channels; this.samplesPerSecond = samplesPerSecond; this.waveFormat = waveFormat; }
internal AudioFormat(int bitsPerSample, int channels, int samplesPerSecond, WaveFormatType waveFormat) { this.bitsPerSample = bitsPerSample; this.channels = channels; this.samplesPerSecond = samplesPerSecond; this.waveFormat = waveFormat; }
public static WavParser GetParser(WaveFormatType type) { switch (type) { case WaveFormatType.Pcm: return(new PcmParser()); case WaveFormatType.DviAdpcm: return(new DviAdpcmParser()); default: throw new NotSupportedException("Invalid or unknown .wav compression format!"); } }
public static RawAudioEncoding ToRawAudioEncoding(this WaveFormatType self) { switch (self) { case WaveFormatType.Pcm: return(RawAudioEncoding.LinearPcm); default: return(RawAudioEncoding.Unknown); } }
/// <summary> /// Read data. /// </summary> /// <param name="br">The reader.</param> public override void ReadData(BinaryDataReader br) { //Read data. WaveFormat = (WaveFormatType)br.ReadUInt16(); NumChannels = br.ReadUInt16(); SampleRate = br.ReadUInt32(); br.ReadUInt32(); //Byte rate. br.ReadUInt16(); //Block align. BitsPerSample = br.ReadUInt16(); //Extra parameters. if (WaveFormat == WaveFormatType.DSPADPCM) { //Read extra data. br.ReadUInt16(); //Extra data. br.ReadUInt16(); //Padding. br.ReadUInt16(); //Unknown. br.ReadUInt16(); //Padding. DspAdpcmNumSamples = br.ReadUInt32(); //Foreach channel. ChannelInfo = new List <DspAdpcmInfo>(); for (int i = 0; i < NumChannels; i++) { DspAdpcmInfo d = new DspAdpcmInfo(); d.coefs = new short[8][]; for (int j = 0; j < 8; j++) { d.coefs[j] = br.ReadInt16s(2); } br.ReadUInt16(); //Padding. d.pred_scale = br.ReadUInt16(); d.yn1 = br.ReadInt16(); d.yn2 = br.ReadInt16(); d.loop_pred_scale = br.ReadUInt16(); d.loop_yn1 = br.ReadInt16(); d.loop_yn2 = br.ReadInt16(); ChannelInfo.Add(d); } //Read the last part. br.ReadUInt16(); //Unknown. } }