Esempio n. 1
0
            public static wavFormat Read(BinaryReader reader)
            {
                wavFormat rv = new wavFormat();

                rv.read(reader);
                return(rv);
            }
Esempio n. 2
0
 private void clear()
 {
     header   = null;
     format   = null;
     data     = null;
     FileName = null;
     Name     = null;
 }
Esempio n. 3
0
 public Wav(Wav copy)
 {
     header       = new wavHeader(copy.header);
     format       = new wavFormat(copy.format);
     data         = new wavData(copy.data);
     OrigDuration = copy.OrigDuration;
     FileName     = copy.FileName;
     Name         = copy.Name;
 }
Esempio n. 4
0
 public wavFormat(wavFormat copy)
 {
     dwChunkSize      = copy.dwChunkSize;
     wFormatTag       = copy.wFormatTag;
     dwSamplesPerSec  = copy.dwSamplesPerSec;
     wChannels        = copy.wChannels;
     dwAvgBytesPerSec = copy.dwAvgBytesPerSec;
     wBlockAlign      = copy.wBlockAlign;
     wBitsPerSample   = copy.wBitsPerSample;
     fillBytes        = copy.fillBytes;
 }
Esempio n. 5
0
 public void Cat(Wav inputFile)
 {
     if (header == null)
     {
         header = new wavHeader(inputFile.header);
         format = new wavFormat(inputFile.format);
         data   = new wavData(inputFile.data);
     }
     else
     {
         data.Cat(inputFile);
     }
 }
Esempio n. 6
0
            public void Write(BinaryWriter writer, wavFormat format, wavData data)
            {
                calcLen(format, data);
                writer.Write(sGroupID.ToCharArray());
                writer.Write(dwFileLength);
                writer.Write(sRiffType.ToCharArray());

                // Write the format chunk
                format.Write(writer);

                // Write the data chunk
                data.Write(writer);
            }
Esempio n. 7
0
        public void Load(string filePath)
        {
            clear();
            FileName = filePath;
            Name     = Path.GetFileName(FileName);
            using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader reader = new BinaryReader(fileStream))
                {
                    // Read the header
                    header = wavHeader.Read(reader);

                    // Read the format chunk
                    format = wavFormat.Read(reader);

                    // Read the data chunk
                    data         = wavData.Read(reader);
                    OrigDuration = Duration;

                    reader.Close();
                }
                fileStream.Close();
            }
        }
Esempio n. 8
0
 private void calcLen(wavFormat format, wavData data)
 {
     dwFileLength = (uint)sRiffType.Length + format.getLength() + data.getLength();
 }