ControllerState
in package
implements
ControllerStateInterface
Representation of the current state of a controller.
Table of Contents
Interfaces
- ControllerStateInterface
- Representation of the current state of a controller.
Properties
- $crossfade : bool
- $position : TimeInterface
- $repeat : bool
- $shuffle : bool
- $speakers : array<string, int>
- $state : PlayState
- $stream : Stream|null
- $track : int
- $tracks : array<string|int, TrackInterface>
Methods
- __construct() : mixed
- Create a ControllerState object.
- getCrossfade() : bool
- Check if crossfade is currently active.
- getPosition() : TimeInterface
- Get the position of the currently active track.
- getRepeat() : bool
- Check if repeat is currently active.
- getShuffle() : bool
- Check if shuffle is currently active.
- getSpeakers() : array<string, int>
- Get the speakers that are in the group of this controller.
- getState() : PlayState
- Get the playing mode of the controller.
- getStream() : Stream|null
- Get the stream this controller is using.
- getTrack() : int
- Get the number of the active track in the queue
- getTracks() : array<string|int, TrackInterface>
- Get the tracks that are in the queue.
- setState() : $this
- Set the playing mode of the controller.
- applyMode() : $this
- Get the current playing mode (repeat/shuffle/etc).
- applyState() : $this
- Get the current playing attributes (stream/position/etc).
- applyTracks() : $this
- Get the current tracks in the queue.
- applyVolume() : $this
- Get the current volume of all the speakers in this group.
Properties
$crossfade
private
bool
$crossfade
Whether crossfade is currently active.
$position
private
TimeInterface
$position
The position of the currently active track.
$repeat
private
bool
$repeat
Whether repeat mode is currently active.
$shuffle
private
bool
$shuffle
Whether shuffle is currently active.
$speakers
private
array<string, int>
$speakers
The volume of each speaker.
$state
private
PlayState
$state
$stream
private
Stream|null
$stream
= null
A stream object (if the controller is currently streaming).
$track
private
int
$track
The zero-based number of the track in the queue.
$tracks
private
array<string|int, TrackInterface>
$tracks
An array of tracks from the queue.
Methods
__construct()
Create a ControllerState object.
public
__construct(ControllerInterface $controller) : mixed
Parameters
- $controller : ControllerInterface
-
The Controller to grab the state of
getCrossfade()
Check if crossfade is currently active.
public
getCrossfade() : bool
Return values
boolgetPosition()
Get the position of the currently active track.
public
getPosition() : TimeInterface
Return values
TimeInterfacegetRepeat()
Check if repeat is currently active.
public
getRepeat() : bool
Return values
boolgetShuffle()
Check if shuffle is currently active.
public
getShuffle() : bool
Return values
boolgetSpeakers()
Get the speakers that are in the group of this controller.
public
getSpeakers() : array<string, int>
Return values
array<string, int>getState()
Get the playing mode of the controller.
public
getState() : PlayState
Return values
PlayStategetStream()
Get the stream this controller is using.
public
getStream() : Stream|null
Return values
Stream|nullgetTrack()
Get the number of the active track in the queue
public
getTrack() : int
Return values
int —The zero-based number of the track in the queue
getTracks()
Get the tracks that are in the queue.
public
getTracks() : array<string|int, TrackInterface>
Return values
array<string|int, TrackInterface>setState()
Set the playing mode of the controller.
public
setState(PlayState $state) : $this
Parameters
- $state : PlayState
Return values
$thisapplyMode()
Get the current playing mode (repeat/shuffle/etc).
private
applyMode(ControllerInterface $controller) : $this
Parameters
- $controller : ControllerInterface
-
The Controller to grab the state of
Return values
$thisapplyState()
Get the current playing attributes (stream/position/etc).
private
applyState(ControllerInterface $controller) : $this
Parameters
- $controller : ControllerInterface
-
The Controller to grab the state of
Return values
$thisapplyTracks()
Get the current tracks in the queue.
private
applyTracks(ControllerInterface $controller) : $this
Parameters
- $controller : ControllerInterface
-
The Controller to grab the state of
Return values
$thisapplyVolume()
Get the current volume of all the speakers in this group.
private
applyVolume(ControllerInterface $controller) : $this
Parameters
- $controller : ControllerInterface
-
The Controller to grab the state of