This post is a portion of Part 10 in my on going series about 2D Game Development using the Allegro 5 library. These posts are in course order. You can see all of the posts in this course by clicking the “2D Game Development” button at the top of this site.
- 10.0 – It’s Finally Hear!
- 10.1 – Playing a Sample
- 10.2 – Playing Effects
- 10.3 – Sample Instances
The first video of Part 10. In this video we look at the ALLEGRO_SAMPLE variable type. We also see how to load audio samples and play them using audio addon function in Allegro 5.
Full source can be found here.

I get this error:
al_play_sample: Assertion `spl’ failed
Also a warning that doesn’t occur in other source files:
./PlaySample.cpp:18:7: warning: variable ‘keys’ set but not used [-Wunused-but-set-variable]