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:
co-authored by
Claude Opus 5.5
parent
435305e42a
commit
64e21e0bcc
@@ -0,0 +1,50 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// Android's MidiLearnPopup: every parameter of the slot with its MIDI CC. LEARN,
|
||||
/// then move a knob or fader on a MIDI controller; ✕ removes the binding. The
|
||||
/// bindings are saved in the song (`midicc@<key>` slot values), as on Android.
|
||||
struct MidiLearnSheet: View {
|
||||
let slot: Int
|
||||
let type: String
|
||||
@ObservedObject private var input = InputController.shared
|
||||
@ObservedObject private var watch = MixSongWatch.shared
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
var body: some View {
|
||||
let session = SizzleSession.shared
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
HStack {
|
||||
Text("MIDI LEARN — \(session.name(ofSlot: slot))").font(Theme.mono(14)).foregroundColor(Theme.accent)
|
||||
Spacer()
|
||||
Text("DONE").font(Theme.mono(13)).foregroundColor(Theme.dim)
|
||||
.contentShape(Rectangle()).onTapGesture { dismiss() }
|
||||
}
|
||||
Text("Tap LEARN, then move a knob/fader on your MIDI controller.").font(Theme.mono(10)).foregroundColor(Theme.dim)
|
||||
SnapScroll {
|
||||
VStack(spacing: 6) {
|
||||
ForEach(SizzleSession.paramSpecs(forType: type), id: \.key) { spec in
|
||||
let arming = input.paramLearnSlot == slot && input.paramLearnKey == spec.key
|
||||
let cc = input.paramCc(slot: slot, key: spec.key)
|
||||
HStack(spacing: 8) {
|
||||
Text(spec.label).font(Theme.mono(12)).foregroundColor(Theme.text)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Text(arming ? "waiting…" : cc.map { "CC \($0)" } ?? "—").font(Theme.mono(11))
|
||||
.foregroundColor(arming ? Theme.accent : Theme.dim).frame(width: 72, alignment: .leading)
|
||||
MixKit.Button(label: arming ? "ARMING" : "LEARN", active: arming, width: 78) {
|
||||
if arming { input.cancelParamLearn() } else { input.beginParamLearn(slot: slot, key: spec.key) }
|
||||
}
|
||||
MixKit.Button(label: "✕") { input.clearParamCc(slot: slot, key: spec.key) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(16)
|
||||
.background(Theme.surface.ignoresSafeArea())
|
||||
.preferredColorScheme(.dark)
|
||||
.onDisappear { input.cancelParamLearn() }
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ struct SamplerDetail: View {
|
||||
let onSelectPad: (Int) -> Void
|
||||
let onImport: () -> Void
|
||||
@State private var page = 0
|
||||
@ObservedObject private var recorder = SampleRecorder.shared
|
||||
|
||||
var body: some View {
|
||||
let session = SizzleSession.shared
|
||||
@@ -28,6 +29,15 @@ struct SamplerDetail: View {
|
||||
MixKit.HScroll {
|
||||
HStack(spacing: 8) {
|
||||
MixKit.Button(label: "IMPORT WAV", action: onImport)
|
||||
if recorder.isRecording {
|
||||
MixKit.Button(label: "■ STOP REC", active: true) {
|
||||
recorder.stopInto(slot: slot, pad: pad)
|
||||
session.setNumber(0, ofSlot: slot, key: "pad\(pad)S")
|
||||
session.setNumber(1, ofSlot: slot, key: "pad\(pad)E")
|
||||
}
|
||||
} else {
|
||||
MixKit.Button(label: "● RECORD") { recorder.start() }
|
||||
}
|
||||
if assigned {
|
||||
MixKit.Button(label: "✂ CLIP") { _ = session.trimPad(pad, ofSlot: slot) }
|
||||
MixKit.Button(label: "NORMALIZE") { _ = session.normalizePad(pad, ofSlot: slot) }
|
||||
|
||||
@@ -20,6 +20,7 @@ struct SlotEditor: View {
|
||||
|
||||
@StateObject private var model: DeviceModel
|
||||
@ObservedObject private var watch = MixSongWatch.shared
|
||||
@ObservedObject private var recorder = SampleRecorder.shared
|
||||
@State private var pad = 0
|
||||
/// What the file picker is for; kept after it closes, because SwiftUI resets
|
||||
/// the presentation binding before calling the completion handler.
|
||||
@@ -27,6 +28,7 @@ struct SlotEditor: View {
|
||||
@State private var pickerShown = false
|
||||
@State private var deviceCallback: ((URL) -> Void)?
|
||||
@State private var importError: String?
|
||||
@State private var showMidiLearn = false
|
||||
|
||||
enum ImportKind: Identifiable {
|
||||
case preset, padSample, soundFont, device // device: a bespoke view's own load (deviceFilePicker)
|
||||
@@ -71,6 +73,11 @@ struct SlotEditor: View {
|
||||
}
|
||||
.alert("Import failed", isPresented: Binding(get: { importError != nil }, set: { if !$0 { importError = nil } }),
|
||||
actions: { Button("OK") { importError = nil } }, message: { Text(importError ?? "") })
|
||||
.background(Color.clear.alert("Recording", isPresented: Binding(get: { recorder.error != nil }, set: { if !$0 { recorder.error = nil } }),
|
||||
actions: { Button("OK") { recorder.error = nil } }, message: { Text(recorder.error ?? "") }))
|
||||
.onDisappear { if recorder.isRecording { _ = recorder.stop() } }
|
||||
.onChange(of: watch.revision) { _ in model.refresh() } // MIDI CCs move parameters too
|
||||
.sheet(isPresented: $showMidiLearn) { MidiLearnSheet(slot: slot, type: type) }
|
||||
}
|
||||
|
||||
@ViewBuilder private var pinnedPart: some View {
|
||||
@@ -87,6 +94,9 @@ struct SlotEditor: View {
|
||||
HStack {
|
||||
Text(session.name(ofSlot: slot)).font(Theme.mono(15)).foregroundColor(Theme.accent).lineLimit(1)
|
||||
Spacer()
|
||||
Text("⇄ MIDI").font(Theme.mono(13)).foregroundColor(Theme.accent)
|
||||
.contentShape(Rectangle()).onTapGesture { showMidiLearn = true }
|
||||
.padding(.trailing, 14)
|
||||
Text("CLOSE ✕").font(Theme.mono(13)).foregroundColor(Theme.dim)
|
||||
.contentShape(Rectangle()).onTapGesture(perform: onClose)
|
||||
}
|
||||
@@ -104,6 +114,9 @@ struct SlotEditor: View {
|
||||
importing = .device
|
||||
pickerShown = true
|
||||
}
|
||||
.environment(\.deviceRecorder, DeviceRecordControl(isRecording: recorder.isRecording) {
|
||||
if recorder.isRecording { recorder.stopIntoGrain(slot: slot) } else { recorder.start() }
|
||||
})
|
||||
.frame(minHeight: 0, maxHeight: .infinity, alignment: .top).clipped()
|
||||
if type == "LFO" { LfoTargetPicker(lfo: slot) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user