iOS 0.1.0: the eight audio effects as AUv3 plugins on a C++ core
C++ ports of the Kotlin effects, checked against audio the Kotlin code renders (25 scenarios, IosGoldenExport); an Objective-C++ AUv3 wrapper checked on the Mac against the core (parameters, presets, saved state); a container app that checks each plugin on the device. Built as a TrollStore .ipa. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c9ad186de1
commit
dcf85ba915
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"images" : [
|
||||
{ "filename" : "icon-1024.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" }
|
||||
],
|
||||
"info" : { "author" : "xcode", "version" : 1 }
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
@@ -0,0 +1 @@
|
||||
{ "info" : { "author" : "xcode", "version" : 1 } }
|
||||
@@ -0,0 +1 @@
|
||||
#import "ObjC/SPKTry.h"
|
||||
@@ -0,0 +1,37 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// The container app: what Sizzle installs as plugins, and an on-device check
|
||||
/// that each one loads and processes sound. The plugins themselves are used from
|
||||
/// a host (AUM, GarageBand, Loopy, …).
|
||||
struct ContentView: View {
|
||||
@StateObject private var check = PluginCheck()
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Text("Sizzle").font(.system(.largeTitle, design: .monospaced)).foregroundColor(.orange)
|
||||
Text("AUv3 plugins for AUM, GarageBand, Loopy and other hosts.\nLook for \"Tired Sysadmin: Sizzle …\".")
|
||||
.font(.system(.footnote, design: .monospaced)).foregroundColor(.gray)
|
||||
Text(versionLine).font(.system(.caption, design: .monospaced)).foregroundColor(.gray)
|
||||
Button("Check all plugins") { Task { await check.run() } }
|
||||
.buttonStyle(.bordered).disabled(check.running)
|
||||
ScrollView {
|
||||
Text(check.lines.joined(separator: "\n"))
|
||||
.font(.system(.footnote, design: .monospaced))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.textSelection(.enabled)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.preferredColorScheme(.dark)
|
||||
.onAppear { check.listInstalled() }
|
||||
}
|
||||
|
||||
private var versionLine: String {
|
||||
let v = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "?"
|
||||
let b = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "?"
|
||||
return "version \(v) (\(b)) · iOS \(ProcessInfo.processInfo.operatingSystemVersionString)"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.cc.tiredsysadmin.ios.sizzle</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,13 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// Runs `block`, turning an Objective-C exception (AVAudioEngine raises them for
|
||||
/// misuse, and Swift can't catch them, so they crash the app) into a returned
|
||||
/// description. Returns nil when the block finished normally.
|
||||
NSString *_Nullable SPKTry(NS_NOESCAPE void (^block)(void));
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,13 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#import "SPKTry.h"
|
||||
|
||||
NSString *_Nullable SPKTry(NS_NOESCAPE void (^block)(void)) {
|
||||
@try {
|
||||
block();
|
||||
return nil;
|
||||
} @catch (NSException *e) {
|
||||
return [NSString stringWithFormat:@"%@: %@", e.name, e.reason ?: @"(no reason)"];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import AVFoundation
|
||||
|
||||
/// Lists Sizzle's registered plugins and, on request, loads each one out of
|
||||
/// process (as a host would) and renders a test signal through it offline.
|
||||
/// PASS = loads, output is finite, and not silent.
|
||||
@MainActor
|
||||
final class PluginCheck: ObservableObject {
|
||||
@Published var lines: [String] = []
|
||||
@Published var running = false
|
||||
|
||||
private static let manufacturer: FourCharCode = "Tsys".utf8.reduce(0) { ($0 << 8) | FourCharCode($1) }
|
||||
|
||||
private func installed() -> [AVAudioUnitComponent] {
|
||||
let any = AudioComponentDescription(componentType: 0, componentSubType: 0,
|
||||
componentManufacturer: Self.manufacturer,
|
||||
componentFlags: 0, componentFlagsMask: 0)
|
||||
return AVAudioUnitComponentManager.shared().components(matching: any)
|
||||
.filter { $0.audioComponentDescription.componentType == kAudioUnitType_Effect }
|
||||
}
|
||||
|
||||
func listInstalled() {
|
||||
let comps = installed()
|
||||
lines = ["Registered effects: \(comps.count)"] + comps.map { " \($0.name)" }
|
||||
}
|
||||
|
||||
func run() async {
|
||||
running = true
|
||||
defer { running = false }
|
||||
let comps = installed()
|
||||
lines = ["Checking \(comps.count) effects…"]
|
||||
var ok = 0
|
||||
for c in comps {
|
||||
let result = await check(c)
|
||||
if result.hasPrefix("PASS") { ok += 1 }
|
||||
lines.append("\(result) \(c.name.replacingOccurrences(of: "Tired Sysadmin: ", with: ""))")
|
||||
}
|
||||
lines.append("\(ok)/\(comps.count) passed")
|
||||
}
|
||||
|
||||
/// 1 s at 44.1 kHz stereo: a decaying saw burst, then noise, then silence.
|
||||
private func testBuffer(format: AVAudioFormat) -> AVAudioPCMBuffer {
|
||||
let n = AVAudioFrameCount(format.sampleRate)
|
||||
let buf = AVAudioPCMBuffer(pcmFormat: format, frameCapacity: n)!
|
||||
buf.frameLength = n
|
||||
var seed: UInt32 = 0x1234567
|
||||
for i in 0..<Int(n) {
|
||||
let t = Double(i) / format.sampleRate
|
||||
var x: Float = 0
|
||||
if t < 0.3 { x = Float(0.6 * (2 * (t * 110).truncatingRemainder(dividingBy: 1) - 1) * exp(-t * 6)) }
|
||||
else if t < 0.6 { seed = seed &* 1103515245 &+ 12345; x = Float((seed >> 8) & 0xFFFF) / 65535 * 0.6 - 0.3 }
|
||||
for ch in 0..<Int(format.channelCount) { buf.floatChannelData![ch][i] = x }
|
||||
}
|
||||
return buf
|
||||
}
|
||||
|
||||
private func check(_ comp: AVAudioUnitComponent) async -> String {
|
||||
do {
|
||||
let unit = try await AVAudioUnit.instantiate(with: comp.audioComponentDescription, options: .loadOutOfProcess)
|
||||
let engine = AVAudioEngine()
|
||||
let format = AVAudioFormat(standardFormatWithSampleRate: 44_100, channels: 2)!
|
||||
let player = AVAudioPlayerNode()
|
||||
var thrown: Error?
|
||||
let ex = SPKTry {
|
||||
do {
|
||||
try engine.enableManualRenderingMode(.offline, format: format, maximumFrameCount: 4096)
|
||||
engine.attach(player)
|
||||
engine.attach(unit)
|
||||
engine.connect(player, to: unit, format: format)
|
||||
engine.connect(unit, to: engine.mainMixerNode, format: format)
|
||||
try engine.start()
|
||||
player.scheduleBuffer(self.testBuffer(format: format), completionHandler: nil)
|
||||
player.play()
|
||||
} catch { thrown = error }
|
||||
}
|
||||
if let ex = ex { return "FAIL exception \(ex)" }
|
||||
if let e = thrown { return "FAIL \(e.localizedDescription)" }
|
||||
let out = AVAudioPCMBuffer(pcmFormat: engine.manualRenderingFormat, frameCapacity: 4096)!
|
||||
var peak: Float = 0, finite = true
|
||||
for _ in 0..<11 {
|
||||
_ = try engine.renderOffline(4096, to: out)
|
||||
for ch in 0..<Int(out.format.channelCount) {
|
||||
let d = out.floatChannelData![ch]
|
||||
for i in 0..<Int(out.frameLength) { let v = d[i]; if !v.isFinite { finite = false }; peak = max(peak, abs(v)) }
|
||||
}
|
||||
}
|
||||
engine.stop()
|
||||
if !finite { return "FAIL non-finite output" }
|
||||
return peak > 0.01 ? String(format: "PASS peak %.2f", peak) : String(format: "FAIL silent (peak %.4f)", peak)
|
||||
} catch {
|
||||
return "FAIL \(error.localizedDescription)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct SizzleApp: App {
|
||||
var body: some Scene { WindowGroup { ContentView() } }
|
||||
}
|
||||
Reference in New Issue
Block a user