Master Audio Controls

Every game with sounds has at least one volume slider in the options, sometimes more.

I want to implement volume controls in my game but there appears to be no way to do this.

I have looked at Sound Classes which look great for setting up groups and default values, but there’s no way to access them in real-time to alter volume.

How do I implement global volume controls?

I’ve seen Rama’s name popup all over the place, this pack looks great, hopefully they can integrate some of the less niche nodes directly into the engine. “Victory Sound Volume Change” was exactly what I needed to solve my problem, thanks! (and thanks Rama)

if you are working in C++, you can use

SoundClassObject->Properties.Volume = NewVolumeFloat;

if you want a blueprint solution, Rama has some useful sound blueprint nodes in his VictoryPlugin. inside VictoryBPFunctionLibrary you can find VictorySoundVolumeChange and VictoryGetSoundVolume.

you can download his plugin here:

or discuss it here:

im not sure how well plugins work with android.

have you tried copying the functions into your own blueprint function library?

It works for windows, but not for Android, and I doubt IOS (untested because I can’t build for IOS)

I get this error:

clang++.exe: error: no such file or directory: 'C:/Program Files/Epic Games/4.8/Engine/Plugins/VictoryPlugin/Binaries/Android/UE4-VictoryBPLibrary-armv7-es2.a'

I don’t see how that will change anything, it will be the same functions looking for a nonexistent library under a new name.

Hey @Taisaku, this is almost a year old, but did you ever overcome the error you were receiving when packaging for android? I’m running into the exact same thing now and can’t seem to find a solution.

I added my own blueprint function library:

void UMyBlueprintFunctionLibrary::SetSoundClassVolume(FString a_className, float a_vol)
{
	FAudioDevice* Device = GEngine->GetMainAudioDevice();
	if (!Device)
	{
		return;
	}

	USoundClass* SoundClass = NULL;
	for (TMap<USoundClass*, FSoundClassProperties>::TIterator It(Device->SoundClasses); It; ++It)
	{
		USoundClass* ThisSoundClass = It.Key();
		if (ThisSoundClass && ThisSoundClass->GetFullName().Find(a_className) != INDEX_NONE)
		{
			SoundClass = ThisSoundClass;
			break;
		}
	}

	if (SoundClass)
	{
		SoundClass->Properties.Volume = a_vol;
	}
}
float UMyBlueprintFunctionLibrary::GetSoundClassVolume(FString a_className)
{
	FAudioDevice* Device = GEngine->GetMainAudioDevice();
	if (!Device)
	{
		return 0.0f;
	}

	USoundClass* SoundClass = NULL;
	for (TMap<USoundClass*, FSoundClassProperties>::TIterator It(Device->SoundClasses); It; ++It)
	{
		USoundClass* ThisSoundClass = It.Key();
		if (ThisSoundClass && ThisSoundClass->GetFullName().Find(a_className) != INDEX_NONE)
		{
			SoundClass = ThisSoundClass;
			break;
		}
	}

	if (SoundClass)
	{
		return SoundClass->Properties.Volume;
	}
	else
	{
		return 0.0f;
	}
}