// Where the player stands with a track, as a face draws it (`TrackPlay`), and// how loud it sounds (`TrackLevel`).importFoundation/// Where the player stands with one track, as its face draws it: whether the/// player holds this track, plays it, is still fetching it, how far it is/// and how long, and what went wrong. On a card that holds several songs (a/// playlist's tape, its `songs` entries) it is where the player stands with/// the one of them it holds: which (`song`), and how far into it and how/// long. The app fills it from its player (CottonUI's `DeckTrackPlaying`;/// Loom's `SpecimenPlayer`); a card the player holds nothing of is `still`.publicstructTrackPlay: Equatable, Sendable {publicenumFault: Equatable, Sendable {/// Its file could not be fetched.case unavailable/// Its file is there but does not play.case unplayable }publicvar held: Boolpublicvar playing: Boolpublicvar loading: Boolpublicvar elapsed: TimeIntervalpublicvar duration: TimeIntervalpublicvar fault: Fault?/// On a card of several songs, the place in its songs of the one the/// player holds (from 0); nil on a card of one track, and while it holds/// none of them.publicvar song: Int?/// How loud the sound is in each channel at this moment, as the player/// meters it; nil where it meters none (a hi-fi's needles rest).publicvar level: TrackLevel?publicinit( held: Bool = false, playing: Bool = false, loading: Bool = false, elapsed: TimeInterval = 0, duration: TimeInterval = 0, fault: Fault? = nil, song: Int? = nil, level: TrackLevel? = nil ) {self.held = heldself.playing = playingself.loading = loadingself.elapsed = elapsedself.duration = durationself.fault = faultself.song = songself.level = level }/// Not the track the player holds.publicstaticlet still = TrackPlay()}/// How loud the sound is in its two channels, each nought (silence) to one/// (the loudest the meters read), as the player meters it some twenty times/// a second.publicstructTrackLevel: Equatable, Sendable {publicvar left: Doublepublicvar right: Doublepublicinit(left: Double, right: Double) {self.left = leftself.right = right }}