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:
[l]ch_get_volume(id) and [l]ch_set_volume(id, volume) gets/sets a channel's volume. 100 is full volume.
[l]ch_get_global_volume() and [l]ch_set_global_volume(volume) gets/sets the global volume for all lch/chs. 100 is full volume.
[l]ch_size() and [l]ch_resize(size) gets/sets the total number of channels available. This starts off at 30 (and is configurable, and you can grow/shrink it.
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) andch
(non looped channels). Thelch
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. Thech
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, whileAudio::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 eitherlch
orch
. 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:[l]ch_get_volume(id)
and[l]ch_set_volume(id, volume)
gets/sets a channel's volume. 100 is full volume.[l]ch_get_global_volume()
and[l]ch_set_global_volume(volume)
gets/sets the global volume for alllch
/ch
s. 100 is full volume.[l]ch_size()
and[l]ch_resize(size)
gets/sets the total number of channels available. This starts off at 30 (and is configurable, and you can grow/shrink it.TODO write better documentation.