   Win32:  Playing sounds without a delay ???
  I''ve been working on a simple pong clone lately and wanted to make it play a "bounce" sound whenever the ball bounces off a pad. I use MCI to play sounds (mciSendCommand MCI_OPEN, MCI_PLAY, MCI_CLOSE etc...) . But I soon noticed that whenever my ball hit the pad, it would appear to stick to it, be jumpy or choppy. The animation smoothed out when I removed the play sound function... appearantly, sending the play command slowed my program down, making the animations look choppy and poor...so, what''s a good alternative way of playing sounds quickly and efficiently? 
  i dunno about the MCI system that you''re using, but openAL is incrediably easy to setup and use.  I haven''t ever noticed any delays with animations or sound playing in that system.-me ;  I don''t know much about MCI either, but it seems like it''s a pretty poor choice for in-game use (judging from your description of how it performs). You might want to give DirectSound a try, or some other API. ;  im gunna vote for SDL. it rools for playing sounds (very easy to use) i found Fmod to be a little too complicated for my purposes. ;  Are you specifying your sound to sync with the program?  You want it to be asynchronus.When you play the sound synchronously, it stops your program until the sound is done.  If you play it asynchronusly, the sound goes ''in the background'' and continues to run the app while its being played.Could be a source of your problem. ;  I think all you need to include is windows.h and possibly link with winmm.libPlaySound("bounce.wav", NULL, SND_ASYNC|SND_NODEFAULT);Edit:I used that function to play the sound fx in a pong game that I made and there is no lag   [edited by - eFoDay on March 23, 2004 10:41:41 PM];  The problem is that somehow he needs to preload the sound. Windows is loading it in the play command, and as you can imagine, that''s not exactly fast.I don''t know how to preload stuff like that, unfortunately ;  MCI is very, very sluggish. It''s not the right choice for an interactive, asynchronous sound player.PlaySound is also not really that great.I suggest using an API that lets you pre-load the sounds to play, and then trigger them. OpenAL is one such library; DirectSound is another; FMOD, BASS, and a phletora of others also exist.The ideal API should have entry points to:1) initialize the sound system (say what sample rate to use, etc)2) pre-load a sound and give you some kind of handle to it3) start playing a sound, given a pre-loaded handle4) unload a sound handle when you will no longer need it (which is when you quit the program)That''s really it. More than that isn''t really necessary, and probably just complicates things. If you''re OK with the whole COM/DirectX thing, I suggest DirectSound (use static buffers for effects); else use OpenAL. ;  Thanks for all the replies! :DI''ll go with OpenAL cause I''m not using DirectX, just win32 (GDI and stuff)... ;quote:Original post by Koobazaur  Thanks for all the replies! :DI''ll go with OpenAL cause I''m not using DirectX, just win32 (GDI and stuff)...   If this is your first game, and it''s not really for commercial use, then might I suggest trying the PlaySound() function suggested above, before trying OpenAL?  I never had a problem with PlaySound() with simple games like this before.Obviously, learning OpenAL would be a good thing, but maybe concentrate solely on GDI and everything that comes with it first, before learning external libraries?Just a thought.-hellz 