Package-level declarations

Types

Link copied to clipboard
class BuiltLine(val index: Int, val lyric: Lyric, val time: Double, val duration: Double, val isInstrumental: Boolean, val isBlank: Boolean, val agent: String?, val direction: TextDirection, val language: String, val content: LineContent?) : TimedPart

One line as the renderer draws it: upstream's LineData and the element built for it. Times in seconds.

Link copied to clipboard
class BuiltLyrics(val lines: List<BuiltLine>, val syncType: LyricSyncType, val allZero: Boolean, val noLyrics: Boolean, val credits: String?, val isStageDuet: Boolean)

A song's lyrics as a renderer draws them, from buildLyrics.

Link copied to clipboard
data class BuiltRomanization(val text: String, val language: String, val direction: TextDirection, val timedParts: List<LyricPart>?)

A romanization hung under a line: injectRomanization. Timed, it carries words that sweep like the line's. Equal when it shows the same, which is what upstream's decorationSources compares.

Link copied to clipboard
data class BuiltTranslation(val text: String, val language: String, val direction: TextDirection)

A translation hung under a line: injectTranslation. Equal when it shows the same.

Link copied to clipboard
class BuiltWord(val text: String, val time: Double, val duration: Double, val isBackground: Boolean, val explicit: Boolean, val isLineSynced: Boolean, val isRtl: Boolean, val isLongWord: Boolean, val letters: List<String>?, val wrapChunks: List<String>?, val wobbles: Boolean) : TimedPart

One timed word, upstream's PartData without its elements. Times in seconds.

Link copied to clipboard
data class ClockReading(val time: Double, val timeJumped: Boolean, val mediaSteppedBack: Boolean, val pausedSeek: Boolean)

What the clock made of one reading.

Link copied to clipboard
class ContentLine(val text: String, val items: List<LineItem>, val isBidiSensitive: Boolean)

One content line: the main one, the background vocals under it, or a timed romanization.

Link copied to clipboard

Every theme setting braccato-core reads, under upstream's keys and with upstream's defaults. A theme sets them through setThemeSettings; a renderer reads them with Setting.getNumberValue and its kin.

Link copied to clipboard

What kind of frame a tick produced.

Link copied to clipboard
class LineContent(val main: ContentLine, val backgrounds: List<ContentLine>, val words: List<BuiltWord>)

The content of a line built from its parts: createLyricsLine.

Link copied to clipboard
sealed interface LineItem

What a content line holds, in order: words grouped as they run together, and the spaces between.

Link copied to clipboard

SCROLL is the scrolling lyrics view. STAGE shows only what is being sung.

Link copied to clipboard
class LyricsTimeline(val lyrics: BuiltLyrics, val layout: LyricsLayout = LyricsLayout.SCROLL, val offsets: TimingOffsets = TimingOffsets(), val clock: PlaybackClock = PlaybackClock())

One view's timeline: the clock, the selection, the scroll state. The renderer feeds it the playback time once per frame and draws what it answers.

Link copied to clipboard
class PlaybackClock(smoothSteppedClock: Boolean = false, interpolateHeldReadings: Boolean = true)

The last player snapshot, and how the next one is read against it.

Link copied to clipboard

What the view should do with its scroll this frame.

Link copied to clipboard
data class ScrollDecision(val action: ScrollAction, val targetScrollTop: Double, val smooth: Boolean, val naturalAdvance: Boolean, val anchorIndex: Int, val lastActiveIndex: Int)

Where the scroll should go this frame, and how.

Link copied to clipboard
data class ScrollInsets(val top: Double, val bottom: Double)

Space at the top and bottom of the view the lines should keep clear of, as a theme sets it. Pixels.

Link copied to clipboard
data class ScrollItem(val position: Double, val height: Double)

Something laid out in the scroll beside the lines.

Link copied to clipboard
data class ScrollViewport(val height: Double, val scrollTop: Double, val maxScrollTop: Double, val linePositions: List<Double>, val lineHeights: List<Double>, val insets: ScrollInsets = NO_SCROLL_INSETS, val credits: ScrollItem? = null, val targetScrollRatio: Double = targetScrollRatio())

Where the renderer has laid the lines out, in the scroll content's coordinates. Pixels.

Link copied to clipboard
data class SetLyricsOptions(val language: String? = null, val noLyrics: Boolean = false, val songwriters: List<String> = emptyList())

What buildLyrics needs to know beside the lyrics themselves.

Link copied to clipboard
class Setting

One theme setting, as CoreSettings lists them. Its value is shared by every view in the process, as upstream's is.

Link copied to clipboard

What a Setting holds: a Double, a Boolean or a String.

Link copied to clipboard
data class StageBox(val x: Double, val y: Double, val width: Double, val height: Double)

A rectangle on the stage, in pixels: where the sung text is, for a backdrop behind it.

Link copied to clipboard
data class StageGeometry(val stageHeight: Double, val gap: Double, val activeScale: Double)

The stage's own measures.

Link copied to clipboard
data class StageItem(val kind: StageItemKind, val start: Double, val end: Double)

One item of the stage, with its time.

Link copied to clipboard

What stands on the stage: a sung line, a pause, an instrumental break, or the credits.

Link copied to clipboard
data class StageLayout(val placements: List<StagePlacement>, val box: StageBox?)

What layoutStage decides.

Link copied to clipboard
data class StageMetrics(val height: Double, val left: Double, val width: Double, val originX: Double)

One item's measured size, in pixels.

Link copied to clipboard
data class StagePlacement(val y: Double, val visible: Boolean)

Where layoutStage puts an item.

Link copied to clipboard
enum class StageRole : Enum<StageRole>

Where an item is at a time: being sung (CURRENT), the line before it while the two overlap (PREVIOUS), still to come (QUEUED) or done (GONE).

Link copied to clipboard

Which way a run of text reads. AUTO is upstream's dir="auto" with no class: left to the text.

Link copied to clipboard
data class TickOptions(val isPlaying: Boolean, val eventCreationTime: Double? = null, val smoothScroll: Boolean? = null, val globalLyricOffset: Double? = null, val lyricOffset: Double? = null, val richsyncOffsetTrim: Double? = null, val lineOffsetTrim: Double? = null, val passiveScrollEnabled: Boolean? = null, val playbackRate: Double? = null, val followPausedSeeks: Boolean? = null)

The play state is the only thing a tick cannot be given a sensible default for. Everything else describes a setting the consumer may not have, so it may be left out.

Link copied to clipboard
interface TimedPart

One word's timing, in seconds, as updateWordStates reads it.

Link copied to clipboard
data class TimelineFrame(val status: FrameStatus, val lyricTime: Double = 0.0, val scrollTime: Double = 0.0, val clock: ClockReading? = null, val activeLines: List<Int> = emptyList(), val animatingLines: List<Int> = emptyList(), val creditsFocused: Boolean = false, val scroll: ScrollDecision? = null, val passiveScrollTop: Double? = null, val resumeAffordanceVisible: Boolean = false, val stageRoles: List<StageRole>? = null)

Everything one tick decided. Line indices are into BuiltLyrics.lines.

Link copied to clipboard
data class TimingOffsets(val richsync: Double = 0.15, val line: Double = 0.115, val scroll: Double = 0.5)

The timing offsets a theme sets as CSS durations (--blyrics-richsync-timing-offset, --blyrics-timing-offset, --blyrics-scroll-timing-offset). Defaults are styles/variables.css's. In seconds.

Link copied to clipboard
enum class WordState : Enum<WordState>

Where a word stands at a time: not yet sung, being sung, or sung.

Properties

Link copied to clipboard

The note itself, drawn once as the empty background and once as the fill the wave clips.

Link copied to clipboard

The same surface at the bottom of its ripple. Same commands as the high one, so the two morph.

Link copied to clipboard

The block under the wave that fills the rest of the note.

Functions

Link copied to clipboard
fun buildLyrics(lyrics: List<Lyric>, options: SetLyricsOptions = SetLyricsOptions(), layout: LyricsLayout = LyricsLayout.SCROLL): BuiltLyrics

setLyrics: builds every line, and what the container records about the song as a whole.

Link copied to clipboard
fun buildRomanization(mainText: String, lineLanguage: String, text: String, timedRomanization: List<LyricPart>? = null): BuiltRomanization?

The romanization for a line, or null when it only repeats the line. Its language is the line's, in Latin script. Timed parts are built into words unless the theme turned rich sync off.

Link copied to clipboard
fun buildTranslation(mainText: String, text: String, language: String? = null): BuiltTranslation?

The translation for a line, or null when it only repeats the line, which upstream leaves off.

Link copied to clipboard

Sizes the padding above the first line and below the last one so either can sit at the view's target scroll position.

Link copied to clipboard
fun layoutStage(roles: List<StageRole>, items: List<StageItem>, metrics: List<StageMetrics>, previousY: List<Double?>, geometry: StageGeometry): StageLayout

Places the stage's items for their roles, as planStage gave them.

Link copied to clipboard

The blyrics-* configuration a compiled stylesheet declares, in declaration order, last one winning. Depends on nothing, so a consumer that compiles a theme somewhere the renderer does not run can read the settings out of it on its own.

Link copied to clipboard
fun planStage(items: List<StageItem>, timeS: Double): List<StageRole>

Each item's StageRole at timeS, in seconds of lyric time.

Link copied to clipboard

Applies a theme's blyrics-* settings, as parseThemeConfig reads them; settings it leaves out go back to their defaults, and those the host set itself stay.