Inheritance: IAudioEncodingProperties, IMediaEncodingProperties
        public void SetEncodingProperties(AudioEncodingProperties encodingProperties)
        {
            currentEncodingProperties = encodingProperties;

            // Create and initialize the echo array
            echoBuffer = new float[encodingProperties.SampleRate]; // exactly one second delay
            currentActiveSampleIndex = 0;
        }
Ejemplo n.º 2
0
        protected StreamSourceBase(AudioEncodingProperties encodingProperties)
        {
            if (null == encodingProperties)
                throw new ArgumentNullException("encodingProperties");

            _encodingProperties = encodingProperties;

            var bytesPerSecond = _encodingProperties.BitsPerSample / 8 * _encodingProperties.SampleRate * _encodingProperties.ChannelCount;

            var bufferSize = bytesPerSecond / 4;

            if (0 != (bufferSize & 1))
                bufferSize += 1;

            _bufferSize = (int)bufferSize;

            _bufferDuration = TimeSpan.FromTicks((bufferSize * (10L * 1000 * 1000) + bytesPerSecond / 2) / bytesPerSecond);

            _samplesPerBuffer = bufferSize / (_encodingProperties.ChannelCount * _encodingProperties.BitsPerSample / 8);
        }