Creates or overwrites a wav file. Writing to the file and finalizing the header is done on a seperate thread. Input is cached in a ring buffer, and written in chunks of size AudioSettings.dspBufferSize. Note: this class is lockless.
Inheritance: IDisposable
Example #1
0
        /// <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);
        }
Example #2
0
        /// <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 );
        }