Ejemplo n.º 1
0
float USdkboxFyberListener::_setMasterVolume(float Volume)
{
	FAudioDevice* AudioDevice = GEngine->GetMainAudioDevice();
	if (!AudioDevice)
		return -1;

	float previousVolume = -1;
	for (auto i = AudioDevice->SoundClasses.CreateIterator(); i; ++i)
	{
		USoundClass* SoundClass = i.Key();
		FString SoundClassName;

		// Test if the Split function works then, if the name was the right one
		if (SoundClass->GetFullName().Split(L".", nullptr, &SoundClassName, ESearchCase::CaseSensitive) && SoundClassName.Equals("Master"))
		{
			previousVolume = SoundClass->Properties.Volume;
			SoundClass->Properties.Volume = Volume;
			break;
		}
	}

	//UE_LOG(SDKBOX, Warning, TEXT("previousVolume: %.02f"), previousVolume);

	return previousVolume;
}
Ejemplo n.º 2
0
void SoundManager::SetEffects(bool enable){
  FAudioDevice* Device = GEngine->GetMainAudioDevice();
  if (!Device)
    return;
  for (TMap<USoundClass*, FSoundClassProperties>::TIterator It(Device->SoundClasses); It; ++It){
    USoundClass* SoundClass = It.Key();
    if (SoundClass && SoundClass->GetFullName().Find("SFX") != INDEX_NONE){
      SoundClass->Properties.Volume = enable ? 1.f : 0.f;
    }
  }
}