YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume Class Reference

The volume of the YAACC renderer follows its output (task 9.1), decided at every call from the setting: More...

Inheritance diagram for de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume:
Inheritance graph
Collaboration diagram for de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume:
Collaboration graph

Classes

interface  GroupSide
 The group of a server: its facts (and wake), its level from the model, and the sends. More...
 
class  Level
 The volume and the mute flag of the group as of the model.
 

Public Member Functions

 OutputRoutedVolume (Supplier< Setting > settings, RendererVolume local, GroupSide group, Executor sender, SnapcastRendererOutput.Waiter waiter, MonotonicClock clock, Consumer< Problem > problems)
 
int getPercent ()
 
boolean isMuted ()
 
int peekPercent ()
 As getPercent(), for the check that reports a change to the controllers (the RenderingControl event): it reads and never wakes a connection.
 
boolean peekMuted ()
 As isMuted(), without waking anything; see peekPercent().
 
void wakeNow ()
 A control point subscribed to the renderer's events (or the output was switched to a group while one is subscribed): wake the connection to the server of the group once, now, so that the state it is told is the group's.
 
void setPercent (int desired)
 
void setMuted (boolean mute)
 
- Public Member Functions inherited from de.yaacc.upnp.server.renderingcontrol.RendererVolume

Static Public Attributes

static final long WAKE_INTERVAL_MILLIS = 20_000L
 How often a read may wake the connection to the server.
 

Detailed Description

The volume of the YAACC renderer follows its output (task 9.1), decided at every call from the setting:

  • This device (the default, also a damaged setting): the system volume, as before. Nothing of the group is asked, woken or touched.
  • Snapcast group: the volume and the mute flag of the chosen group. Reading is the model in memory (no network; the last known value while the model has none, then 0 and not muted). Setting returns at once and runs on the sender thread: it waits (bounded, as a play does) for a connection that is coming up, then asks the group side to send; when the group can not be reached or is gone, the problem is reported and nothing is sent. A quick series sends only the latest value. The phone's own volume is never read or changed in this mode.

No feedback. The path is one way. A set goes to the server; a change that the server reports updates the model, and whoever reports the state to the controllers (the RenderingControl event check, the OpenHome poll) only reads here. Nothing in the read path sets anything, so a volume change by the server can not cause another set.

The controller's own reads in group mode (getPercent, isMuted: Get calls, the OpenHome renderer's poll) wake the connection to the server of the group, at most once in WAKE_INTERVAL_MILLIS (the connection closes by itself after a grace period when nobody asks), and so does wakeNow for a new subscriber: a controller that asks for the volume sees the group's value without a play. The reads of the change check (peekPercent, peekMuted) never wake: the idle close of the link is itself a change event, and a wake from its check would open the link again every grace period for as long as a controller is subscribed. The last known level is kept for the group it belongs to and forgotten when another group is chosen. Pure Java; the group side, the sender, the clock and the problem report are the app's.

Constructor & Destructor Documentation

◆ OutputRoutedVolume()

de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume.OutputRoutedVolume ( Supplier< Setting > settings,
RendererVolume local,
GroupSide group,
Executor sender,
SnapcastRendererOutput.Waiter waiter,
MonotonicClock clock,
Consumer< Problem > problems )
Parameters
settingsthe setting as it is now (read at every call)
localthe system volume
senderruns the sets, one at a time and in order (one daemon thread)
problemstold (on the sender thread) why a set was not sent; the app shows a toast

Member Function Documentation

◆ getPercent()

int de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume.getPercent ( )
Returns
the volume, 0 to 100

Implements de.yaacc.upnp.server.renderingcontrol.RendererVolume.

◆ isMuted()

boolean de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume.isMuted ( )

◆ peekMuted()

boolean de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume.peekMuted ( )

As isMuted(), without waking anything; see peekPercent().

Implements de.yaacc.upnp.server.renderingcontrol.RendererVolume.

◆ peekPercent()

int de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume.peekPercent ( )

As getPercent(), for the check that reports a change to the controllers (the RenderingControl event): it reads and never wakes a connection.

A read that a change event made must not cause the next change event.

Implements de.yaacc.upnp.server.renderingcontrol.RendererVolume.

◆ setMuted()

void de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume.setMuted ( boolean mute)

◆ setPercent()

void de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume.setPercent ( int desired)
Parameters
desired0 to 100, other values are cut to it

Implements de.yaacc.upnp.server.renderingcontrol.RendererVolume.

Here is the call graph for this function:

◆ wakeNow()

void de.yaacc.upnp.server.renderingcontrol.OutputRoutedVolume.wakeNow ( )

A control point subscribed to the renderer's events (or the output was switched to a group while one is subscribed): wake the connection to the server of the group once, now, so that the state it is told is the group's.

Only this and the controller's own reads (getPercent, isMuted) wake; the check that a change event triggers (peekPercent) never does, or the idle close of the link would bring it back every 30 seconds.

Implements de.yaacc.upnp.server.renderingcontrol.RendererVolume.


The documentation for this class was generated from the following file: