예제 #1
0
        public void FadeIn(WavePlayer fadein, double time)
        {
            var fadeInProvider = fadein._reader.ToSampleProvider();

            _mixer.RemoveInputStream(fadein._channels);
            var fadeInObject = new DelayFadeOutSampleProvider(fadeInProvider);
            var waveStream2  = new WaveProviderToWaveStream(fadeInObject.ToWaveProvider());

            fadein._channels = new WaveChannel32(waveStream2);
            _mixer.AddInputStream(fadein._channels);
            fadeInObject.BeginFadeIn(time);
        }
예제 #2
0
        private DelayFadeOutSampleProvider RemoveAddStreamsFromMixer(WavePlayer fadeout)
        {
            var fadeOutProvider = fadeout._reader.ToSampleProvider();

            _mixer.RemoveInputStream(fadeout._channels);
            var fadeOutObject = new DelayFadeOutSampleProvider(fadeOutProvider);
            var waveStream    = new WaveProviderToWaveStream(fadeOutObject.ToWaveProvider());

            fadeout._channels = new WaveChannel32(waveStream);
            _mixer.AddInputStream(fadeout._channels);
            return(fadeOutObject);
        }
예제 #3
0
        public void FadeInOut(WavePlayer fadein, WavePlayer fadeout, int milliSeconds)
        {
            var fadeInProvider  = fadein._reader.ToSampleProvider();
            var fadeOutProvider = fadeout._reader.ToSampleProvider();

            _mixer.RemoveInputStream(fadeout._channels);
            _mixer.RemoveInputStream(fadein._channels);

            var fadeOutObject = new FadeInOutSampleProvider(fadeOutProvider);
            var fadeInObject  = new FadeInOutSampleProvider(fadeInProvider);

            var waveStream  = new WaveProviderToWaveStream(fadeOutObject.ToWaveProvider());
            var waveStream2 = new WaveProviderToWaveStream(fadeInObject.ToWaveProvider());

            fadeout._channels = new WaveChannel32(waveStream);
            fadein._channels  = new WaveChannel32(waveStream2);

            _mixer.AddInputStream(fadeout._channels);
            _mixer.AddInputStream(fadein._channels);

            fadeOutObject.BeginFadeOut(milliSeconds);
            fadeInObject.BeginFadeIn(milliSeconds);
        }