Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Voice.Volume to be a persistent volume for the Voice itself. Fix #2976 #2978

Merged

Conversation

CodeLeopard
Copy link
Contributor

Voice.Volume is now independent of the currently playing Note's volume.
This is done by adding a private variable to hold the volume as it was specified by the sound or note being played, leaving Voice.Volume to be the volume for the Voice itself.
Both volume values are multiplied together to get the final volume for the sound.

Fixes #2976

Example script:

Local v0 to GetVoice(0).
Set v0:loop to False.

Local softNote is Note(440, 1, 1, 0.5).
Local loudNote is Note(440, 1, 1, 1).

Local Function PlayNotes
{
	Print("Playing soft note...").
	v0:Play(softNote).
	wait softNote:duration.
	Print("Voice volume is now: " + v0:Volume).

	Print("Playing loud note...").
	v0:Play(loudNote).
	wait loudNote:duration.
	Print("Voice volume is now: " + v0:Volume).
}

Until false {
	Set v0:volume to 1.
	Print("Set Voice:Volume to: " + v0:Volume).

	PlayNotes().

	set v0:volume to 0.5.
	Print("Set Voice:Volume to: " + v0:Volume).

	PlayNotes().

	wait 0.5.
}

@Dunbaratu Dunbaratu merged commit 8e5b5ec into KSP-KOS:develop Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SKID voice volume is always clobbered by PLAY, making it meaningless.
2 participants