iOS 0.6.0: milestone 5 (recording, MIDI, input bindings, themes, bundles, backups)

- Master recording (MasterSink ring + writer thread) and the sample recorder
- CoreMIDI in/out: sound module, clock send/follow, virtual "Sizzle" ports;
  platform-free parser/module/clock in core (midi_test)
- Hardware keyboard and gamepads via GameController; rebindable keyboard,
  gamepad and MIDI CC actions; per-parameter MIDI learn
- Colour themes (.szt), project bundles (.szgz), backup & restore;
  ZIP in core with zlib (zip_test against jar and unzip)
- Persistent app settings; audio pauses in the background unless sound module

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Reactorcoremeltdown
2026-11-16 14:26:01 +01:00
co-authored by Claude Opus 5.5
parent 435305e42a
commit 64e21e0bcc
54 changed files with 3303 additions and 97 deletions
+23 -1
View File
@@ -17,6 +17,28 @@ enum SetupFiles {
return url
}
/// Writes [data] to a fresh temporary folder as "<name>.<ext>".
static func export(_ data: Data, name: String, ext: String) throws -> URL {
let root = FileManager.default.temporaryDirectory.appendingPathComponent("Exports", isDirectory: true)
try? FileManager.default.removeItem(at: root)
let dir = root.appendingPathComponent(UUID().uuidString, isDirectory: true)
try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
let url = dir.appendingPathComponent(name).appendingPathExtension(ext)
try data.write(to: url)
return url
}
/// Reads a picked file (security-scoped), refusing anything over [limit] bytes.
static func readData(_ url: URL, limit: Int) throws -> Data {
let scoped = url.startAccessingSecurityScopedResource()
defer { if scoped { url.stopAccessingSecurityScopedResource() } }
let size = (try? url.resourceValues(forKeys: [.fileSizeKey]).fileSize) ?? 0
guard size <= limit else { throw SetupFileError.tooLarge }
let data = try Data(contentsOf: url)
guard data.count <= limit else { throw SetupFileError.tooLarge }
return data
}
/// The song name as a file name: path separators replaced, blank → "untitled".
static func fileStem(_ name: String) -> String {
let trimmed = name.trimmingCharacters(in: .whitespacesAndNewlines)
@@ -42,7 +64,7 @@ enum SetupFileError: LocalizedError {
case tooLarge, notText
var errorDescription: String? {
switch self {
case .tooLarge: return "The file is too large to be a Sizzle song."
case .tooLarge: return "The file is too large for Sizzle."
case .notText: return "Couldn't read the selected file."
}
}