我想使用CSCore.Streams.FadeInOut类,它包含在CSCore-图书馆中。我想淡入和淡出我播放的歌曲。但我不知道怎么用。有人知道吗?
发布于 2014-05-11 10:56:37
正如您已经提到的,您可以使用FadeInOut类。请查看此示例:
IWaveSource source = CodecFactory.Instance.GetCodec(@"C:\Temp\test.mp3");
using (var fadeInOut = new FadeInOut(source, 1.0f))
{
using (var soundOut = new WasapiOut())
{
soundOut.Initialize(fadeInOut.ToWaveSource());
soundOut.Play();
Thread.Sleep(1000);
fadeInOut.StartFading(2, 0.0f); //reduce the volume to 0.0f over 2 seconds
Thread.Sleep(3000);
fadeInOut.StopFading(); //stop fading
fadeInOut.StartFading(2, 1.0f); //fade the volume to 1.0f over 2 seconds
Console.ReadKey();
}
}https://stackoverflow.com/questions/23591476
复制相似问题