简体   繁体   中英

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

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" 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 nc-net

Note the solution with mciSendString at the bottom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM