Quick help with audio
Jason Marmon

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.

al_play_sample(boopSound,255,127,1200,noLoop, &sampleID);

any thoughts on why this isn't working?

Trent Gamblin

Check that boopSound isn't NULL. Check if you initialized the acodec addon.

Jason Marmon

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).

Matthew Leverton

Your parameters are wrong. They should be 1.0, 0.0, 1.0. Check the docs.

Jason Marmon

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 :)

Thread #611930. Printed from Allegro.cc