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
This video ties all of Part 10 together with the inclusion of the ALLEGRO_SAMPLE_INSTANCE variable. This variable allows us to do a lot more with our audio, and it allows us to have a more rich and featured game experience.
Full source can be found here.
omg it took me like an hour to figure out why my sample instance is not playing :O
-i forgot to call the al_play_sample_instance() function xD
I got a question. All those imput/output patterns and organizations being taught in your videos, used by allegro – and from my experience, also in SDL – are the standard way that IO functions are handled? Is there some kind of standard model like for example C# and Java being OOP languages? Anyway, thanks for taking your time with these videos, they are really helpful.
The % is not shown on the program because % its the escape character. In order to get it on the screen you just need to place it twice like this: %%.
Hello everybody!
I’m realy gettin difficults when i put sound on the explosions of the spaceship game. The sound works good when destroying only one asteroid, but when you destroy more than one almost at the same time, there’s a lag in the sound, and sometimes the sound just does not work.
I’ve read the allegro mannual, but neither of those functins fixed the problem.
I’m using instance sounds.
Thanks!!! And, again, great tutorials!
Looking at 14.3 – Audio, I fixed the problem: I was putting the audio sample in the function “InitExplosion”, and that’s why I got lags.
I was using instance, but I change it to simple samples, only using instances for background song.
Problem solved!
Awesome! Good job!