如何在C#WPF项目中使用SharpDX DirectSound播放.wav文件?

时间:2022-03-24 01:38:07

I want to be able to precisely control the timing of .wav files played in my program. I also want to be able to play more than one .wav file at the same time. The SoundPlayer was not good enough because I can't play two sounds at once, and even when I play different sounds consecutively, there is about a 1/8th second delay between each sound, which is unacceptable for what I am doing. I cannot find a way to add a Device using SharpDX.

我希望能够精确控制程序中播放的.wav文件的时间。我还希望能够同时播放多个.wav文件。 SoundPlayer不够好,因为我不能同时播放两种声音,即使我连续播放不同的声音,每种声音之间也会有大约1/8秒的延迟,这对我正在做的事情来说是不可接受的。我找不到使用SharpDX添加设备的方法。

1 个解决方案

#1


0  

You have a directsound sample in sharpdx, should get you started.

你有一个diredound样本在sharpdx,应该让你开始。

Also you can have a look at NAudio , which should also fit your needs and be a bit easier to use.

您还可以看看NAudio,它也应该符合您的需求并且更容易使用。

#1


0  

You have a directsound sample in sharpdx, should get you started.

你有一个diredound样本在sharpdx,应该让你开始。

Also you can have a look at NAudio , which should also fit your needs and be a bit easier to use.

您还可以看看NAudio,它也应该符合您的需求并且更容易使用。