jakeHaasBlog / Fly-a-ray

A minimal old-school ray casting game
GNU General Public License v3.0
1 stars 0 forks source link

Added sound abstraction for looping and single fire sounds #4

Closed jakeHaasBlog closed 3 years ago

jakeHaasBlog commented 3 years ago

Added abstraction for 3D and 2D audio. Audio should now be set up using the Sound and LoopingSound classes. I decided to make two classes because there I can only think of two times you would want audio: an environmental sound effect or background music/ambiance. The Sound class holds a sound loaded from a file, the sound can be adjusted with its methods and "fired" so you can forget about it and it will play until the end. The LoopingAudio class has more methods that can adjust the sound while it's playing. All instances of LoopingAudio should be stored so the sound can be paused.

jakeHaasBlog commented 3 years ago

Should add documentation to the added classes

jakeHaasBlog commented 3 years ago

In case there is any curiosity, the problem with the sound was resolved by keeping a list of the sound handles and only deleting them after they stop playing.