[Feature suggestion] Frame-linked audio visual indicator & Audioclip volume

Started by Laura Hunt, Mon 25/01/2021 21:05:06

Previous topic - Next topic

Crimson Wizard

Quote from: eri0o on Tue 26/04/2022 16:22:56
Is it possible to simply change how things work and have the volume percentage of the type be multiplied by the other volume, so we can have in game volume sliders for the player to configure, while also being able to play sounds at different volumes, without scripting such mixing system?

Yes, indeed, it's possible to make all engine's volume "sliders" relative; and maybe even worth to do this in 3.6.0 (with backward compatible mode).

However, that does not fix anything for the animation sounds; the problem remains:
* you cannot control single character's volume using a sound type volume, because that sound type may be shared among many things in game, and you might want individual volume for this particular character.
* there's no explicit way to tell on which channel particular character's animation frame is played.
* even if there were a way to access such channel, it may be too late, as the frame sound is started not by the script but by the engine during its internal update, and when the script runs it may be already playing, so setting volume in script will affect the playback a moment later.

The channel access problem is still a problem even with the proposed solution for animation volume, so this will have to be addressed anyway at some point. Maybe revamping sound system to have control over playback instances rather than channels will make this easier to manage.

Quote from: eri0o on Tue 26/04/2022 16:22:56
With the proposed addition, we have more volumes to track in the scripted system, and the functions need to be extended to use a different one that will apply a relative audio volume.

Not at all; the proposed AnimationVolume is supposed to be relative to the sound clip's starting volume, which is taken from the sound type volume. In other words, AnimationVolume will be a factor combined with a AudioType's Volume factor.

The way I see this, the future audio system may be consisting of several levels, for example:

Sound emitter's volume (emitter = object spreading sound) -> Playback instance volume -> Global audio volumes (per type, etc).

If all of these are relative, then this system will work well, you'll have global sliders, and a way to adjust individual game elements too.

eri0o

Yes, having the behavior being relative, so we get the final volume as a multiplication of the volumes (1.0 being 100%) type and the specific clip would be very helpful!

Regarding the character, would panning or sound location be a thing that makes sense? Or better to save for later - like if we have the concept of sound emitter.

Crimson Wizard

Quote from: eri0o on Tue 26/04/2022 18:05:53
Yes, having the behavior being relative, so we get the final volume as a multiplication of the volumes (1.0 being 100%) type and the specific clip would be very helpful!


I suppose, that it should normally work like this:

AudioChannel.Volume is a % of -----> Audio Type volume, which is a % of ------> System.Volume
(and default clip's volume assigns the initial AudioChannel.Volume)

Right now AudioChannel.Volume and Audio Type volume are basically same absolute units, and setting them would override each other in a playing clip.

eri0o

Yes, the relationship you wrote is what I had in mind. If we assume volume goes from 0.0 to 1.0 range, we simply multiply all of these to get the final volume.

This will be great, because then we can simply use the types to provide say a sound effect, a music and an ambient sound slider. And the character stepping sound can be like a sound effect or ambient or even it's own type, so we can control the volume in a relative way.

Crimson Wizard

If anyone likes to try out, here's an experimental build containing Character.AnimationVolume, and extra "volume" parameter in all Animate() functions (for Character, Object and Button):
https://cirrus-ci.com/task/5930020521639936

An example of use:
Code: ags

function repeatedly_execute() {
    player.AnimationVolume = (player.x * 100) / Room.Width;
}

will scale volume of player's animation (like, footsteps) depending on its X position in the room.

Crimson Wizard

So, both indicator and the way to change animation's volume are now in the latest 3.6.0 beta.


SMF spam blocked by CleanTalk