public void Write(AudioBuffer buff)
{
if (!inited)
{
if (_IO == null)
_IO = new FileStream(_path, FileMode.Create, FileAccess.Write, FileShare.Read);
int header_size = flake_encode_init();
_IO.Write(header, 0, header_size);
if (_IO.CanSeek)
first_frame_offset = _IO.Position;
inited = true;
}
buff.Prepare(this);
int pos = 0;
while (pos < buff.Length)
{
int block = Math.Min(buff.Length - pos, eparams.block_size - samplesInBuffer);
copy_samples(buff.Samples, pos, block);
pos += block;
while (samplesInBuffer >= eparams.block_size)
output_frame();
}
if (md5 != null)
md5.TransformBlock(buff.Bytes, 0, buff.ByteLength, null, 0);
}