pyunity.audio module¶
Classes to manage the playback of audio.
It uses the sdl2.sdlmixer library.
A variable in the config
module called
audio
will be set to False
if the
mixer module cannot be initialized.
-
pyunity.audio.
mixer
¶
-
class
pyunity.audio.
AudioClip
(path)[source]¶ Bases:
object
Class to store information about an audio file.
-
music
¶ Sound chunk that can be played with an SDL2 Mixer Channel. Only set when the AudioClip is played in an
AudioSource
.Type: sdl2.sdlmixer.mixer.Mix_Chunk
-
-
class
pyunity.audio.
AudioSource
(transform)[source]¶ Bases:
pyunity.core.Component
Manages playback on an AudioSource.
-
SetClip
(clip)[source]¶ Sets a clip for the AudioSource to play.
Parameters: clip (AudioClip) – AudioClip to play
-
Playing
¶ Gets if the AudioSource is playing.
-
-
class
pyunity.audio.
AudioListener
(transform)[source]¶ Bases:
pyunity.core.Component
Class to receive audio events and to base spatial sound from. By default the Main Camera has an AudioListener, but you can also remove it and add a new one to another GameObject in a Scene. There can only be one AudioListener, otherwise sound is disabled.