Expand description
The now-playing banner: a core-owned, transient announcement of the current track (ADR-0110, Plan 0097).
A shell pushes in a UTF-8 string and nothing else — SMTC on the standalone,
foobar’s titleformat through the C ABI — and everything downstream of that
string is decided here: the fade envelope, the artist/title split, the
placement, and the truncation rule. That is the whole point of the ADR: two
frontends whose metadata sources have nothing in common cannot drift on what
a track change looks like, because neither of them draws it.
The envelope is a pure function of accumulated dt (Plan 0014’s injected
real seconds), so it runs for the same wall-clock duration on a 60 Hz and a
165 Hz display and is testable without a GPU. Nothing here reads a clock.
This module is not behind the text feature. A build without it keeps
the state and simply never asks for a layout, which
is what lets the plugin build turn the feature on without touching any of
this.
Structs§
- Banner
Line - One positioned line of the banner, ready to become a
TextRun. TheCowborrows the stored string whenever the line fits and owns only the truncated copy, so a steady banner frame allocates nothing. - NowPlaying
- The banner’s whole state: what to announce, and how long ago it was set.
Constants§
- FADE_
IN_ SECS - Seconds the banner takes to reach full opacity.
- FADE_
OUT_ SECS - Seconds the banner takes to fade back out.
- HOLD_
SECS - Seconds the banner holds at full opacity.
- SEPARATOR
- The separator a shell puts between artist and title. Both sources agree on
it: the plugin renders
%artist% - %title%(ADR-0110) and the standalone joins its SMTC fields the same way, so this one rule splits both. - TOTAL_
SECS - Total lifetime of one announcement, after which nothing is drawn.
Functions§
- alpha_
at - The envelope: ramp in, hold, ramp out, then nothing. A pure function of elapsed seconds, which is what makes it identical at any refresh rate and testable without a device.