如何使用C#连续2次运行音频

问题描述:



我有一个函数,其中我将传递我的音频文件路径作为参数,然后播放音频文件. Nw我的疑问是如何使用C#连续播放2次tat音频文件.

我们有play()和playlooping(),但是play只运行一次音频文件,而playlooping会重复运行音频文件,但是现在我需要将音频文件运行两次或三次.

Hi,

I have a function, in which i''ll pass my audio file path as parameter and will play the audio file. Nw my doubt is how can i play tat audio file for 2 times continuously using C#.

We have play() and playlooping() but play will run the audio file only once and playlooping will run the audio file repeatedly but nw i need to run the audio file for twice or thrice.

public void mysound(string pat)
        {
            m = "C:\\WINDOWS\\Media\\ringin.wav";
            anno.SoundLocation =pat ;
                anno.Play();
        }




谁能帮我这个忙.
请尽快给我打电话
在此先感谢




Can anyone help me on this.
Pls rply me fast
Thanks in advance

aswinrajkumar写道:
aswinrajkumar wrote:

我需要运行音频文件两次或三次

i need to run the audio file for twice or thrice


为什么不按照需要将其放入2或3的循环中?


Why not just put that in a loop of 2 or 3 as required?


我们可以,但它会同时播放,但我需要先一步完成.
We can, but it will play simultaneously but i need tat to be done one after another.


您实际上可以运行一个简单的循环来播放声音两次,然后退出循环.
You could actually run a simple loop to play the sound twice and then break out of the loop.