how to use "AAmbientSound" c++

how to use “AAmbientSound” c++

I want to load my audio from c ++


in the case of “USoundBase” I do it this way

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Sound)
class USoundBase* PlaySound;

static ConstructorHelpers::FObjectFinder<USoundBase> SonidoPlay(TEXT("/Game/Sounds/PlaySound.PlaySound"));
//PlaySound = SonidoPlay.Object;

if (PlaySound != NULL)
	UGameplayStatics::PlaySoundAtLocation(this, PlaySound, GetActorLocation());

I do not know how to reproduce the sounds of an “AAmbientSound”

what I want is to stop a sound at runtime, my “AAmbientSound”:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Sound)
	class AAmbientSound* AmbientSound;

AAmbientSound is just dummy actor for UAudioComponent, so to reproduce you it only need to create actor with UAudioComponent. Main role of this actor to easily place sound on the level, each component that use artistic asset has dummy actor like that just for that. There really no need to use AAmbientSound in C++ or else you really just want to spawn actor that only and exclusively play sound

If you have case like this don’t be shy to look in to engine source code:

For stop sound you have Stop function in both actor and AAmbientSound and UAudioComponent