コード例 #1
0
 public HeaderChunk(FormatChunk formatChunk, DataChunk dataChunk)
 {
     ChunkId     = "RIFF".ToCharArray();
     RiffType    = "WAVE".ToCharArray();
     FormatChunk = formatChunk;
     DataChunk   = dataChunk;
     ChunkSize   = 36 + DataChunk.ChunkSize;
 }
コード例 #2
0
        // Returns a byte array in the Wave file format containing the given
        // text in morse code
        public byte[] ConvertToMorse(string text)
        {
            DataChunk   data        = GetText(text.ToLower());
            FormatChunk formatChunk = new FormatChunk();
            HeaderChunk headerChunk = new HeaderChunk(formatChunk, data);

            return(headerChunk.ToBytes());
        }
コード例 #3
0
        public override byte[] ToBytes()
        {
            List <byte> bytes = new List <byte>();

            bytes.AddRange(Encoding.UTF8.GetBytes(ChunkId));
            bytes.AddRange(BitConverter.GetBytes(ChunkSize));
            bytes.AddRange(Encoding.UTF8.GetBytes(RiffType));
            bytes.AddRange(FormatChunk.ToBytes());
            bytes.AddRange(DataChunk.ToBytes());

            return(bytes.ToArray <byte>());
        }