// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown // SPDX-License-Identifier: GPL-3.0-or-later #import "SizzleSession.h" NS_ASSUME_NONNULL_BEGIN /// The Wavetable's and the Grain Cloud's own sounds (AppViewModel.loadWavetable / /// loadGrainSample) and what their editors draw of them. /// /// Custom wavetables: the WAV is kept like any other sample (sample store and /// Documents/samples/.wav, the slot's `sfSample`), and its table is built off /// the audio thread: right after a load, and whenever the song changes and a /// Wavetable slot plays a Custom table that isn't built yet (a loaded song, a new /// frame length). The audio thread only ever finds a built table or none (silent). @interface SizzleSession (Sources) /// A wavetable WAV (Serum's, WaveEdit's or power-of-two frames) becomes Wavetable /// [slot]'s Custom table: `sfSample` = the stored sample, `wtframe` = the detected /// frame length (or Auto), `o1table` = Custom. The table is built in the background. - (BOOL)loadWavetableData:(NSData *)data name:(NSString *)name intoSlot:(NSInteger)slot error:(NSError **)error; /// A WAV (or an SF2/XI's sample) becomes Grain Cloud [slot]'s own source /// (`sfSample`, `source` = Custom). - (BOOL)loadGrainSourceData:(NSData *)data name:(NSString *)name intoSlot:(NSInteger)slot error:(NSError **)error; /// Oscillator [osc]'s table of Wavetable [slot], level 0: [frames] x [size] floats. /// Nil while it isn't built (a Custom table is then built in the background; ask again). - (nullable NSData *)wavetableOfSlot:(NSInteger)slot osc:(NSInteger)osc frames:(NSInteger *)frames size:(NSInteger *)size; /// Peak envelope (|x| max per bucket, 0..1, [buckets] floats) of the sample [slot]'s /// setting [key] names: a Grain Cloud's `source` (a built-in source, or with Custom /// its own sample), otherwise a sample id (`sfSample`, `padN`). Nil while it has none. - (nullable NSData *)samplePeaksOfSlot:(NSInteger)slot key:(NSString *)key buckets:(NSInteger)buckets; /// Length in seconds of that same sample, or 0. - (double)sampleSecondsOfSlot:(NSInteger)slot key:(NSString *)key; @end NS_ASSUME_NONNULL_END