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:
co-authored by
Claude Opus 5.5
parent
a5b2f4c873
commit
7f231c8f79
@@ -1,8 +1,9 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// The FX extension's principal class: the factory for every effect listed in
|
||||
// components.txt (picked by subtype) and a generic editor for its parameters
|
||||
// The extension's principal class: the factory for every device listed in
|
||||
// components.txt (picked by subtype; instruments and effects) and a generic editor
|
||||
// for its parameters
|
||||
// (sliders, segmented switches for short choice lists, menus for long ones).
|
||||
// The card-style editors of the Android app come later; this keeps every
|
||||
// parameter reachable meanwhile.
|
||||
@@ -10,16 +11,13 @@
|
||||
#import <CoreAudioKit/CoreAudioKit.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "Components.gen.h"
|
||||
#import "SizzleEffectAU.h"
|
||||
|
||||
@interface SizzleFXViewController : AUViewController <AUAudioUnitFactory>
|
||||
@end
|
||||
#import "SizzleFXViewController.h"
|
||||
|
||||
static UIColor *Amber(void) { return [UIColor colorWithRed:0.96 green:0.76 blue:0.29 alpha:1]; }
|
||||
static UIColor *Dim(void) { return [UIColor colorWithWhite:0.62 alpha:1]; }
|
||||
|
||||
@implementation SizzleFXViewController {
|
||||
SizzleEffectAU *_au;
|
||||
SizzleDeviceAU *_au;
|
||||
UIStackView *_stack;
|
||||
NSMutableDictionary<NSNumber *, UIControl *> *_controls;
|
||||
NSMutableDictionary<NSNumber *, UILabel *> *_valueLabels;
|
||||
@@ -30,18 +28,15 @@ static UIColor *Dim(void) { return [UIColor colorWithWhite:0.62 alpha:1]; }
|
||||
#pragma mark - factory
|
||||
|
||||
- (AUAudioUnit *)createAudioUnitWithComponentDescription:(AudioComponentDescription)desc error:(NSError **)error {
|
||||
for (int i = 0; i < kSizzleComponentCount; ++i) {
|
||||
if (kSizzleComponents[i].subtype == desc.componentSubType) {
|
||||
_au = [[SizzleEffectAU alloc] initWithComponentDescription:desc
|
||||
toolboxType:kSizzleComponents[i].toolboxType
|
||||
displayName:@(kSizzleComponents[i].name)
|
||||
error:error];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{ [self buildIfReady]; });
|
||||
return _au;
|
||||
}
|
||||
}
|
||||
if (error) *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:kAudioUnitErr_InvalidElement userInfo:nil];
|
||||
return nil;
|
||||
_au = [[[SizzleDeviceAU classForComponentType:desc.componentType] alloc]
|
||||
initWithComponentDescription:desc options:0 error:error];
|
||||
if (_au) dispatch_async(dispatch_get_main_queue(), ^{ [self buildIfReady]; });
|
||||
return _au;
|
||||
}
|
||||
|
||||
- (void)attachAudioUnit:(SizzleDeviceAU *)au {
|
||||
_au = au;
|
||||
[self buildIfReady];
|
||||
}
|
||||
|
||||
#pragma mark - view
|
||||
@@ -96,7 +91,7 @@ static UIColor *Dim(void) { return [UIColor colorWithWhite:0.62 alpha:1]; }
|
||||
presets.tintColor = Amber();
|
||||
presets.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
||||
NSMutableArray<UIAction *> *items = [NSMutableArray array];
|
||||
__weak SizzleEffectAU *au = _au;
|
||||
__weak SizzleDeviceAU *au = _au;
|
||||
__weak UIButton *weakButton = presets;
|
||||
for (AUAudioUnitPreset *p in _au.factoryPresets) {
|
||||
[items addObject:[UIAction actionWithTitle:p.name image:nil identifier:nil handler:^(UIAction *a) {
|
||||
|
||||
Reference in New Issue
Block a user