예제 #1
0
 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;
 }
예제 #2
0
 public AudioFormatEx(WaveFormatType format, int channels, int bitsPerSample, int samplesPerSecond)
 {
     this._format = format;
     this._channels = channels;
     this._bitsPerSample = bitsPerSample;
     this._samplesPerSecond = samplesPerSecond;
 }
예제 #3
0
파일: AudioFormat.cs 프로젝트: dfr0/moon
		internal AudioFormat (int bitsPerSample,
				      int channels,
				      int samplesPerSecond,
				      WaveFormatType waveFormat)
		{
			this.bitsPerSample = bitsPerSample;
			this.channels = channels;
			this.samplesPerSecond = samplesPerSecond;
			this.waveFormat = waveFormat;
		}
예제 #4
0
 internal AudioFormat(int bitsPerSample,
                      int channels,
                      int samplesPerSecond,
                      WaveFormatType waveFormat)
 {
     this.bitsPerSample    = bitsPerSample;
     this.channels         = channels;
     this.samplesPerSecond = samplesPerSecond;
     this.waveFormat       = waveFormat;
 }
예제 #5
0
        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!");
            }
        }
예제 #6
0
        public static RawAudioEncoding ToRawAudioEncoding(this WaveFormatType self)
        {
            switch (self)
            {
            case WaveFormatType.Pcm:
                return(RawAudioEncoding.LinearPcm);

            default:
                return(RawAudioEncoding.Unknown);
            }
        }
예제 #7
0
        /// <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.
            }
        }