iOS 0.2.0: instruments as AUv3, in-app host with keyboard, MIDI in and benchmark

Shared SizzleDeviceAU base for effects and instruments; sizzle::Instrument voice
pools; Android's factory presets generated into the specs header; the app hosts
every device in-process (no dependence on the system plugin registry).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Reactorcoremeltdown
2026-11-15 22:17:47 +01:00
co-authored by Claude Opus 5.5
parent a5b2f4c873
commit 7f231c8f79
35 changed files with 1989 additions and 368 deletions
+64
View File
@@ -0,0 +1,64 @@
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
import SwiftUI
/// The app's state around SizzleHost: which devices play, which editor shows,
/// and the results of the benchmark / plugin check.
@MainActor
final class HostModel: ObservableObject {
let host = SizzleHost()
let devices = SizzleHost.devices
var instruments: [SizzleHostDevice] { devices.filter { $0.isInstrument } }
var effects: [SizzleHostDevice] { devices.filter { !$0.isInstrument } }
@Published var instrument: SizzleHostDevice?
@Published var effect: SizzleHostDevice?
/// Which device's editor is shown: false = the instrument, true = the effect.
@Published var editingEffect = false
@Published var octave = 4
@Published var report: [String] = []
@Published var busy = false
@Published var message: String?
init() {
if let first = instruments.first { select(first) }
}
func select(_ device: SizzleHostDevice) {
host.selectInstrument(device) { [weak self] error in
guard let self = self else { return }
if let error = error { self.message = error.localizedDescription; return }
self.instrument = device
self.editingEffect = false
}
}
func selectEffect(_ device: SizzleHostDevice?) {
host.selectEffect(device) { [weak self] error in
guard let self = self else { return }
if let error = error { self.message = error.localizedDescription; return }
self.effect = device
self.editingEffect = device != nil
}
}
var editedUnit: SizzleDeviceAU? { editingEffect ? host.effect : host.instrument }
var canLoadSample: Bool {
let t = instrument?.toolboxType
return t == "SAMPLER" || t == "SOUNDFONT"
}
func loadSample(_ url: URL, pad: Int) {
do { try host.loadSample(from: url, pad: Int32(pad)) }
catch { message = error.localizedDescription }
}
func benchmark() {
busy = true
report = []
host.benchmark({ [weak self] line in self?.report.append(line) },
done: { [weak self] in self?.busy = false })
}
}