Worst-case scenario: the UEd Goblin wipes the map and burns down your house.
UE2:Actor native functions (UT2004)/Audio functions
Contents
Sound playback[edit]
DemoPlaySound[edit]
Internal function to records sounds when recording demos. "Replicates" sound playback to the DemoRecSpectator. You shouldn't have to call this directly as it is automatically called by PlaySound and PlayOwnedSound when a demo is being recorded locally.
GetSoundDuration[edit]
Returns the length of a sound in real seconds, i.e. not scaled by Level.TimeDilation.
PlayOwnedSound[edit]
Plays a sound locally. When called on a server, the sound is played locally and broadcasted to all clients that could possibly hear the sound, except to the client owning the actor. Clientsidely this function just plays the sound.
The idea behind this selective broadcasting is that the client knows when to play the sound through its own simulation code. This makes it easier to e.g. synchronize sounds to the animations of the selected weapon.
- Parameters
- See PlaySound. The only difference is that Attenuate defaults to False because this function's main use is for playing sounds of the selected weapon and other player inventory.
PlaySound[edit]
Plays a sound, optionally with additional parameters like volume and sound pitch.
This is the only function where it matters where it was called from: Serversidely PlaySound determines whether it should broadcast the sound playback to all clients by examinating whether it was called from a simulated function. If it was, the sound will only be played locally for a listen server or serverside demorecording. If the calling function does not have the simulated modifier, the sound is broadcasted to all players that could potentially hear the sound. Clientsidely this function just plays the sound.
- Parameters
- Sound - the sound to play. Could also be a SoundGroup or ProceduralSound.
- Slot - a sound slot to play the sound in. Only one sound can play per actor and slot. Never use SLOT_Ambient here, use the AmbientSound property instead. Defaults to SLOT_Misc if omitted.
- Volume - the volume to play the sound at. Defaults to TransientSoundVolume. If the actor has an Instigator that owns the actor or if the Actor is its own Instigator, the volume is scaled by the Instigator's SoundDampening value.
- bNoOverride - prevents the sound from being overridden by later sounds being played in the same sound slot of the same actor. Defaults to False.
- Radius - overrides the sound's default radius. Defaults to TransientSoundRadius if omitted. If zero, the sound's default radius.
- Pitch - overrides the playback pitch of the sound. Values greater than 1.0 speed up the sound and make it sound higher, values less than 1.0 make it slower and sound deeper. Defaults to 1.0 if omitted.
- Attenuate - whether to use 3D positional playback for the player owning the actor playing the sound. Defaults to True. Specifying False has no effect if the actor is not owned by the player hearing the sound. For replicated sounds this only has an effect if the actor playing the sound is relevant to the client.
Music playback[edit]
AdjustVolume[edit]
Sets the volume of the stream identified by the handle value.
AllowMusicPlayback[edit]
Changes whether regular game music should be played. Used by the music player to disable map music while playing custom music. Does not affect stream music.
PauseStream[edit]
Pauses the music stream specified by the handle value.
PlayMusic[edit]
Creates a new game music track and starts playing the specified song through it. Returns a handle value for the track, which can be used to stop only this music track with StopMusic().
PlayStream[edit]
Creates a new music stream and starts playing it. Returns a handle value for the stream, which can be used to pause or stop the playback or change the volume.
SeekStream[edit]
Sets a new playback position on the music stream identified by the handle value.
StopAllMusic[edit]
Stops all game music tracks currently playing.
StopMusic[edit]
Stops the game music track identified by the handle value.
StopStream[edit]
Stops the stream music track identified by the handle value.
Text-to-speech[edit]
TextToSpeech[edit]
Used the operating system's text-to-speech system (if available) to synthesize voice output.
- Parameters
- Text - the text to speak.
- Volume - the output volume.