earwax.track module¶
Provides the Track class.
-
class
earwax.track.
Track
(protocol: str, path: str, track_type: earwax.track.TrackTypes)¶ Bases:
object
A looping sound or piece of music.
A track that plays while a
earwax.Level
object is top of the levels stack.Variables: - protocol – The
protocol
argument to pass tosynthizer.StreamingGenerator``
. - path – The
path
argument to pass tosynthizer.StreamingGenerator
. - track_type –
The type of this track.
This value determines which sound manager an instance will be connected to.
- sound –
The currently playing sound instance.
This value is initialised as part of the
play()
method.
-
classmethod
from_path
(path: pathlib.Path, type: earwax.track.TrackTypes) → earwax.track.Track¶ Return a new instance from a path.
Parameters: - path –
The path to build the track from.
If this value is a directory, a random file will be selected.
- type – The type of the new track.
- path –
-
play
(manager: earwax.sound.SoundManager, **kwargs) → None¶ Play this track on a loop.
Parameters: - manager – The sound manager to play through.
- kwargs – The extra keyword arguments to send to the given
manager’s
play_stream()
method.
-
stop
() → None¶ Stop this track playing.
- protocol – The
-
class
earwax.track.
TrackTypes
¶ Bases:
enum.Enum
The type of a
Track
instance.Variables: - ambiance –
An ambiance which will never moved, such as the background sound for a map.
This type should not be confused with the
earwax.Ambiance
class, which describes an ambiance which can be moved around the sound field. - music – A piece of background music.
-
ambiance
= 0¶
-
music
= 1¶
- ambiance –