ControllerInterface
extends
SpeakerInterface
in
Allows interaction with the groups of speakers.
Although sometimes a Controller is synonymous with a Speaker, when speakers are grouped together only the coordinator can receive events (play/pause/etc)
Table of Contents
Methods
- addSpeaker() : $this
- Adds the specified speaker to the group of this Controller.
- adjustVolume() : $this
- Adjust the volume of this speaker by a relative amount.
- exportState() : ControllerStateInterface
- Grab the current state of the Controller (including it's queue and playing attributes).
- getBass() : int
- Get the bass equalisation level.
- getCrossfade() : bool
- Check if crossfade is currently active.
- getGroup() : string
- Get the uuid of the group this speaker is a member of.
- getIndicator() : bool
- Check whether the indicator light is on or not.
- getIp() : string
- Get the IP address of this speaker.
- getLoudness() : bool
- Check whether loudness normalisation is on or not.
- getMediaInfo() : array<string, string>
- Get the currently active media info.
- getMode() : array<string, bool>
- Get the current play mode settings.
- getName() : string
- Get the "Friendly" name of this speaker.
- getQueue() : QueueInterface
- Get the queue for this controller.
- getRepeat() : bool
- Check if repeat is currently active.
- getRoom() : string
- Get the room name of this speaker.
- getShuffle() : bool
- Check if shuffle is currently active.
- getSpeakers() : array<string|int, SpeakerInterface>
- Get the speakers that are in the group of this controller.
- getState() : PlayState
- Get the current state of the group of speakers.
- getStateDetails() : StateInterface
- Get attributes about the currently active track in the queue.
- getStateName() : string
- Get the current state of the group of speakers as the string reported by sonos: PLAYING, PAUSED_PLAYBACK, etc
- getTreble() : int
- Get the treble equalisation level.
- getUuid() : string
- Get the uuid of this speaker.
- getVolume() : int
- Get the current volume of this speaker.
- interrupt() : $this
- Interrupt the current audio with a track.
- isCoordinator() : bool
- Check if this speaker is the coordinator of it's current group.
- isMuted() : bool
- Check if this speaker is currently muted.
- isStreaming() : bool
- Check if this controller is currently playing a stream.
- isUsingQueue() : bool
- Check if this controller is currently using its queue.
- mute() : $this
- Mute this speaker.
- next() : self
- Skip to the next track in the current queue.
- pause() : self
- Pause the group.
- play() : self
- Start playing the active music for this group.
- previous() : self
- Skip back to the previous track in the current queue.
- removeSpeaker() : $this
- Removes the specified speaker from the group of this Controller.
- restoreState() : $this
- Restore the Controller to a previously exported state.
- seek() : $this
- Seeks to a specific position within the current track.
- selectTrack() : $this
- Skip to the specific track in the current queue.
- setBass() : $this
- Set the bass equalisation.
- setCrossfade() : $this
- Turn crossfade on or off.
- setGroup() : void
- Set which group this speaker belongs to.
- setIndicator() : $this
- Turn the indicator light on or off.
- setLoudness() : $this
- Set whether loudness normalisation is on or not.
- setMode() : $this
- Set the current play mode settings.
- setRepeat() : $this
- Turn repeat mode on or off.
- setShuffle() : $this
- Turn shuffle mode on or off.
- setState() : self
- Set the state of the group.
- setTreble() : $this
- Set the treble equalisation.
- setVolume() : $this
- Adjust the volume of this speaker to a specific value.
- unmute() : $this
- Unmute this speaker.
- updateGroup() : void
- Remove any previously established group for this speaker.
- useLineIn() : $this
- Play a line-in from a speaker.
- useQueue() : $this
- Set this controller to use its queue (rather than a stream).
- useStream() : $this
- Play a stream on this controller.
Methods
addSpeaker()
Adds the specified speaker to the group of this Controller.
public
addSpeaker(SpeakerInterface $speaker) : $this
Parameters
- $speaker : SpeakerInterface
-
The speaker to add to the group
Return values
$thisadjustVolume()
Adjust the volume of this speaker by a relative amount.
public
adjustVolume(int $adjust) : $this
Parameters
- $adjust : int
-
The amount to adjust by between -100 and 100
Return values
$thisexportState()
Grab the current state of the Controller (including it's queue and playing attributes).
public
exportState([bool $pause = true ]) : ControllerStateInterface
Parameters
- $pause : bool = true
-
Whether to pause the controller or not
Return values
ControllerStateInterfacegetBass()
Get the bass equalisation level.
public
getBass() : int
Return values
intgetCrossfade()
Check if crossfade is currently active.
public
getCrossfade() : bool
Return values
boolgetGroup()
Get the uuid of the group this speaker is a member of.
public
getGroup() : string
Tags
Return values
stringgetIndicator()
Check whether the indicator light is on or not.
public
getIndicator() : bool
Return values
boolgetIp()
Get the IP address of this speaker.
public
getIp() : string
Return values
stringgetLoudness()
Check whether loudness normalisation is on or not.
public
getLoudness() : bool
Return values
boolgetMediaInfo()
Get the currently active media info.
public
getMediaInfo() : array<string, string>
Return values
array<string, string>getMode()
Get the current play mode settings.
public
getMode() : array<string, bool>
Return values
array<string, bool> —An array with 2 elements (shuffle and repeat)
getName()
Get the "Friendly" name of this speaker.
public
getName() : string
Return values
stringgetQueue()
Get the queue for this controller.
public
getQueue() : QueueInterface
Return values
QueueInterfacegetRepeat()
Check if repeat is currently active.
public
getRepeat() : bool
Return values
boolgetRoom()
Get the room name of this speaker.
public
getRoom() : string
Return values
stringgetShuffle()
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, SpeakerInterface>
Return values
array<string|int, SpeakerInterface>getState()
Get the current state of the group of speakers.
public
getState() : PlayState
Return values
PlayStategetStateDetails()
Get attributes about the currently active track in the queue.
public
getStateDetails() : StateInterface
Return values
StateInterfacegetStateName()
Get the current state of the group of speakers as the string reported by sonos: PLAYING, PAUSED_PLAYBACK, etc
public
getStateName() : string
Return values
stringgetTreble()
Get the treble equalisation level.
public
getTreble() : int
Return values
intgetUuid()
Get the uuid of this speaker.
public
getUuid() : string
Return values
stringgetVolume()
Get the current volume of this speaker.
public
getVolume() : int
Return values
intinterrupt()
Interrupt the current audio with a track.
public
interrupt(UriInterface $track[, int|null $volume = null ]) : $this
The current state of the controller is stored, the passed track is played, and then when it has finished the previous state of the controller is restored. This is useful for making announcements over the Sonos network.
Parameters
- $track : UriInterface
-
The track to play
- $volume : int|null = null
-
The volume to play the track at
Return values
$thisisCoordinator()
Check if this speaker is the coordinator of it's current group.
public
isCoordinator() : bool
Return values
boolisMuted()
Check if this speaker is currently muted.
public
isMuted() : bool
Return values
boolisStreaming()
Check if this controller is currently playing a stream.
public
isStreaming() : bool
Return values
boolisUsingQueue()
Check if this controller is currently using its queue.
public
isUsingQueue() : bool
Return values
boolmute()
Mute this speaker.
public
mute([bool $mute = true ]) : $this
Parameters
- $mute : bool = true
-
Whether the speaker should be muted or not
Return values
$thisnext()
Skip to the next track in the current queue.
public
next() : self
Return values
selfpause()
Pause the group.
public
pause() : self
Return values
selfplay()
Start playing the active music for this group.
public
play() : self
Return values
selfprevious()
Skip back to the previous track in the current queue.
public
previous() : self
Return values
selfremoveSpeaker()
Removes the specified speaker from the group of this Controller.
public
removeSpeaker(SpeakerInterface $speaker) : $this
Parameters
- $speaker : SpeakerInterface
-
The speaker to remove from the group
Return values
$thisrestoreState()
Restore the Controller to a previously exported state.
public
restoreState(ControllerStateInterface $state) : $this
Parameters
- $state : ControllerStateInterface
-
The state to be restored
Return values
$thisseek()
Seeks to a specific position within the current track.
public
seek(TimeInterface $position) : $this
Parameters
- $position : TimeInterface
-
The position to seek to in the track
Return values
$thisselectTrack()
Skip to the specific track in the current queue.
public
selectTrack(int $position) : $this
Parameters
- $position : int
-
The zero-based position of the track to skip to
Return values
$thissetBass()
Set the bass equalisation.
public
setBass(int $bass) : $this
Parameters
- $bass : int
-
The bass level (between -10 and 10)
Return values
$thissetCrossfade()
Turn crossfade on or off.
public
setCrossfade(bool $crossfade) : $this
Parameters
- $crossfade : bool
-
Whether crossfade should be on or not
Return values
$thissetGroup()
Set which group this speaker belongs to.
public
setGroup(string $group) : void
Parameters
- $group : string
setIndicator()
Turn the indicator light on or off.
public
setIndicator(bool $on) : $this
Parameters
- $on : bool
-
Whether the indicator should be on or off
Return values
$thissetLoudness()
Set whether loudness normalisation is on or not.
public
setLoudness(bool $on) : $this
Parameters
- $on : bool
-
Whether loudness should be on or not
Return values
$thissetMode()
Set the current play mode settings.
public
setMode(array<string, bool> $options) : $this
Parameters
- $options : array<string, bool>
-
An array with 2 elements (shuffle and repeat)
Return values
$thissetRepeat()
Turn repeat mode on or off.
public
setRepeat(bool $repeat) : $this
Parameters
- $repeat : bool
-
Whether repeat should be on or not
Return values
$thissetShuffle()
Turn shuffle mode on or off.
public
setShuffle(bool $shuffle) : $this
Parameters
- $shuffle : bool
-
Whether shuffle should be on or not
Return values
$thissetState()
Set the state of the group.
public
setState(PlayState $state) : self
Parameters
- $state : PlayState
Return values
selfsetTreble()
Set the treble equalisation.
public
setTreble(int $treble) : $this
Parameters
- $treble : int
-
The treble level (between -10 and 10)
Return values
$thissetVolume()
Adjust the volume of this speaker to a specific value.
public
setVolume(int $volume) : $this
Parameters
- $volume : int
-
The amount to set the volume to between 0 and 100
Return values
$thisunmute()
Unmute this speaker.
public
unmute() : $this
Return values
$thisupdateGroup()
Remove any previously established group for this speaker.
public
updateGroup() : void
useLineIn()
Play a line-in from a speaker.
public
useLineIn([SpeakerInterface|null $speaker = null ]) : $this
If no speaker is passed then the current controller's is used.
Parameters
- $speaker : SpeakerInterface|null = null
-
The speaker to get the line-in from
Return values
$thisuseQueue()
Set this controller to use its queue (rather than a stream).
public
useQueue() : $this
Return values
$thisuseStream()
Play a stream on this controller.
public
useStream(Stream $stream) : $this
Parameters
- $stream : Stream
-
The Stream object to play