Volume/pitch control for client pawns.

I have a CAR pawn with a few UAudiocomponents:

image

I want to control the engine pitch and ambience sound pitch and volume related
with the speed of the car.

Thing is that it’s working on the server-client only and not in the client side.
I am using a timer inside the pawn defined in BeginPlay():

	GetWorldTimerManager().SetTimer(enginSoundHandle,this,&ACar_CPP::myEngineSound,.1f,true);

implementation:

void ACar_CPP::myEngineSound()
{
	float newPitchMult = UKismetMathLibrary::MapRangeClamped(
		ChaosMovementComponent->GetEngineRotationSpeed(),1200.f,4000.f,.5f,1.5f);

	if (myCarEngineSound) myCarEngineSound->SetPitchMultiplier(newPitchMult);

	if (mySfxAmbience)
	{
		const float  newVolMult = UKismetMathLibrary::MapRangeClamped(
		getForwardSpeed(),800.f,3000.f,0.f,1.f);
		newPitchMult = UKismetMathLibrary::MapRangeClamped(
		getForwardSpeed(),800.f,3000.f,.5f,1.f);
		mySfxAmbience->SetVolumeMultiplier(newVolMult);
		mySfxAmbience->SetPitchMultiplier(newPitchMult);
	}
}

I repeat. works perfect on the player that runs the server only.
Volume and pitch changes are not happening on the client-only players.

Any help?
Thanks!

Dany

1 Like

Same test but on blueprints:

server-player works fine
client-player doesnt change pitch at all.

also tried this on blueprints:

this in the pawn beginplay

image

image

in playerController:

image

the last multicast is calling the CPP original function.

not working…:frowning:

this doesnt works neither:

image

PlayerControlller: