예제 #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;
        }