Replace stringly-typed pedal API with PedalType tokens
appendPedal(type: String, to:) is replaced by appendPedal(_ kind: PedalType, to:),
where PedalType is an extensible RawRepresentable struct with static members for
the built-in pedals:
try shoeGaze.appendPedal(.overdrive, to: board)
Discoverable/autocompleting call sites, still open for custom pedals
(PedalType("My Pedal")). rawValue == the pedal's displayName, so PedalRegistry
and the rig JSON format are unchanged — saved rigs load exactly as before.
Named PedalType (not PedalKind) to avoid colliding with Lyrebird's score-notation
PedalKind enum, which is visible when both modules are imported. The UI palette
wraps its registry-key strings as PedalType(key); demos/tests use the static
members. PedalRegistry.makePedal(type:) stays string-keyed as the serialization
boundary used by loadRig.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -46,7 +46,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
private static let heightFraction: CGFloat = 0.88
|
||||
|
||||
/// The default pedal the seed board comes up with, so audio is audible immediately on Start.
|
||||
private static let seedPedalType: String = "Overdrive"
|
||||
private static let seedPedalType: PedalType = .overdrive
|
||||
|
||||
// MARK: - Owned objects
|
||||
|
||||
@@ -92,7 +92,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
do {
|
||||
let board: PedalBoard = try shoeGaze.addBoard()
|
||||
created = board
|
||||
try shoeGaze.appendPedal(type: AppDelegate.seedPedalType, to: board)
|
||||
try shoeGaze.appendPedal(AppDelegate.seedPedalType, to: board)
|
||||
} catch {
|
||||
if let board: PedalBoard = created { shoeGaze.removeBoard(board) }
|
||||
print("[ShoeGazeBuilder] seed board failed: \(error)")
|
||||
|
||||
@@ -31,7 +31,7 @@ final class ShoeGazeBuilderiOSAppModel {
|
||||
// available for any future build that starts input-less.)
|
||||
private static let inputChannels: Int = 1
|
||||
private static let numAudioBuses: Int = 256
|
||||
private static let seedPedalType: String = "Overdrive"
|
||||
private static let seedPedalType: PedalType = .overdrive
|
||||
|
||||
/// UserDefaults key persisting the input selection. Must match the key written by the
|
||||
/// builder view (`ShoeGazeBuilderView.inputSelectionDefaultsKey`).
|
||||
@@ -64,7 +64,7 @@ final class ShoeGazeBuilderiOSAppModel {
|
||||
do {
|
||||
let board: PedalBoard = try shoeGaze.addBoard()
|
||||
board.label = "Board 1"
|
||||
try shoeGaze.appendPedal(type: ShoeGazeBuilderiOSAppModel.seedPedalType, to: board)
|
||||
try shoeGaze.appendPedal(ShoeGazeBuilderiOSAppModel.seedPedalType, to: board)
|
||||
} catch {
|
||||
print("[ShoeGazeBuilderiOS] seed board failed: \(error)")
|
||||
}
|
||||
@@ -182,7 +182,7 @@ final class ShoeGazeBuilderiOSAppModel {
|
||||
do {
|
||||
let board: PedalBoard = try shoeGaze.addBoard()
|
||||
board.label = "Board 1"
|
||||
try shoeGaze.appendPedal(type: ShoeGazeBuilderiOSAppModel.seedPedalType, to: board)
|
||||
try shoeGaze.appendPedal(ShoeGazeBuilderiOSAppModel.seedPedalType, to: board)
|
||||
} catch {
|
||||
print("[ShoeGazeBuilderiOS] fallback seed board failed: \(error)")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user