Esempio n. 1
0
        public MidiObject(BinaryReader reader)
        {
            var first = true;

            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                try
                {
                    var chunk = new Chunk(reader);
                    if (first && chunk.ChunkType == Chunk.Type.Header)
                    {
                        Header = (HeaderChunkData)chunk.Data;
                    }
                    else
                    {
                        _tracks.Add((TrackChunkData)chunk.Data);
                    }
                }
                catch (Exception e)
                {
                    throw new MidiParseException(e.Message, new MidiObject(Header, _tracks));
                }
            }
        }
Esempio n. 2
0
 private MidiObject(HeaderChunkData header, List <TrackChunkData> tracks)
 {
     Header  = header;
     _tracks = tracks;
 }