Device editors ask BespokeEditors for headers, whole bodies, drawings and card actions; DeviceDataSource gives them DSP data and hidden settings, backed by app slots (SlotDataSource) or AUs (AUDataSource, hidden values in SizzleDeviceAU). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
747 B
Swift
21 lines
747 B
Swift
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import Foundation
|
|
|
|
/// DeviceDataSource for toolbox slot [slot] of the app's song. Each device's
|
|
/// support lives in an extension in Host/Bespoke/.
|
|
@MainActor
|
|
final class SlotDataSource: DeviceDataSource {
|
|
let session: SizzleSession
|
|
let slot: Int
|
|
init(session: SizzleSession, slot: Int) { self.session = session; self.slot = slot }
|
|
|
|
// Hidden settings are plain slot values here.
|
|
func hiddenValue(_ key: String) -> String? {
|
|
let v = session.value(ofSlot: slot, key: key)
|
|
return v.isEmpty ? nil : v
|
|
}
|
|
func setHiddenValue(_ value: String, key: String) { session.setValue(value, ofSlot: slot, key: key) }
|
|
}
|