Пример #1
0
        public WaveReader(string file)
        {
            Riff = new WavRiff();
            Fmt = new WavFmt();
            Data = new WavData();

            reader = new BinaryReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read));

            ReadHeader();
        }
Пример #2
0
        public WaveReader(string file)
        {
            Riff = new WavRiff();
            Fmt  = new WavFmt();
            Data = new WavData();

            reader = new BinaryReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read));

            ReadHeader();
        }
Пример #3
0
        public WaveWriter(string file, ushort channels, ushort sample_bits, uint sample_rate)
        {
            writer = new BinaryWriter(new FileStream(file, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite));

            Riff = new WavRiff();
            Riff.RiffType = "WAVE";

            Fmt = new WavFmt();
            Fmt.AvgBytesPerSec = 176400;
            Fmt.BlockAlign =(ushort) (channels * 2);
            Fmt.FormatTag = 1;
            Fmt.ChunkSize = 16;

            // User configuration:
            Fmt.Channels = channels;
            Fmt.BitsPerSample = sample_bits;
            Fmt.SamplesPerSec = sample_rate;

            Data = new WavData();
            Data.NumSamples = 0;
        }
Пример #4
0
        public WaveWriter(string file, ushort channels, ushort sample_bits, uint sample_rate)
        {
            writer = new BinaryWriter(new FileStream(file, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite));

            Riff          = new WavRiff();
            Riff.RiffType = "WAVE";

            Fmt = new WavFmt();
            Fmt.AvgBytesPerSec = 176400;
            Fmt.BlockAlign     = (ushort)(channels * 2);
            Fmt.FormatTag      = 1;
            Fmt.ChunkSize      = 16;

            // User configuration:
            Fmt.Channels      = channels;
            Fmt.BitsPerSample = sample_bits;
            Fmt.SamplesPerSec = sample_rate;

            Data            = new WavData();
            Data.NumSamples = 0;
        }