// A LIST as the CASSETTE (owner, 7 Nov 2026: Music's lists are tapes): the // bare cassette (`BareCassette`, `CassetteParts.swift`) first on the list's own // deck, before its songs. Its label says the list's name by hand and, under // the red rule, its songs "Harbour Lights / Slow Train / Blue Hour", as many // as fit, then "+N"; its counter the list's length at rest. A tap plays the // list from its first song (or plays and pauses it while the player holds // one of its songs); the packs wind through the whole list as it plays, the // hubs turning. // // Every word is the card's (the core's `rules::list_card`): `title` (the // list's name), `songs` (each its title and length in seconds), `count` // ("3 songs") and `length` ("19:18"). import CottonPaper import CottonValues import SwiftUI public enum ListCassetteFaceCatalogue { public static let stock: FaceStock = .own public static let ground: FaceGround = .tolex public static let face = Face(id: "list.cassette", specimens: [ Specimen("night drives", nightDrives), Specimen("playing", nightDrives, play: TrackPlay(held: true, playing: true, elapsed: 134, duration: 302, song: 1)), Specimen("long", long), Specimen("blank", blank), ]) { card, _, _ in TrackPlaying(card: card) { player in BareCassette(words: ListCassette.words(card), play: player.play, toggle: player.toggle, seek: player.seek) } } static func song(_ title: String, _ seconds: Double) -> RecordValue { .object(["title": .text(title), "duration": .number(seconds)]) } /// Three songs, as the Dark Room's picture has them. public static let nightDrives = DeckCard(face: .listCassette, fields: [ "title": .text("Night Drives"), "count": .text("3 songs"), "length": .text("11:41"), "songs": .list([song("Harbour Lights", 221), song("Slow Train", 302), song("Blue Hour", 178)]), ]) /// A long name and forty songs: as many named as fit, then "+N". public static let long = DeckCard(face: .listCassette, fields: [ "title": .text("Everything we played on the long drive north to the lake house"), "count": .text("40 songs"), "length": .text("2:39:10"), "songs": .list((1...40).map { song(longTitles[($0 - 1) % longTitles.count], Double(170 + ($0 * 7) % 140)) }), ]) static let longTitles = [ "The Harbour Wall", "Northbound", "A Field of Wires", "Petrol Station Coffee", "Somewhere Past the Last Town", "Headlights on the Pines", "Small Hours", "Static Between Stations", "Fog Lifting", "Borrowed Sweaters", ] /// No songs yet: a blank tape. public static let blank = DeckCard(face: .listCassette, fields: [ "title": .text("For the new flat"), "count": .text("0 songs"), "songs": .list([]), ]) } /// A list's card as the cassette says it. enum ListCassette { static func words(_ card: DeckCard) -> CassetteWords { let songs = CassetteTape.songs(card) return CassetteWords( title: card.text("title"), titles: songs.compactMap(\.title), byline: songs.isEmpty ? card.text("count") : nil, length: card.text("length"), songs: songs) } }