DirectSound Behavior Quirk
No replies to this topic
Crossbones+ - Reputation: 1673
Posted 23 February 2000 - 02:32 AM
This post is not primarily a question, I just wanted to tell everyone about the strange behavior I was just having with DirectSound. I''d also like to hear if anyone has had a similar experience or perhaps if i''ve just ignored some issue I wasn''t aware of. Here''s the deal: I was playing DirectSound buffers, and with 2 of my 3 sounds, they would only play ONCE and then all subsequent calls to play would do nothing ... they would return DS_OK but they would NOT make sound. Necessary information: I was (and am) reseting the current position of the sound to 0, before EVERY call to play, reguardless of the state of the buffer. I also tested playing the sound again both while it was playing and well after it had stopped, no difference. I then removed the first sound (the one that worked), both it''s creation and use, and the other two STILL did not work right. I then opened SoundRecorder and ensured that ALL three sounds matched my primary buffer (22,050 Hz, 16 bit, mono) and the DID ... so still no reason for the behavior. Additional Info: I am on a Win98 SE machine, coding to DirectX 6 SDK, DirectX 7 runtime installed, using an Aureal Vortex 1 based sound card in one test rig, an el cheapo sound card in another (same behavior on both). MY FIX: when I force called Stop() on the sound buffer prior to calling Play() (so the order is now Stop(), SetCurrentPosition(), Play() ... ) the sound works right for all three sounds buffers. SUMMARY: So if you have a DirectSoundBuffer silently (correct return code) failing to play, you might try stopping it first. Good Luck.