コード例 #1
0
 /// <summary>
 /// Creates a new BlockAlignReductionStream
 /// </summary>
 /// <param name="sourceStream">the input stream</param>
 public BlockAlignReductionStream(WaveStream sourceStream)
 {
     this.sourceStream = sourceStream;
     circularBuffer = new CircularBuffer(sourceStream.WaveFormat.AverageBytesPerSecond * 4);
 }
コード例 #2
0
        /// <summary>
        /// Adds samples. Takes a copy of buffer, so that buffer can be reused if necessary
        /// </summary>
        public void AddSamples(byte[] buffer, int offset, int count)
        {
            // create buffer here to allow user to customise buffer length
            if (circularBuffer == null)
            {
                circularBuffer = new CircularBuffer(this.BufferLength);
            }

            var written = circularBuffer.Write(buffer, offset, count);
            if (written < count && !DiscardOnBufferOverflow)
            {
                throw new InvalidOperationException("Buffer full");
            }
        }