Skip to content

Commit bc2dd1f

Browse files
author
Roberto De Ioris
authored
Create Audio_API.md
1 parent 08da606 commit bc2dd1f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/Audio_API.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# The Audio API
2+
3+
The uobject.play_sound_at_location(sound, position[, volume_multiplier, pitch_multiplier, start_time]) api method is exposed:
4+
5+
```py
6+
# get a reference to asound
7+
sound = ue.find_object('my_sound')
8+
# play the sound at position 0,0,0
9+
self.uobject.play_sound_at_location(sound, FVector(0, 0, 0))
10+
```
11+
12+
If you prefer to work with AudioComponent:
13+
14+
```py
15+
class Sounder:
16+
def begin_play(self):
17+
# find the AudioComponent of this actor
18+
self.audio = self.uobject.get_component_by_type('AudioComponent')
19+
self.audio.call('Stop')
20+
def tick(self, delta_time):
21+
# start the sound when pressing 'A'
22+
if self.uobject.is_input_key_down('A'):
23+
self.audio.call('Play')
24+
```

0 commit comments

Comments
 (0)