   making a sound play only once (until it ends)
  The code I use to play my segment is this:m_pPerformance->PlaySegmentEx(m_pSegment, 0, NULL, DMUS_SEGF_SECONDARY, 0, 0, NULL, NULL); The problem is I've assigned the sound to play on a mouse move where I check certain circumstances (whether the mouse cursor lies within a ball on the screen). It seems that the sound plays a few (2-3 times) before the check for the IsPlaying function kicks in. This I can hear because I've also assigned a button to play the sound. When I use the button you can hear the sound with a (relatively) low volume, playing only once. When I use the mouse move event to trigger the sound the volume is louder and a faint echo can't be distinguished. I've tried bypassing the IsPlaying method with a static bool like this:    static bool bSoundPlays = false;...if (m_vBalls[i].TouchInside(cursorX, cursorY, cursorSize) && !m_cSounds[1].IsPlaying() && !bSoundPlays) {  m_cSounds[1].Play();  bSoundPlays = true;}else {  bSoundPlays = false;}but I still get the same effect. Can anyone help me please?edit: during the playing of one sound I want to be able to play another sound, just not the same one (same "instance").[edited by - moucard on June 7, 2004 10:45:02 AM][edited by - moucard on June 7, 2004 10:45:55 AM]
  this may not be helpful to you, but it may as well. for real-time crisp sound you''re going to need to tackle direct sound.other than having to work with a sound buffer its not much more difficult and its performance is such that you''ll have less issues with it in the long run. its also worth mentioning that the interface of DSound allows alot more control of the actual sound played without any recognizable performance issues.All of that said, i see nothing wrong with your logical construct so the problem must lie elsewhere.   Dredd________________________________________"To die with your sword still in its sheath is most regrettable" -- Miyomoto Musashi ;  I'm using Direct Sound, am I not? I mean in DX9 the interfaces to Direct Sound and Direct Music are united. If you look at the code snippet on the third line (not thebut the [code]) you'll see that I'm using a DirectSound interface. [edited by - moucard on June 7, 2004 12:52:48 PM]