- 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>
41 lines
1.6 KiB
Swift
41 lines
1.6 KiB
Swift
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import SwiftUI
|
|
|
|
/// Everything that runs once at launch, before any screen (Android's SizzleApp):
|
|
/// settings that live outside the song, MIDI, and the hardware input sources.
|
|
@MainActor
|
|
enum AppBoot {
|
|
static func start() {
|
|
let settings = AppSettings.shared
|
|
let session = SizzleSession.shared
|
|
session.recordTailBars = settings.recordTailBars
|
|
ThemeLibrary.shared.select(settings.paletteName)
|
|
|
|
let input = InputController.shared
|
|
input.app = AppModel.main
|
|
input.start()
|
|
HardwareInput.shared.start()
|
|
|
|
let midi = SizzleMidi.shared
|
|
midi.sendClock = settings.sendMidiClock
|
|
midi.receiveClock = settings.receiveMidiClock
|
|
midi.soundModule = settings.soundModule
|
|
midi.onNote = { on, ch, note, vel in input.midiNote(on: on, channel: ch, note: note, velocity: vel) }
|
|
midi.onControl = { cc, value in input.midiControl(cc, value) }
|
|
midi.start(withDisabledKeys: settings.midiSourcesOff)
|
|
}
|
|
|
|
/// Leaving the foreground: save, and unless Sizzle stays on as a sound module
|
|
/// (or is playing / recording), pause the audio so iOS can suspend the app.
|
|
static func background() {
|
|
let session = SizzleSession.shared
|
|
session.autosave()
|
|
let busy = session.isPlaying || session.masterRecording || SampleRecorder.shared.isRecording
|
|
if !AppSettings.shared.soundModule && !busy { session.audioSuspended = true }
|
|
}
|
|
|
|
static func foreground() { SizzleSession.shared.audioSuspended = false }
|
|
}
|