forked from bartvdbraak/blender
PyAPI Docs: Update aud example
Fixes T74641
This commit is contained in:
parent
4b74b35322
commit
817c38f715
@ -2,20 +2,20 @@
|
||||
Basic Sound Playback
|
||||
++++++++++++++++++++
|
||||
|
||||
This script shows how to use the classes: :class:`Device`, :class:`Factory` and
|
||||
This script shows how to use the classes: :class:`Device`, :class:`Sound` and
|
||||
:class:`Handle`.
|
||||
"""
|
||||
import aud
|
||||
|
||||
device = aud.device()
|
||||
device = aud.Device()
|
||||
# load sound file (it can be a video file with audio)
|
||||
factory = aud.Factory('music.ogg')
|
||||
sound = aud.Sound('music.ogg')
|
||||
|
||||
# play the audio, this return a handle to control play/pause
|
||||
handle = device.play(factory)
|
||||
handle = device.play(sound)
|
||||
# if the audio is not too big and will be used often you can buffer it
|
||||
factory_buffered = aud.Factory.buffer(factory)
|
||||
handle_buffered = device.play(factory_buffered)
|
||||
sound_buffered = aud.Sound.buffer(sound)
|
||||
handle_buffered = device.play(sound_buffered)
|
||||
|
||||
# stop the sounds (otherwise they play until their ends)
|
||||
handle.stop()
|
||||
|
Loading…
Reference in New Issue
Block a user