Categories
Uncategorized

Finishing refactoring and implementing audio

Hi all, this week, I finally finished refactoring the code and feeling a bit adventurous, I went on and started work on implementing the last remaining subsystem – audio. In this blog post, I would like to detail to some extent what has been implemented in the audio subsystem and what is left to do.

A short introduction to the audio subsystem

CRAB utilized the SDL2_Mixer library previously, to play the background music and the various sound effects. Before reaching the main menu, the engine initializes the audio subsystem during which all the sound effects are read into memory. On the other hand, the background music files are only read as per need and are “decoded on demand“. It should be noted that the audio subsystem “fades-in” the background music, i.e., it starts playing the background music at silence and then gradually increases the volume to normal.

The audio subsystem also allows one to set the volume of sound effects and music channels independently according to their own taste.

The process of porting

Initially, I found the task to be daunting because I have never been able to fully grasp the different terms and concepts related to digital audio. I went through the documentation of SDL2_Mixer, and once I had a basic idea, I tried figuring out what equivalents were there in ScummVM code.

Decoders for both the OGG and WAV files were already present which saved me a lot of effort. Additionally, the mixer class seemed to fulfil most of my requirements. I did encounter a bunch of crashes at first and after a bit of trial and error, I was able to get both music and sound effects to work!

In the upcoming week, I’ll try implementing the “fade-in” effect of the background music and the ability to set the volume for the sound effects and background music. Thanks for reading!

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *