mixer.Stream
pykraken.mixer.Stream A streaming audio resource intended for long music files.
More about mixer.Stream
Streams occupy exactly one track while active. They are protected and
will not be stolen by incoming :class:Sample requests.
Attributes
- playback_pos (
float) — (Read-only) Current playback position in seconds. - looping (
bool) — Whether the stream should loop when it reaches the end.
Methods
pause(): Pause playback, preserving position. resume(fade_in=0.0): Resume playback from a paused state. seek(seconds): Jump to a specific time in the audio file.
Inherits Audio
At a glance
10 membersReference
PYTHON APIConstructor
methodmixer.Stream(/, *args, **kwargs)Initialize self. See help(type(self)) for accurate signature.
looping
propertylooping: boolWhether the stream should loop when it reaches the end.
playback_pos
propertyplayback_pos: floatCurrent position in seconds. 0.0 if stopped/never played, paused position if paused.
playing
propertyplaying: boolTrue if currently playing.
volume
propertyvolume: floatVolume scalar (0.0 to 1.0).
pause
methodpause(self) -> NonePause playback. Releases the hardware track but preserves position.
play
methodplay(self, fade_in: float = 0.0) -> NoneStart audio playback.
Args
- fade_in (
float) — Fade in duration in seconds. Defaults to 0.0.
resume
methodresume(self, fade_in: float = 0.0) -> NoneResume playback from a paused state.
Args
- fade_in (
float) — Duration in seconds to fade back in. Defaults to 0.0.
seek
methodseek(self, seconds: float) -> NoneJump to a specific time in the audio file.
Args
- seconds (
float) — Target position in seconds from the start.
stop
methodstop(self, fade_out: float = 0.0) -> NoneStop all playing instances of this audio.
Args
- fade_out (
float) — Fade out duration in seconds. Defaults to 0.0.