Class Orpheus
java.lang.Object
lol.trq.orpheus.Orpheus
- All Implemented Interfaces:
AutoCloseable
The entry point: collects what the sources report, picks one session, and offers it as a snapshot, as events and
through commands.
Reading (snapshot(), playback(), lyrics(), cover()) is safe from any thread,
never blocks and allocates nothing. Listeners run on the executor given to the builder, or on a library thread, in
order. Command futures complete on a library thread. Nothing runs before start() and no thread survives
stop(), unless a source or a lyrics provider hangs for more than five seconds while it stops.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidReplaces the rules deciding which applications are visible.static Orpheus.Builderbuilder()voidclose()controls()Commands for whichever session is selected at the moment each command is sent.Commands for the session ofplayback, even if the selection moves on.cover()The decoded cover of the playing track, or null.devices()library()listen(Consumer<? super OrpheusEvent> listener) Registers a listener for every event.lyrics()voidlyricsOffset(Duration offset) Shifts the lyrics of the playing song; positive shows lines earlier.voidManual choice: shows only sessions of one source, for example only the operating system or only one service.voidShows only sessions of one application of one source.playback()queue()sessions()Every session the sources report, including hidden ones (without track data).voidOpts a source in or out ofPlayback.shareable().snapshot()Playback, lyrics and cover of this instant, guaranteed to belong together.sources()The configured sources in priority order, each with its status.voidstart()Starts the sources.voidstop()Stops the sources and every library thread, fails commands still in flight and clears the snapshot.voidunpin()Returns to the automatic choice: something playing beats something paused, and between equals the source added to the builder first wins.
-
Method Details
-
builder
-
start
public void start()Starts the sources. Does nothing when already started. -
stop
public void stop()Stops the sources and every library thread, fails commands still in flight and clears the snapshot. Safe to call from a listener and more than once. Can be started again afterwards. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
snapshot
Playback, lyrics and cover of this instant, guaranteed to belong together. -
playback
-
lyrics
-
cover
The decoded cover of the playing track, or null. -
sessions
Every session the sources report, including hidden ones (without track data). -
sources
The configured sources in priority order, each with its status. Beforestart()every source is listed as starting. -
listen
Registers a listener for every event. If listeners fall more than 256 events behind, the oldest waiting events are dropped; every event carries the state of its moment, so the newest one is always current. -
controls
Commands for whichever session is selected at the moment each command is sent. -
controls
-
queue
-
devices
-
library
-
pin
-
pin
-
unpin
public void unpin()Returns to the automatic choice: something playing beats something paused, and between equals the source added to the builder first wins. So with the operating system first, a service is only shown while the system has nothing playing. -
apps
Replaces the rules deciding which applications are visible. -
lyricsOffset
-