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 crossfading and effects #23

Closed rkevin-arch closed 3 years ago

rkevin-arch commented 3 years ago

THIS IS A DRAFT PR. DO NOT MERGE YET.

This PR adds audio crossfading, custom audio filters, OpenAL filters and effects. All of the following would work on BGM, BGS and ME (not SE) unless stated otherwise.

It adds the following APIs to the Audio module:

The ALEffect ruby module has been added, and you can create different types of AL effects using it. For example, to construct a EAXReverb effect and set the density attribute, do:

effect = ALEffect::EAXReverb.new
effect.density = 1

For a list of all possible effects and their attributes, check out binding-mri/aleffect-binding.cpp for now. For a list of what the attributes mean, consult the OpenAL Effects Extension Guide (you can ask for a copy in the ModShot discord).

There's also a list of presets for EAXReverb type effects. Check binding-mri/aleffect-binding.cpp for a list of them. To load a preset (such as the dizzy preset), do the following:

effect = ALEffect::EAXReverb.new
effect.load_preset_dizzy
# you may further modify the preset if you wish before using it

The following enhancements are added:

Other things that sneaked into this PR:

This PR has a lot of non trivial changes. We should probably test this for a while and see if it causes any issues before actually merging it. Please run ModShot with the ALSOFT_LOGLEVEL=3 environment variable and log any OpenAL errors that may occur.

See also: #19.

rkevin-arch commented 3 years ago

ALFilters and ALEffects both work on SE. If you mean custom filters, it's difficult to do since a custom filter only applies until the sound stops. I'd have to think of a different way to implement it.

Speak2Erase commented 3 years ago

Ok, that's fine.

Speak2Erase commented 3 years ago

Can I merge this?