/// <summary>Writes the MThd header out to the stream.</summary> /// <param name="outputStream">The stream to which the header should be written.</param> public void Write(Stream outputStream) { // Validate the stream if (outputStream == null) { throw new ArgumentNullException("outputStream"); } if (!outputStream.CanWrite) { throw new ArgumentException("Cannot write to stream.", "outputStream"); } // Write out the main header _header.Write(outputStream); // Add format outputStream.WriteByte((byte)((_format & 0xFF00) >> 8)); outputStream.WriteByte((byte)(_format & 0x00FF)); // Add numTracks outputStream.WriteByte((byte)((_numTracks & 0xFF00) >> 8)); outputStream.WriteByte((byte)(_numTracks & 0x00FF)); // Add division outputStream.WriteByte((byte)((_division & 0xFF00) >> 8)); outputStream.WriteByte((byte)(_division & 0x00FF)); }
/// <summary>Writes the track header out to the stream.</summary> /// <param name="outputStream">The stream to which the header should be written.</param> public void Write(Stream outputStream) { // Validate the stream if (outputStream == null) { throw new ArgumentNullException("outputStream"); } if (!outputStream.CanWrite) { throw new ArgumentException("Cannot write to stream.", "outputStream"); } // Write out the main header followed by all of the data _header.Write(outputStream); if (_data != null) { outputStream.Write(_data, 0, _data.Length); } }