我正在播放 wav 文件作为 dotnet 中的用户提示。我的代码在笔记本电脑上运行良好,但似乎在上网本上跳过了声音。如何确保 dotnet 上网本上的 wav 播放是一致的?在上网本中导致偶尔播放问题的当前代码:
using (var player = new SoundPlayer(pSoundPath))
{
player.Play();
}
当我将声音预加载到字典中以按声音名称调用时,同样的问题:
Dictionary<string, SoundPlayer> playerDict = new Dictionary<string, SoundPlayer>();
playerDict.Add(soundName, new SoundPlayer(soundPath));
playerDict[soundname].LoadAsync();