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>
This commit is contained in:
Reactorcoremeltdown
2026-11-16 16:39:33 +01:00
co-authored by Claude Opus 5.5
parent 6688718bed
commit 5240019b47
14 changed files with 417 additions and 5 deletions
@@ -147,7 +147,8 @@ struct SlotEditor: View {
let name = url.deletingPathExtension().lastPathComponent
switch kind {
case .preset:
guard let text = String(data: data, encoding: .utf8), session.importPresetText(text, intoSlot: slot) else {
// Preset text, or a bundle with its sounds (how Android shares Sampler presets).
guard session.importPresetData(data, intoSlot: slot) else {
let display = SizzleSession.deviceTypes.first { $0.type == type }?.displayName ?? type
importError = "Couldn't import this preset. The file may be corrupt, or not a valid \(display) preset or bundle."
return
@@ -295,7 +296,7 @@ private struct PresetBar: View {
let name = slotName.trimmingCharacters(in: .whitespaces).isEmpty ? displayName : slotName
_ = session.savePreset(ofSlot: slot, name: name)
names = session.libraryPresets(forType: type)
guard let url = session.presetFile(forType: type, name: name) else { return }
guard let url = session.presetShareURL(forType: type, name: name) else { return }
#if canImport(UIKit)
let vc = UIActivityViewController(activityItems: [url], applicationActivities: nil)
let root = UIApplication.shared.connectedScenes.compactMap { ($0 as? UIWindowScene)?.keyWindow }.first?.rootViewController