Files
ReactorcoremeltdownandClaude Opus 5.5 435305e42a iOS 0.5.0: hand-built editors (Tape Delay, Tape Engine, Mix Tightener, Granular scope, Wavetable tables, Grain Cloud source)
Effect visualisation through the C++ effect, engine and AU; custom wavetables and
grain sources load and persist with the song; the app's slot editor hosts the
file picker for bespoke views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 10:01:14 +01:00

38 lines
1.3 KiB
Plaintext

// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
#import "SizzleSession+Viz.h"
#import "SizzleSession+Internal.h"
#import <objc/runtime.h>
using namespace sizzle;
static char kVizEngineKey;
@implementation SizzleSession (Viz)
/// The engine, without the song lock: polling under it at display rate would make
/// the audio thread (which only try-locks) drop a block now and then. The engine is
/// created once with the session and lives as long as it, so its address is fetched
/// once under the lock and kept; Engine::effectScope / effectPlayhead are lock-free.
- (const engine::Engine *)vizEngine {
NSValue *v = objc_getAssociatedObject(self, &kVizEngineKey);
if (!v) {
__block const engine::Engine *e = nullptr;
[self read:^(const model::Project &, const engine::Engine &eng) { e = &eng; }];
v = [NSValue valueWithPointer:e];
objc_setAssociatedObject(self, &kVizEngineKey, v, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
return (const engine::Engine *)v.pointerValue;
}
- (NSInteger)copyEffectScopeOfSlot:(NSInteger)slot into:(float *)out capacity:(NSInteger)capacity {
return self.vizEngine->effectScope((int)slot, out, (int)capacity);
}
- (float)effectPlayheadOfSlot:(NSInteger)slot {
return self.vizEngine->effectPlayhead((int)slot);
}
@end