I'm making a pong game where a boop sound is played whenever the ball collides with the paddle. For some reason, I get an error when playing the sound.
ALLEGRO_SAMPLE*boopSound=al_load_sample("boop.wav"); ALLEGRO_PLAYMODE noLoop=ALLEGRO_PLAYMODE_ONCE; ALLEGRO_SAMPLE_ID sampleID; ... al_play_sample(boopSound,255,127,1200,noLoop, &sampleID);
any thoughts on why this isn't working?
Check that boopSound isn't NULL. Check if you initialized the acodec addon.
Thanks for the reply. I didn't initialized the acodec addon. However, now that I've added "al_init_acodec_addon()", no sound plays when the program runs (I did check to see if boopSound was null).
Your parameters are wrong. They should be 1.0, 0.0, 1.0. Check the docs.
Figured out the problem - I was looking at an outdated guide. Here's the new code:
al_play_sample(boopSound,1.0,ALLEGRO_AUDIO_PAN_NONE,1.0,noLoop, &sampleID);
EDIT: I see now Matthew responded with the fix; a belated thanks for your help Matthew