开发者

System.Media.SoundPlayer, Playing more than 1 sound?

开发者 https://www.devze.com 2023-03-22 23:38 出处:网络
Is there a way to play more than one sound while let\'s say the background music is going? The way I have it is:

Is there a way to play more than one sound while let's say the background music is going?

The way I have it is:

    public static void PlaySound(string filename)
    {
        SoundPlayer player = new SoundPlayer();
        player.SoundLocation = filename;
        player.Play();
    }

Which will play one sound, but using the same "PlaySound"开发者_StackOverflow it will basically stop the last sound played and just start a new thread playing the new sound. Is there a way to actually stop this and play more than one sound(s)?


Take a look at:

Play multiple sounds using SoundPlayer n-c-net

Note the solution with mciSendString at the bottom.

0

精彩评论

暂无评论...
验证码 换一张
取 消