如何在 Windows Mobile 6.0 中连续播放 .wav 文件而不重叠?

发布于 2024-10-09 19:44:34 字数 103 浏览 0 评论 0原文

我正在开发一个应用程序,需要一个接一个地播放 .wav 声音文件。要播放声音,这就是我正在做的事情。

声音 sound = new Sound(路径); 声音.Play();

I am developing an app which requires to play .wav sound file one after the other.To play a sound, this is what I am doing.

Sound sound = new Sound(path);
sound.Play();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白况 2024-10-16 19:44:34

如果您使用的是 .NET CF 3.5,则可以使用 System.Media.SoundPlayer 并通过 PlaySync() 命令同步播放声音。

例如:

string path = "\\Program Files\\SNAP.App.CE\\Content\\5LongLow.wav";
System.Media.SoundPlayer player = new System.Media.SoundPlayer(path);
player.PlaySync();
player.PlaySync();

这在当前线程中播放,如果您愿意,也可以将其放在自己的线程中以允许UI线程继续。

如果您使用旧版本的 .NET CF,唯一的方法是播放声音,然后在提交下一个要播放的声音之前在线程上休眠“正确”的时间。

If you are using .NET CF 3.5 you can use System.Media.SoundPlayer and play the sounds synchronously with the PlaySync() command.

For example:

string path = "\\Program Files\\SNAP.App.CE\\Content\\5LongLow.wav";
System.Media.SoundPlayer player = new System.Media.SoundPlayer(path);
player.PlaySync();
player.PlaySync();

This plays in the current thread, if you want you can also put it in its own thread to allow the UI thread to continue.

If you are using an older version of .NET CF the only way to do it is to play the sound, and then sleep on the thread for the "right" amount of time before submitting the next sound to play.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文