Files
sizzletracker-android/ios/app/Host/Bespoke/SlotDataSource+Viz.swift
T
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

19 lines
772 B
Swift

// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
/// The live effect scope of a song slot (the Granular Glitch's), straight from the
/// engine's channel chains: nil until the slot sits on a mixer channel's FX.
extension SlotDataSource {
func effectScope(capacity: Int) -> (samples: [Float], playhead: Float)? {
guard capacity > 0 else { return nil }
var buf = [Float](repeating: 0, count: capacity)
let n = buf.withUnsafeMutableBufferPointer { p in
session.copyEffectScope(ofSlot: slot, into: p.baseAddress!, capacity: p.count)
}
guard n >= 0 else { return nil }
return (Array(buf.prefix(n)), session.effectPlayhead(ofSlot: slot))
}
}