1import SwiftUI
2
3/// UI-side view settings driven by the top-bar dropdowns.
4final class Settings: ObservableObject {
5 @Published var transpose: Int = 0 // semitones added to displayed labels
6 @Published var naming: NoteNaming = .sharps
7 @Published var range: PitchRange = .default
8
9 /// How many seconds of history the graph shows.
10 @Published var visibleSeconds: Double = 6
11
12 static let transposeChoices = Array(-12...12)
13
14 func transposeLabel(_ n: Int) -> String {
15 if n == 0 { return "Transpose 0" }
16 return "Transpose \(n > 0 ? "+" : "")\(n)"
17 }
18}