x

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"

SpawnSoundAttached - IsAudibleSimple location problem

Hi,

I'm trying to play simple SoundCue. But sometimes it is not working. I debugged code and I think found the problem.

When I calling SpawnSoundAttached with KeepRelativeOffset IsAudibleSimple returning false and my sound is not playing.

 // Location used to check whether to create a component if out of range
     FVector TestLocation = Location;
     if (LocationType != EAttachLocation::KeepWorldPosition)
     {
         TestLocation = AttachToComponent->GetRelativeTransform().TransformPosition(Location);
     }
 
     UAudioComponent* AudioComponent = FAudioDevice::CreateComponent(Sound, AttachToComponent->GetWorld(), AttachToComponent->GetOwner(), false, bStopWhenAttachedToDestroyed, &TestLocation, AttenuationSettings);
     if (AudioComponent)
     {

Here you can see, FAudioDevice::CreateComponent getting Relative TestLocation instead of World and inside this function "IsAudibleSimple" calling with RelativeLocation instead of WorldLocation.

I hope explained well because of my english.

Thanks

Product Version: UE 4.9
Tags:
more ▼

asked Nov 09 '15 at 10:38 AM in Bug Reports

avatar image

MSTF
131 8 15 138

avatar image Doug E ♦♦ STAFF Nov 09 '15 at 04:50 PM

Hey MSTF-

Just so I understand clearly, is the issue that the sound isn't playing or that it is not being played in the correct location? Is the code you posted part of the source or is it your own code? Where is this being called from? Are you able to reproduce the issue in a new project without additional content? If so can you post the steps that reproduced this for you?

Cheers

Doug Wilson

avatar image MSTF Nov 09 '15 at 04:57 PM

Sorry for bad clarification. Yes you are correct.

Sound playing in correct location but you cannot hear it sometimes in correct location.

The code is part of UGameplayStatics::SpawnSoundAttached

You can repoduce this error with steps;

  1. Spawn PlayerController/Character at location something big like 50000x50000x50000

  2. Try play sound via SpawnSoundAttached and attach to Mesh of Character with KeepRelativeOffset

And you cannot hear the sound.

avatar image MSTF Nov 09 '15 at 05:22 PM

Oh I forgot important thing. Your Sound duration should be less than 1 seconds. If your sound greater than 1seconds it is working fine because IsAudible forcing to true if duration greater than 1seconds :)

So when you testing try it with short sounds :)

Thanks

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

1 answer: sort voted first

Hey MSTF,

So running some test with your set up, I think I found the source of your issue. I was able to reproduce what you are reporting, using the Spawn Sound Attached node in blueprints at the location 50,000x50,000x50,000, and playing a sound less than 1 second.

Be sure your sound does not have attenuation settings applied (Untick Attenuate). See the below images for reference.

Non-Attenuating Sound

alt text

Spawn Player Controller

alt text

Play Sound Attached

alt text

As soon as I checked the 'Attenuate' option on the Sound Cue I am unable to hear the sound upon pressing play in my level. However, if I uncheck 'Attenuate' within the 'Sound Cue', the sound plays just fine.

Cheers,

Andrew Hurley

more ▼

answered Nov 11 '15 at 04:46 PM

(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