// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown // SPDX-License-Identifier: GPL-3.0-or-later #import #import "SizzleDeviceAU.h" NS_ASSUME_NONNULL_BEGIN /// One Sizzle device the app can host (from components.txt). NS_SWIFT_SENDABLE @interface SizzleHostDevice : NSObject @property (nonatomic, readonly) NSString *name; @property (nonatomic, readonly) NSString *toolboxType; @property (nonatomic, readonly) OSType subtype; @property (nonatomic, readonly) BOOL isInstrument; @end /** * The app's own host: Sizzle's devices registered in this process (manufacturer * 'Tsyl', so they never collide with the extension's 'Tsys' copies and don't depend * on the system plugin registry), played through AVAudioEngine: * instrument → optional effect → output. Notes come from the on-screen keyboard * and every connected MIDI source. Main thread only. */ NS_SWIFT_UI_ACTOR @interface SizzleHost : NSObject @property (class, nonatomic, readonly) NSArray *devices; @property (nonatomic, readonly, nullable) SizzleDeviceAU *instrument; @property (nonatomic, readonly, nullable) SizzleDeviceAU *effect; @property (nonatomic, readonly) NSArray *midiSources; /// Swap the instrument / the effect (nil = no effect). Completion on the main thread. - (void)selectInstrument:(SizzleHostDevice *)device completion:(NS_SWIFT_UI_ACTOR void (^)(NSError *_Nullable))completion; - (void)selectEffect:(nullable SizzleHostDevice *)device completion:(NS_SWIFT_UI_ACTOR void (^)(NSError *_Nullable))completion; - (void)noteOn:(int)note velocity:(int)velocity; - (void)noteOff:(int)note; - (void)allNotesOff; /// Load a WAV (Sampler: into pad [pad]) or SF2/XI (SF2/XI loader) into the current /// instrument. Returns NO with a message in [error] if the file can't be used. - (BOOL)loadSampleFromURL:(NSURL *)url pad:(int)pad error:(NSError **)error; /// Render every device offline for 10 s of audio (instruments with 8 notes held, /// effects on noise) and report each one's cost as a share of one CPU core. /// Lines arrive on the main thread; runs on a background thread. - (void)benchmark:(NS_SWIFT_UI_ACTOR void (^)(NSString *line))line done:(NS_SWIFT_UI_ACTOR void (^)(void))done; @end NS_ASSUME_NONNULL_END