Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

multiple sounds w/o conflicts

Feb 13, 2007 10:10AM PST

using System.Media;

namespace x
{
public class Form1 : Form
{
private SoundPlayer player;
void soundSamp1_click
{
player = new SoundPlayer(Properties.Resources.one);
player.Play();
}
void soundSamp2_click
{
player = new SoundPlayer(Properties.Resources.two);
player.Play();
}

--ok, it keeps giving me static garbage sound when i try to play the other sound while the other is currently playing...
--besides just using player.PlaySync(), what other options are there to make the sound more stable/not comflict and create a static sound.

Discussion is locked

- Collapse -
Wild guess.
Feb 13, 2007 11:13AM PST

Add player.LoadAsync() to just before player.Play()

Bob

- Collapse -
bad code
Feb 13, 2007 12:40PM PST

i guess it ended up being a really long if statement that somehow played the sound at the very very end of the if statement...? i fixed that by half and it seems to be working w/o error...

- Collapse -
What if statement?
Feb 14, 2007 12:06AM PST

I didn't see that in your code so I looked at what it could be.

Bob