Files
ReactorcoremeltdownandClaude Opus 5.5 5240019b47 0.39.1 (74): preset bundles between Android and iOS, both ways
iOS couldn't import Android's Sampler preset bundle (a ZIP with the .szp and
its WAVs) and shared sample presets as bare text naming iOS sample ids.

- core/src/io/PresetBundle: import/export in Android's bundle layout
  (padNFile / sfFile), used by iOS IMPORT and SHARE
- bundle_test imports a bundle written by Android's PresetLibrary
  (IosGoldenPresetBundle); PresetBundleInteropTest imports the iOS-written
  fixture with Android's importZip

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

55 lines
2.9 KiB
Objective-C

// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
#import "SizzleSession.h"
NS_ASSUME_NONNULL_BEGIN
/// API the Mix and Toolbox screens need beyond SizzleSession.h.
@interface SizzleSession (Mix)
#pragma mark - Slot samples (Sampler pads "padN", the SF2/XI loader's "sfSample")
/// Frames / sample rate of the sample a slot key refers to (0 when none is loaded).
- (NSInteger)sampleFramesOfSlot:(NSInteger)slot key:(NSString *)key;
- (NSInteger)sampleRateOfSlot:(NSInteger)slot key:(NSString *)key;
/// The sample as [buckets] (min, max) float pairs for drawing (Android's computePeaks),
/// or nil when none is loaded.
- (nullable NSData *)samplePeaksOfSlot:(NSInteger)slot key:(NSString *)key buckets:(NSInteger)buckets;
/// SamplerEditor's CLIP: replace the pad's sample with its slice; markers reset. NO if nothing to trim.
- (BOOL)trimPad:(NSInteger)pad ofSlot:(NSInteger)slot;
/// NORMALIZE: peak-normalise the pad's sample to full scale. NO if empty, silent or already full.
- (BOOL)normalizePad:(NSInteger)pad ofSlot:(NSInteger)slot;
/// CLEAR: forget the pad's sample and slice markers.
- (void)clearPad:(NSInteger)pad ofSlot:(NSInteger)slot;
#pragma mark - MIDI LFO
/// Point LFO [slot] at [target]'s parameter [key] ("slot:key"), capturing that
/// parameter's current value as the modulation centre; target < 0 clears it.
- (void)setLfoTargetOfSlot:(NSInteger)slot target:(NSInteger)target key:(NSString *)key;
#pragma mark - Preset library (Documents/presets/<TYPE>/<name>.szp, PresetIo text)
/// Saved presets for a device type, alphabetically. The type's factory presets are
/// written into the library the first time (Android's seedFactoryPresets), so a
/// deleted one stays deleted.
- (NSArray<NSString *> *)libraryPresetsForType:(NSString *)type;
/// Save [slot] under [name] (the slot takes that name).
- (BOOL)savePresetOfSlot:(NSInteger)slot name:(NSString *)name;
/// Load a saved preset into [slot] (renamed to the preset).
- (BOOL)loadPreset:(NSString *)name intoSlot:(NSInteger)slot;
- (BOOL)deletePreset:(NSString *)name type:(NSString *)type;
/// Import preset text into [slot] (it takes the preset's device type) and save it to the library.
- (BOOL)importPresetText:(NSString *)text intoSlot:(NSInteger)slot;
/// The preset's file, for sharing (nil when missing).
- (nullable NSURL *)presetFileForType:(NSString *)type name:(NSString *)name;
/// Import a picked preset file into [slot]: preset text, or a bundle (a ZIP with
/// the preset and its WAVs, as Android shares Sampler, SF2/XI, Grain Cloud and
/// Wavetable presets). Saved to the library like importPresetText.
- (BOOL)importPresetData:(NSData *)data intoSlot:(NSInteger)slot;
/// What SHARE sends for a saved preset: a bundle with its sounds (Android's
/// layout) for the device types that carry samples, else the .szp itself.
- (nullable NSURL *)presetShareURLForType:(NSString *)type name:(NSString *)name;
@end
NS_ASSUME_NONNULL_END