/// <summary>
/// Starts writing the stream at precise dspTime if one is specified.
/// If no dspTime is specified, or if the specified dspTime is too soon,
/// starts writing asap.
/// If recNumFrames is specified, writing will automatically stop
/// once the precise number of frames has been written, else you should call
/// EndWriting.
/// </summary>
public void StartWriting(double targetDspTime = 0d, int recNumFrames = -1)
{
if (_writing)
{
return;
}
_recFixedFrames = recNumFrames;
_writtenFrames = 0;
_waiting = true;
_targetDspTime = targetDspTime;
_writer = new GATAsyncWavWriter(_absPath, _stream.NbOfChannels, true);
_writer.PrepareToWrite();
_stream.AddAudioThreadStreamClient(this);
}