1

我正在播放 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();
4

1 回答 1

0

也许给 Player 一个专用的更高优先级的线程可能会有所帮助。异步!=并行。可能是异步调用正在与您的前台工作竞争处理器时间。

于 2010-12-13T19:21:12.573 回答