Play multiple sounds using SoundPlayer

Mori picture Mori · Aug 16, 2009 · Viewed 21.2k times · Source

I'm making a sampler program where each key from 1 to 9 will make a different sound. Everything works fine, but when I press two (or more) sounds at the same time, the second one "kills" the first one.

I'm playing the sounds from .WAV files, using SoundPlayer. How can I solve this?

Answer

Robert Harvey picture Robert Harvey · Aug 16, 2009

You'll need to use DirectX (DirectSound) or some similar API that is designed to allow the playing of multiple sounds at the same time.