PieceAsset

class PieceAsset(val stem: String)(source)

Names the files of one work: its readings, their word times, and what a reader shares of their own attempt.

The stem is the work's, because the files of two works sit side by side on a phone and in a bucket, and a name that says only a number says nothing about which work the number belongs to.

Names are compared in Unicode normalization form C, so a stem and a name that spell the same letters with precomposed and combining marks still match. Only the ASCII digits 0 to 9 are read as the digits of a piece number, and a number read from a name fits in 32 bits.

Constructors

Link copied to clipboard
constructor(stem: String)

Properties

Link copied to clipboard

Work-specific prefix placed in every generated asset name.

Functions

Link copied to clipboard
fun alignment(piece: Int, voice: NarrationVoice): String

Returns the JSON alignment filename for a piece and narration voice.

Link copied to clipboard
fun name(piece: Int): String

Returns the zero-padded base name of a numbered piece.

Link copied to clipboard
fun number(inName: String): Int?

Extracts a piece number from a filename belonging to this work.

Link copied to clipboard
fun recording(piece: Int, voice: NarrationVoice): String

Returns the relative MP3 path for a piece and narration voice.

Link copied to clipboard
fun sharedReading(piece: Int, line: Int, heard: String?): String

Returns a stable base name for a shared line attempt.

Link copied to clipboard
fun voice(inName: String): NarrationVoice?

Extracts the voice suffix from an alignment filename.