播放声音时应用程序冻结 [英] application freeze while play sound

查看:84
本文介绍了播放声音时应用程序冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个基于窗口的vb.net应用程序.

在我的应用程序中,我添加了一个媒体播放器.
每当我播放声音时,我的应用程序就会在声音播放时冻结.

假设我有一个声音文件,持续时间为3秒,那么我的应用程序也冻结了3秒.

我还需要知道如何从资源播放.wav文件?

在此先感谢

Hi,

I have a window based vb.net application.

In my application I have added a media player.
Whenever I play a sound my application freezes while the sound plays.

Suppose I have a sound file for duration 3 sec then my application also freeze for 3 sec.

I also need to know how do I play .wav file from resources?

thanks in advance

推荐答案

打开一个新线程并在该线程中播放声音.
这样,处理您的GUI的线程就不会被阻塞.
Open a new thread and play the sound in that thread.
That way, the thread which handles your GUI won''t be blocked.


嘿,Kals84是您的第二个问题,该问题是关于从我发现的资源中播放.wav文件的
Hey Kals84 for your second question which is about playing .wav file from resources I found this [^] article might help you.


此处 [此处 [
Here[^] and here[^] may help.


这篇关于播放声音时应用程序冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆