Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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;

Product Version: UE 4.19
more ▼

asked Sep 30 '18 at 11:48 PM in C++ Programming

avatar image

25 1 3 9

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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:

https://github.com/EpicGames/UnrealEngine/blob/08ee319f80ef47dbf0988e14b546b65214838ec4/Engine/Source/Runtime/Engine/Classes/Sound/AmbientSound.h https://github.com/EpicGames/UnrealEngine/blob/08ee319f80ef47dbf0988e14b546b65214838ec4/Engine/Source/Runtime/Engine/Private/AmbientSound.cpp

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

more ▼

answered Oct 05 '18 at 11:11 PM

avatar image

35.2k 921 166 1098

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question