The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

Legacy talk:Actor (UT)/Functions

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 15:59, 13 February 2016 by SeriousBarbie (Talk | contribs) (convert sound variables to PlaySound parameters)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Convert sound variables to PlaySound parameters[edit]

I've found that the function parameters of PlaySound() differ from the variables usually used for sound. The definitions for ambient sound in Actor are

// Ambient sound.
var(Sound) byte         SoundRadius;	 // Radius of ambient sound.
var(Sound) byte         SoundVolume;	 // Volume of amient sound.
var(Sound) byte         SoundPitch;	 // Sound pitch shift, 64.0=none.

To use these variables in the function PlaySound they need to be scaled:

PlaySound(SoundToPlay, SlotForSound, SoundVolume / 128, SoundNoOverride, SoundRadius * 25, SoundPitch / 64);

(The factor 25 may have a variance of ca. 5%.) --SeriousBarbie (talk) 14:59, 13 February 2016 (EST)