private int phasePos;                           // number of bytes that the phase have read

        /// <summary>
        /// Creates a new Loop stream
        /// </summary>
        /// <param name="sound">The stream to read from. Note: the Read method of this stream should return 0 when it reaches the end
        /// or else we will not loop to the start again.</param>
        ///
        public InterferenceStream(CachedSoundWaveProvider sound)
        {
            this.sound = sound;
            this.phase = 2;
            delayBytes = (int)(new TimeSpan(0, 0, 3).TotalSeconds *WaveFormat.SampleRate) * WaveFormat.BitsPerSample * WaveFormat.Channels / 8;
            phasePos   = 0;
        }
Exemple #2
0
        public SpeechStream(CachedSoundWaveProvider sound, CachedSoundWaveProvider spSound)
            : this(sound)
        {
            this.spSound = spSound;
            this.phase   = 0;

            if (spSound != null)
            {
                if (sound.WaveFormat.Encoding != spSound.WaveFormat.Encoding)
                {
                    throw new ArgumentException("All inputs must have the same format");
                }
            }
        }
 public InterferenceStream(CachedSoundWaveProvider cachedSound, CachedSoundWaveProvider spCachedSound)
     : this(cachedSound)
 {
     this.spByteLength = (int)(spCachedSound.TotalTime.TotalSeconds * WaveFormat.SampleRate) * WaveFormat.BitsPerSample * WaveFormat.Channels / 8;;
     this.phase        = 0;
 }