/// <summary> /// Constructor for IO. I would usually think to consider the Stream as the /// Input type, however the BinaryReader exposes the owning stream. /// </summary> /// <param name="br">System.IO.BinaryReader</param> public smf_mthd(BinaryReader br, params smf_mtrk[] tracks) { bHead = br.ReadBytes(4); size = EndianUtil.Reverse(br.ReadBytes(4)); fmt = EndianUtil.Reverse(br.ReadBytes(2)); ntk = EndianUtil.Reverse(br.ReadBytes(2)); div = EndianUtil.Reverse(br.ReadBytes(2)); Tracks = tracks; //tk = br.ReadBytes(4); }
/// <summary> /// read the track's bytes; Doesn't parse the track though. /// </summary> /// <param name="bi"></param> public smf_mtrk(BinaryReader bi) { title = bi.ReadChars(4); size = EndianUtil.Reverse(bi.ReadBytes(4)); track = bi.ReadBytes(BitConverter.ToInt32(size, 0)); }