Astrabit-ST / ModShot-Core

A fork of mkxp, forked for OneShot, forked for OneShot mods, (not to be confused with the ModShot server)
https://nowaffles.com
GNU General Public License v2.0
19 stars 9 forks source link

Audio channels #36

Closed rkevin-arch closed 3 years ago

rkevin-arch commented 3 years ago

Note this is verified to compile (on linux) but I haven't tested this yet. Please test before merging. I'm also not sure about the ramifications of having so many idle threads and whether this would cause performance regressions or not, you should test that.

This PR adds audio channels to the Audio module. There are 2 types of channels, lch (looped channels) and ch (non looped channels). The lch channels behave nearly the same as BGM/BGS, except it's not affected by any BGM/BGS/ME/SE, or the overall BGM volume, and each have their own volume/effects controls. The ch channels behave similarly, except audio played on them is not looped.

You should be able to access audio channels using their channel IDs, which start at 0. For example, Audio::bgm_play(filename) plays the audio on the BGM stream, while Audio::lch_play(0, filename) plays the audio on the LCH stream number 0.

The full list of exposed functions is available here, where #entity is either lch or ch. Most functions take in the channel ID as the first argument, and the rest is the same as their equivalent BGM/BGS functions. The exceptions include:

TODO write better documentation.