Merge branch 'main' of git.rcmd.space:tiredsysadmin/sizzletracker-android
This commit is contained in:
@@ -7,11 +7,33 @@ same features; the Android side of each version is in `../CHANGELOG.md`.
|
||||
|
||||
## 0.41.1 (build 77)
|
||||
|
||||
<<<<<<< HEAD
|
||||
- Fix: some controls only showed their new state after something else redrew
|
||||
the screen (rotating the iPad): the Mix tab's ● ARM / TAIL / SHARE bar, the
|
||||
Sampler's slice markers, the LFO's target and the audition keyboards. They now
|
||||
redraw as soon as the song changes. (SwiftUI skipped them because none of their
|
||||
own inputs changed.)
|
||||
=======
|
||||
Housekeeping and speed; nothing you can see changes.
|
||||
|
||||
- **The DSP core is built at `-O2`.** It was `-Os`, which traded the engine's
|
||||
speed for a little binary size in an app that has to hold a 4 ms deadline. The
|
||||
golden tests measure the core at `-O2`, so the build that ships is now the
|
||||
build that was checked.
|
||||
- **The mixer costs less per sample.** Channel volume, mute/solo and the effect
|
||||
chain are read once per audio block rather than once per frame
|
||||
(`core/src/engine/Engine.cpp`, shared with Android). Bit-for-bit the same
|
||||
audio: all 61 reference scenarios still match.
|
||||
- **Less battery while a song is stopped.** The transport display polled the
|
||||
engine 30 times a second whatever was happening; stopped it now ticks 10 times
|
||||
a second, and any transport call — the PLAY button, a gamepad, a MIDI binding —
|
||||
starts the display-rate ticks in the same turn. The tick also stopped hopping
|
||||
through a task per poll, 30 times a second, for a main-thread timer that was
|
||||
already on the main actor.
|
||||
- **Dead code gone.** The golden tests' `TestVoice` wrappers were compiled into
|
||||
the app and the plugin extension although only `golden_test` calls them; they
|
||||
have moved to `core/tests/voices/`. A couple of unused declarations went too.
|
||||
>>>>>>> c1758637df9651f2c6a4ef6296509acb9d774186
|
||||
|
||||
## 0.41.0 (build 76)
|
||||
|
||||
|
||||
+18
-3
@@ -11,6 +11,8 @@
|
||||
# Android toolchain; runs IosGoldenExport in ../app)
|
||||
# make core-test build the C++ core and compare it with the reference audio
|
||||
# (TYPES="FILTER EQ10" limits it to some devices)
|
||||
# make bench print what the insert-FX chain and each effect cost (SECONDS=1
|
||||
# for a quick look); asserts nothing, so it is not part of check
|
||||
# make au-test macOS check of the AUv3 wrapper: every effect through AVAudioEngine
|
||||
# must match the core, plus parameters, presets and saved state
|
||||
# make project generate app/Sizzle.xcodeproj (components + XcodeGen)
|
||||
@@ -36,6 +38,10 @@ IPA := dist/$(APP_ID)_$(BUILD_NO).ipa
|
||||
# C++ DSP core: reference audio lives in ../core/golden/ (regenerated, not committed).
|
||||
CORE_SRC := $(wildcard ../core/src/*.cpp ../core/src/*/*.cpp)
|
||||
CORE_HDR := $(wildcard ../core/include/sizzle/*.hpp ../core/src/*/*.hpp)
|
||||
# The golden tests' TestVoice wrappers. They live under tests/, not src/, so neither
|
||||
# app compiles them: only golden_test calls makeTestVoice.
|
||||
VOICE_SRC := $(wildcard ../core/tests/voices/*.cpp)
|
||||
VOICE_HDR := ../core/tests/voices/TestVoice.hpp
|
||||
CXX ?= c++
|
||||
CXXFLAGS := -std=c++17 -O2 -Wall -Wextra -I../core/include -I../core/src -I../core/src/fx -lz
|
||||
GOLDEN := ../core/golden
|
||||
@@ -62,9 +68,9 @@ golden:
|
||||
./gradlew -q :app:testDebugUnitTest --tests '*IosGolden*' --rerun
|
||||
@ls $(GOLDEN)/*.scn | wc -l | xargs echo "reference scenarios:"
|
||||
|
||||
build/core/golden_test: $(CORE_SRC) $(CORE_HDR) ../core/tests/golden_test.cpp
|
||||
build/core/golden_test: $(CORE_SRC) $(CORE_HDR) $(VOICE_SRC) $(VOICE_HDR) ../core/tests/golden_test.cpp
|
||||
mkdir -p build/core
|
||||
$(CXX) $(CXXFLAGS) -o $@ $(CORE_SRC) ../core/tests/golden_test.cpp
|
||||
$(CXX) $(CXXFLAGS) -o $@ $(CORE_SRC) $(VOICE_SRC) ../core/tests/golden_test.cpp
|
||||
|
||||
build/core/sampler_test: $(CORE_SRC) $(CORE_HDR) ../core/tests/sampler_test.cpp
|
||||
mkdir -p build/core
|
||||
@@ -94,6 +100,15 @@ build/core/oneshot_test: $(CORE_SRC) $(CORE_HDR) ../core/tests/oneshot_test.cpp
|
||||
mkdir -p build/core
|
||||
$(CXX) $(CXXFLAGS) -o $@ $(CORE_SRC) ../core/tests/oneshot_test.cpp
|
||||
|
||||
build/core/bench: $(CORE_SRC) $(CORE_HDR) ../core/tests/bench.cpp
|
||||
mkdir -p build/core
|
||||
$(CXX) $(CXXFLAGS) -o $@ $(CORE_SRC) ../core/tests/bench.cpp
|
||||
|
||||
# Not part of core-test: it asserts nothing, it just prints what the DSP costs, and
|
||||
# the numbers only mean something on a quiet machine. SECONDS=1 for a quick look.
|
||||
bench: build/core/bench
|
||||
build/core/bench $(SECONDS)
|
||||
|
||||
build/core/midi_test: ../core/include/sizzle/Midi.hpp ../core/tests/midi_test.cpp
|
||||
mkdir -p build/core
|
||||
$(CXX) $(CXXFLAGS) -o $@ ../core/tests/midi_test.cpp
|
||||
@@ -220,4 +235,4 @@ $(SPIKE_IPA): $(SPIKE_PROJ)/project.pbxproj $(SPIKE_SRC)
|
||||
clean:
|
||||
rm -rf build dist
|
||||
|
||||
.PHONY: help golden core-test zip-test au-test project ipa bump-major bump-minor bump-patch bump spike-ipa clean
|
||||
.PHONY: help golden core-test bench zip-test au-test project ipa bump-major bump-minor bump-patch bump spike-ipa clean
|
||||
|
||||
+14
-4
@@ -10,6 +10,8 @@ Makefile (`make -C ios help`).
|
||||
| `../core/` | The shared C++ engine (Android plays through it too): a port of the Android app's Kotlin DSP |
|
||||
| `../core/include/sizzle/DeviceSpecs.gen.hpp` | Every device's parameters, generated from `ToolboxType` (Kotlin) |
|
||||
| `../core/tests/golden_test.cpp` | Compares the core with audio the Kotlin code renders |
|
||||
| `../core/tests/voices/` | The `TestVoice` wrappers `golden_test` drives the instruments through. Under `tests/`, not `src/`, so neither app compiles them |
|
||||
| `../core/tests/bench.cpp` | `make bench`: what the FX chain and each effect cost. Asserts nothing, so it is not part of `core-test` |
|
||||
| `app/components.txt` | The plugin list (AU type, subtype, device, name) |
|
||||
| `app/FX/` | The plugin extension: `SizzleDeviceAU` (shared: parameters, presets, state), `SizzleEffectAU` (aufx), `SizzleInstrumentAU` (aumu), `SizzleFXViewController` (factory + editor). The app compiles the same classes to host them itself |
|
||||
| `app/Host/SizzleSession*` | The bridge to the C++ song + engine (audio output, song lock, live-note queue); one category per screen |
|
||||
@@ -27,8 +29,11 @@ listed in `CHANGELOG.md` here.
|
||||
|
||||
## How the port is verified
|
||||
|
||||
The Kotlin DSP is the reference. `make golden` runs `IosGoldenExport` (a JVM unit
|
||||
test in the Android app, skipped by the normal `make check`), which:
|
||||
The Kotlin DSP is the reference. It lives in the Android app's **test** source set
|
||||
(`../app/src/test/java/.../audio`, `frasil`, `echofield`, `wavetable`) — both apps
|
||||
play `core/`, so it is no longer part of either one. `make golden` runs
|
||||
`IosGoldenExport` (a JVM unit test in the Android app, skipped by the normal
|
||||
`make check`), which:
|
||||
|
||||
- writes `DeviceSpecs.gen.hpp`, so iOS uses the same parameter definitions
|
||||
(keys, labels, ranges, defaults, choices) and the Mix Tightener presets;
|
||||
@@ -38,8 +43,13 @@ test in the Android app, skipped by the normal `make check`), which:
|
||||
`../core/golden/` (not committed; regenerate any time).
|
||||
|
||||
`make core-test` renders the same scenarios through the C++ core and requires a
|
||||
largest difference below 1e-4. Today all 25 pass; most are bit-exact, the rest
|
||||
differ by about one float ulp. Porting rules that make this possible:
|
||||
largest difference below 1e-4. Today all 61 pass; most are bit-exact, the rest
|
||||
differ by about one float ulp. It compiles the core at `-O2` — and so does Xcode
|
||||
(`GCC_OPTIMIZATION_LEVEL: 2` on the `SizzleCore` target in `app/project.yml`, in
|
||||
every configuration), so the build that ships is the build that was measured. An
|
||||
optimisation level is not a free choice here: it decides FP contraction, and the
|
||||
comparison only holds for the level the tests use. Porting rules that make this
|
||||
possible:
|
||||
|
||||
- translate line for line, keeping Kotlin's types: `Float` → `float`,
|
||||
`Double` → `double`, so every expression runs in the same precision;
|
||||
|
||||
@@ -20,7 +20,7 @@ final class AppModel: ObservableObject {
|
||||
@Published private(set) var revision = 0
|
||||
@Published var tab: Tab = .tracker
|
||||
|
||||
// Transport, polled ~30×/s.
|
||||
// Transport, polled 30×/s while playing (see pollTransport).
|
||||
@Published private(set) var isPlaying = false
|
||||
@Published private(set) var currentLine = 0
|
||||
@Published private(set) var currentBeat = 0
|
||||
@@ -45,13 +45,34 @@ final class AppModel: ObservableObject {
|
||||
|
||||
init() {
|
||||
observer = NotificationCenter.default.addObserver(forName: .SizzleSessionDidChange, object: nil, queue: .main) { [weak self] _ in
|
||||
Task { @MainActor in self?.revision += 1 }
|
||||
}
|
||||
timer = Timer.scheduledTimer(withTimeInterval: 1.0 / 30, repeats: true) { [weak self] _ in
|
||||
Task { @MainActor in self?.pollTransport() }
|
||||
// SizzleSession's -edit: announces transport calls too, so this is also
|
||||
// where the poll rate catches up: however playback was started — the
|
||||
// tracker's PLAY button, a gamepad, a MIDI binding — the display-rate
|
||||
// ticks begin in the same turn, not up to a tick later.
|
||||
Task { @MainActor in self?.revision += 1; self?.pollTransport() }
|
||||
}
|
||||
// The timer fires on the main run loop, so the body is already on the main
|
||||
// actor: assumeIsolated instead of `Task { @MainActor in … }`, which hopped
|
||||
// through an allocation and a scheduler turn 30 times a second forever.
|
||||
// Ticks while stopped only watch for isPlaying, so they run at 10×/s.
|
||||
startTimer(hz: Self.idleHz)
|
||||
}
|
||||
|
||||
private static let playingHz = 30.0
|
||||
private static let idleHz = 10.0
|
||||
|
||||
private func startTimer(hz: Double) {
|
||||
timer?.invalidate()
|
||||
timerHz = hz
|
||||
let t = Timer(timeInterval: 1.0 / hz, repeats: true) { [weak self] _ in
|
||||
MainActor.assumeIsolated { self?.pollTransport() }
|
||||
}
|
||||
RunLoop.main.add(t, forMode: .common)
|
||||
timer = t
|
||||
}
|
||||
|
||||
private var timerHz = 0.0
|
||||
|
||||
private func pollTransport() {
|
||||
let playing = session.isPlaying
|
||||
if playing != isPlaying { isPlaying = playing }
|
||||
@@ -60,8 +81,19 @@ final class AppModel: ObservableObject {
|
||||
if line != currentLine { currentLine = line }
|
||||
if beat != currentBeat { currentBeat = beat }
|
||||
}
|
||||
// Follow the playhead at display rate; idle at a third of that, which is what
|
||||
// a stopped song needs to notice someone else starting it.
|
||||
let want = playing ? Self.playingHz : Self.idleHz
|
||||
if want != timerHz { startTimer(hz: want) }
|
||||
}
|
||||
|
||||
func playPause() { session.isPlaying ? session.pause() : session.play() }
|
||||
func stop() { session.stop() }
|
||||
func playPause() {
|
||||
session.isPlaying ? session.pause() : session.play()
|
||||
pollTransport()
|
||||
}
|
||||
|
||||
func stop() {
|
||||
session.stop()
|
||||
pollTransport()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,11 +21,6 @@ final class PluginCheck: ObservableObject {
|
||||
.filter { [kAudioUnitType_Effect, kAudioUnitType_MusicDevice].contains($0.audioComponentDescription.componentType) }
|
||||
}
|
||||
|
||||
func listInstalled() {
|
||||
let comps = installed()
|
||||
lines = ["Registered plugins (extension): \(comps.count)"] + comps.map { " \($0.name)" }
|
||||
}
|
||||
|
||||
func run() async {
|
||||
running = true
|
||||
defer { running = false }
|
||||
|
||||
@@ -113,31 +113,6 @@ struct SetupRow: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// An Android settings section not ported yet: its place in the layout, greyed
|
||||
/// out and marked as coming later.
|
||||
struct ComingLaterRow: View {
|
||||
let title: String
|
||||
let subtitle: String
|
||||
let icon: String
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: icon).font(.system(size: 16)).foregroundColor(Theme.dim).frame(width: 24)
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(title).font(.system(size: 15, weight: .medium)).foregroundColor(Theme.dim)
|
||||
Text(subtitle).font(.system(size: 12)).foregroundColor(Theme.dim.opacity(0.75)).lineLimit(2)
|
||||
}
|
||||
Spacer(minLength: 8)
|
||||
Text("Later").font(.system(size: 11)).foregroundColor(Theme.dim)
|
||||
.padding(.horizontal, 8).padding(.vertical, 3)
|
||||
.overlay(Capsule().stroke(Theme.grid, lineWidth: 1))
|
||||
.fixedSize()
|
||||
}
|
||||
.padding(.vertical, 4)
|
||||
.accessibilityElement(children: .combine)
|
||||
.accessibilityHint("Coming in a later version")
|
||||
}
|
||||
}
|
||||
|
||||
/// The Setup tab's modal dialogs. iOS 15 alerts can't hold a text field, so the
|
||||
/// save prompt (and with it every dialog here, for one look) is drawn in SwiftUI.
|
||||
|
||||
+6
-1
@@ -25,7 +25,12 @@ targets:
|
||||
settings:
|
||||
base:
|
||||
PRODUCT_NAME: SizzleCore
|
||||
GCC_OPTIMIZATION_LEVEL: s
|
||||
# -O2 in every configuration, matching ios/Makefile's CXXFLAGS — the one
|
||||
# build of this code the golden tests actually measure. It was -Os, which
|
||||
# trades the DSP's speed for a few hundred KB in an app that has to hold a
|
||||
# 4 ms deadline; and optimising Debug too is deliberate (the Android
|
||||
# CMakeLists does the same), because an -O0 core cannot render in real time.
|
||||
GCC_OPTIMIZATION_LEVEL: 2
|
||||
SizzleFX:
|
||||
type: app-extension
|
||||
platform: iOS
|
||||
|
||||
Reference in New Issue
Block a user