public void Write(System.IO.Stream output)
{
BinaryWriter bw = new BinaryWriter(output);
BitStream bs = new BitStream(output);
bs.WriteBits(1, 0); // reserved
bs.WriteBits(1, 0); // reserved
bs.WriteBits(1, _syncstop ? 1 : 0);
bs.WriteBits(1, _syncnomultiple ? 1 : 0);
bs.WriteBits(1, _hasEnvelope ? 1 : 0);
bs.WriteBits(1, _hasLoops ? 1 : 0);
bs.WriteBits(1, _hasOutPoint ? 1 : 0);
bs.WriteBits(1, _hasInPoint ? 1 : 0);
if (_hasInPoint)
{
byte[] data = BitConverter.GetBytes(this._inPoint);
output.Write(data, 0, 4);
}
if (_hasOutPoint)
{
byte[] data = BitConverter.GetBytes(this._outPoint);
output.Write(data, 0, 4);
}
if (_hasLoops)
{
byte[] data = BitConverter.GetBytes(this._loopCount);
output.Write(data, 0, 2);
}
if (_hasEnvelope)
{
output.WriteByte(this._envelopePoints);
for (int i = 0; i < this._envelopePoints; i++)
_envelopeRecords[i].Write(output);
}
}