Compare commits
2
Commits
c8d760ed17
...
e38e2a2707
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e38e2a2707 | ||
|
|
3088912264 |
@@ -4,6 +4,20 @@ Sizzletracker for Android (`cc.tiredsysadmin.android.sizzle`). One entry per
|
|||||||
version in `versions.properties`; versions before 0.28.0 are described in the git
|
version in `versions.properties`; versions before 0.28.0 are described in the git
|
||||||
log (one commit per version).
|
log (one commit per version).
|
||||||
|
|
||||||
|
## 0.34.0 (versionCode 65)
|
||||||
|
|
||||||
|
- **Recording follows MIDI clock:** while ● ARM is on, an external clock Start (or
|
||||||
|
Continue) starts the master recording and its Stop ends it after the TAIL, the
|
||||||
|
same as Sizzle's own Play/Stop. Works in sound-module mode, where the clock
|
||||||
|
doesn't start Sizzle's song, and whether or not "Receive MIDI clock" is on.
|
||||||
|
Sizzle's own Stop also ends a clock-started take.
|
||||||
|
|
||||||
|
## 0.33.0 (versionCode 64)
|
||||||
|
|
||||||
|
- **Mix tab:** long-press an instrument or FX slot to open that device's settings
|
||||||
|
(the Toolbox editor); closing it returns to the Mix. A short tap still picks the
|
||||||
|
device.
|
||||||
|
|
||||||
## 0.32.0 (versionCode 63)
|
## 0.32.0 (versionCode 63)
|
||||||
|
|
||||||
- **Wavetable**, a new two-oscillator wavetable synth: twelve built-in tables
|
- **Wavetable**, a new two-oscillator wavetable synth: twelve built-in tables
|
||||||
|
|||||||
@@ -193,6 +193,12 @@ class SizzleApp : Application() {
|
|||||||
main.post { audioEngine.pause() }
|
main.post { audioEngine.pause() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// An armed master recording follows the external clock's Start/Stop in every
|
||||||
|
// mode (in sound-module mode the clock doesn't start Sizzle's own song).
|
||||||
|
midiClock.onTransport = { start ->
|
||||||
|
if (MidiTrace.on && audioEngine.recordArmed) MidiTrace.log("clock ${if (start) "Start: armed recording starts" else "Stop: recording ends after its tail"}")
|
||||||
|
main.post { if (start) audioEngine.externalClockStart() else audioEngine.externalClockStop() }
|
||||||
|
}
|
||||||
midiClock.onReceiveTempo = { bpm -> main.post { project.tempoBpm = bpm.coerceIn(20f, 300f) } }
|
midiClock.onReceiveTempo = { bpm -> main.post { project.tempoBpm = bpm.coerceIn(20f, 300f) } }
|
||||||
val s = runBlocking { settingsStore.load() }
|
val s = runBlocking { settingsStore.load() }
|
||||||
midiClock.sendEnabled = s.sendMidiClock
|
midiClock.sendEnabled = s.sendMidiClock
|
||||||
|
|||||||
@@ -306,6 +306,10 @@ class AudioEngine(
|
|||||||
// Audio-thread recording state machine (see [recordSample]). Initialized in
|
// Audio-thread recording state machine (see [recordSample]). Initialized in
|
||||||
// [maybeStartRecording] before the volatile [recCapturing] flag publishes them.
|
// [maybeStartRecording] before the volatile [recCapturing] flag publishes them.
|
||||||
@Volatile private var recCapturing = false
|
@Volatile private var recCapturing = false
|
||||||
|
/** An external MIDI clock is running (between its Start and Stop): an armed
|
||||||
|
* recording captures while either it or the sequencer runs, and its tail starts
|
||||||
|
* when both have stopped. */
|
||||||
|
@Volatile private var extClockRunning = false
|
||||||
private var recWasPlaying = false
|
private var recWasPlaying = false
|
||||||
private var recTailRemaining = 0
|
private var recTailRemaining = 0
|
||||||
|
|
||||||
@@ -334,7 +338,7 @@ class AudioEngine(
|
|||||||
* regardless of [playing], so the tail contains real decaying reverb/delay audio.
|
* regardless of [playing], so the tail contains real decaying reverb/delay audio.
|
||||||
*/
|
*/
|
||||||
private fun recordSample(proj: Project?, left: Float, right: Float) {
|
private fun recordSample(proj: Project?, left: Float, right: Float) {
|
||||||
val nowPlaying = playing
|
val nowPlaying = playing || extClockRunning
|
||||||
if (recWasPlaying && !nowPlaying) {
|
if (recWasPlaying && !nowPlaying) {
|
||||||
recTailRemaining = if (proj == null) 0
|
recTailRemaining = if (proj == null) 0
|
||||||
else (recTailBars * proj.timeSignature.linesPerBar * samplesPerLine(proj)).toInt()
|
else (recTailBars * proj.timeSignature.linesPerBar * samplesPerLine(proj)).toInt()
|
||||||
@@ -351,6 +355,17 @@ class AudioEngine(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** An external MIDI clock sent Start (or Continue): start an armed recording, even
|
||||||
|
* while Sizzle's own sequencer stays stopped (sound-module mode). */
|
||||||
|
fun externalClockStart() {
|
||||||
|
extClockRunning = true
|
||||||
|
maybeStartRecording()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The external clock sent Stop: an armed recording ends after its FX tail (once
|
||||||
|
* Sizzle's own sequencer isn't playing either). */
|
||||||
|
fun externalClockStop() { extClockRunning = false }
|
||||||
|
|
||||||
fun setProject(p: Project) {
|
fun setProject(p: Project) {
|
||||||
project = p
|
project = p
|
||||||
rebuildArrangement()
|
rebuildArrangement()
|
||||||
@@ -558,7 +573,7 @@ class AudioEngine(
|
|||||||
publish()
|
publish()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pause() { playing = false; allSeqVoicesOff(); publish() }
|
fun pause() { playing = false; extClockRunning = false; allSeqVoicesOff(); publish() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MIDI panic: immediately hard-silence every voice — sequencer, live (keyboard/
|
* MIDI panic: immediately hard-silence every voice — sequencer, live (keyboard/
|
||||||
@@ -583,6 +598,7 @@ class AudioEngine(
|
|||||||
|
|
||||||
/** Stop playback. If already stopped, rewind to the very beginning. */
|
/** Stop playback. If already stopped, rewind to the very beginning. */
|
||||||
fun stop() {
|
fun stop() {
|
||||||
|
extClockRunning = false // Sizzle's Stop also ends a take an external clock started
|
||||||
if (!playing && currentLine == 0 && playlistIndex == 0 && lineInBeat == 0) return
|
if (!playing && currentLine == 0 && playlistIndex == 0 && lineInBeat == 0) return
|
||||||
val wasStopped = !playing
|
val wasStopped = !playing
|
||||||
playing = false
|
playing = false
|
||||||
|
|||||||
@@ -151,7 +151,17 @@ class MidiClock(context: Context) {
|
|||||||
private var pulseAccum = 0.0
|
private var pulseAccum = 0.0
|
||||||
private var pulseCount = 0
|
private var pulseCount = 0
|
||||||
|
|
||||||
|
/** An external transport edge (Start / Continue = true, Stop = false), reported
|
||||||
|
* whether or not [receiveEnabled]: an armed master recording follows another
|
||||||
|
* app's or device's Start/Stop even when Sizzle doesn't follow its clock. Called
|
||||||
|
* on the MIDI port's thread. */
|
||||||
|
var onTransport: ((Boolean) -> Unit)? = null
|
||||||
|
|
||||||
fun handleRealtime(status: Int) {
|
fun handleRealtime(status: Int) {
|
||||||
|
when (status) {
|
||||||
|
0xFA, 0xFB -> onTransport?.invoke(true)
|
||||||
|
0xFC -> onTransport?.invoke(false)
|
||||||
|
}
|
||||||
if (!receiveEnabled) return
|
if (!receiveEnabled) return
|
||||||
when (status) {
|
when (status) {
|
||||||
0xFA, 0xFB -> { resetTempoEstimate(); onReceiveStart?.invoke() } // Start / Continue
|
0xFA, 0xFB -> { resetTempoEstimate(); onReceiveStart?.invoke() } // Start / Continue
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ import kotlinx.coroutines.launch
|
|||||||
*/
|
*/
|
||||||
/** Tab index of the Tracker tab (see [App]'s tab order). */
|
/** Tab index of the Tracker tab (see [App]'s tab order). */
|
||||||
private const val TAB_TRACKER = 0
|
private const val TAB_TRACKER = 0
|
||||||
|
/** Tab indices of the Mix and Toolbox tabs. */
|
||||||
|
const val TAB_MIX = 1
|
||||||
|
const val TAB_TOOLBOX = 2
|
||||||
|
|
||||||
/** Reserved prefix for a toolbox slot's MIDI-CC parameter bindings, stored in the
|
/** Reserved prefix for a toolbox slot's MIDI-CC parameter bindings, stored in the
|
||||||
* slot's value map (`midicc@<paramKey>` -> CC number) so they persist with the
|
* slot's value map (`midicc@<paramKey>` -> CC number) so they persist with the
|
||||||
@@ -236,6 +239,22 @@ class AppViewModel(
|
|||||||
// ------------------------------------------------------------- tab control
|
// ------------------------------------------------------------- tab control
|
||||||
fun selectTab(index: Int) { selectedTab = index.coerceIn(0, 3) }
|
fun selectTab(index: Int) { selectedTab = index.coerceIn(0, 3) }
|
||||||
|
|
||||||
|
/** A request for the Toolbox to open slot [index]'s settings, and the tab to go
|
||||||
|
* back to when that editor is closed (null: stay on the Toolbox). */
|
||||||
|
class SlotEditorRequest(val index: Int, val returnTab: Int?)
|
||||||
|
|
||||||
|
var slotEditorRequest by mutableStateOf<SlotEditorRequest?>(null); private set
|
||||||
|
|
||||||
|
/** Open toolbox slot [index]'s settings from elsewhere (the mixer's long-press):
|
||||||
|
* switch to the Toolbox with its editor open; closing it returns to [returnTab]. */
|
||||||
|
fun openSlotEditor(index: Int, returnTab: Int? = null) {
|
||||||
|
if (project.toolbox.getOrNull(index)?.isEmpty != false) return
|
||||||
|
slotEditorRequest = SlotEditorRequest(index, returnTab)
|
||||||
|
selectTab(TAB_TOOLBOX)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun consumeSlotEditorRequest() { slotEditorRequest = null }
|
||||||
|
|
||||||
// ----------------------------------------------------------- cursor & edit
|
// ----------------------------------------------------------- cursor & edit
|
||||||
fun focusCell(track: Int, line: Int, column: CellColumn) {
|
fun focusCell(track: Int, line: Int, column: CellColumn) {
|
||||||
val p = project.activePattern()
|
val p = project.activePattern()
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
|
|
||||||
package cc.tiredsysadmin.android.sizzle.ui.components
|
package cc.tiredsysadmin.android.sizzle.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.gestures.awaitEachGesture
|
import androidx.compose.foundation.gestures.awaitEachGesture
|
||||||
import androidx.compose.foundation.gestures.awaitFirstDown
|
import androidx.compose.foundation.gestures.awaitFirstDown
|
||||||
import androidx.compose.foundation.gestures.waitForUpOrCancellation
|
import androidx.compose.foundation.gestures.waitForUpOrCancellation
|
||||||
@@ -27,7 +29,9 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
|
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
@@ -142,6 +146,7 @@ private const val REPEAT_MIN_MS = 24L
|
|||||||
private const val REPEAT_DECAY = 0.80
|
private const val REPEAT_DECAY = 0.80
|
||||||
|
|
||||||
/** A labelled dropdown selector rendered as `LABEL:value ▾`. */
|
/** A labelled dropdown selector rendered as `LABEL:value ▾`. */
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun <T> RetroDropdown(
|
fun <T> RetroDropdown(
|
||||||
label: String,
|
label: String,
|
||||||
@@ -149,9 +154,13 @@ fun <T> RetroDropdown(
|
|||||||
selected: T,
|
selected: T,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
optionLabel: (T) -> String = { it.toString() },
|
optionLabel: (T) -> String = { it.toString() },
|
||||||
|
/** Optional long-press action (e.g. the mixer's "open this device's settings");
|
||||||
|
* a tap still opens the menu. */
|
||||||
|
onLongClick: (() -> Unit)? = null,
|
||||||
onSelect: (T) -> Unit,
|
onSelect: (T) -> Unit,
|
||||||
) {
|
) {
|
||||||
val c = LocalRetro.current
|
val c = LocalRetro.current
|
||||||
|
val haptics = LocalHapticFeedback.current
|
||||||
var open by remember { mutableStateOf(false) }
|
var open by remember { mutableStateOf(false) }
|
||||||
// Reserve the width of the longest option so the field never resizes as the
|
// Reserve the width of the longest option so the field never resizes as the
|
||||||
// selection changes — a common source of toolbar "jitter".
|
// selection changes — a common source of toolbar "jitter".
|
||||||
@@ -164,7 +173,13 @@ fun <T> RetroDropdown(
|
|||||||
Modifier
|
Modifier
|
||||||
.border(1.dp, c.grid, RectangleShape)
|
.border(1.dp, c.grid, RectangleShape)
|
||||||
.background(c.surface)
|
.background(c.surface)
|
||||||
.clickable { open = true }
|
.then(
|
||||||
|
if (onLongClick == null) Modifier.clickable { open = true }
|
||||||
|
else Modifier.combinedClickable(
|
||||||
|
onClick = { open = true },
|
||||||
|
onLongClick = { haptics.performHapticFeedback(HapticFeedbackType.LongPress); onLongClick() },
|
||||||
|
),
|
||||||
|
)
|
||||||
.padding(horizontal = 8.dp, vertical = 6.dp),
|
.padding(horizontal = 8.dp, vertical = 6.dp),
|
||||||
) {
|
) {
|
||||||
// Invisible sizer (longest option) fixes the width; the visible value
|
// Invisible sizer (longest option) fixes the width; the visible value
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import cc.tiredsysadmin.android.sizzle.model.MixerChannel
|
|||||||
import cc.tiredsysadmin.android.sizzle.model.Pattern
|
import cc.tiredsysadmin.android.sizzle.model.Pattern
|
||||||
import cc.tiredsysadmin.android.sizzle.model.ToolboxKind
|
import cc.tiredsysadmin.android.sizzle.model.ToolboxKind
|
||||||
import cc.tiredsysadmin.android.sizzle.ui.AppViewModel
|
import cc.tiredsysadmin.android.sizzle.ui.AppViewModel
|
||||||
|
import cc.tiredsysadmin.android.sizzle.ui.TAB_MIX
|
||||||
import cc.tiredsysadmin.android.sizzle.ui.isLandscape
|
import cc.tiredsysadmin.android.sizzle.ui.isLandscape
|
||||||
import cc.tiredsysadmin.android.sizzle.ui.components.RepeatButton
|
import cc.tiredsysadmin.android.sizzle.ui.components.RepeatButton
|
||||||
import cc.tiredsysadmin.android.sizzle.ui.components.RetroButton
|
import cc.tiredsysadmin.android.sizzle.ui.components.RetroButton
|
||||||
@@ -147,7 +148,7 @@ private fun RecordToolbar(vm: AppViewModel) {
|
|||||||
val status = when {
|
val status = when {
|
||||||
recording -> "recording…"
|
recording -> "recording…"
|
||||||
vm.recordDirUri == null -> "pick a folder to record"
|
vm.recordDirUri == null -> "pick a folder to record"
|
||||||
vm.recordArmed -> "armed — starts on play"
|
vm.recordArmed -> "armed — starts on play or MIDI clock start"
|
||||||
vm.lastRecordingName != null -> "saved ${vm.lastRecordingName}"
|
vm.lastRecordingName != null -> "saved ${vm.lastRecordingName}"
|
||||||
else -> "master → WAV"
|
else -> "master → WAV"
|
||||||
}
|
}
|
||||||
@@ -215,6 +216,8 @@ private fun ColumnScope.ChannelRouting(vm: AppViewModel, channel: MixerChannel)
|
|||||||
options = listOf(-1) + instrumentSlots.map { it.index },
|
options = listOf(-1) + instrumentSlots.map { it.index },
|
||||||
selected = channel.instrumentSlot,
|
selected = channel.instrumentSlot,
|
||||||
optionLabel = { idx -> if (idx < 0) "—" else "${idx + 1}:${toolbox[idx].name}" },
|
optionLabel = { idx -> if (idx < 0) "—" else "${idx + 1}:${toolbox[idx].name}" },
|
||||||
|
// Long press: open the assigned instrument's settings in the Toolbox.
|
||||||
|
onLongClick = { if (channel.instrumentSlot >= 0) vm.openSlotEditor(channel.instrumentSlot, returnTab = TAB_MIX) },
|
||||||
onSelect = { channel.instrumentSlot = it; vm.bumpForToolbar() },
|
onSelect = { channel.instrumentSlot = it; vm.bumpForToolbar() },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
@@ -226,6 +229,8 @@ private fun ColumnScope.ChannelRouting(vm: AppViewModel, channel: MixerChannel)
|
|||||||
options = listOf(-1) + effectSlots.map { it.index },
|
options = listOf(-1) + effectSlots.map { it.index },
|
||||||
selected = channel.fxSlots[fx],
|
selected = channel.fxSlots[fx],
|
||||||
optionLabel = { idx -> if (idx < 0) "—" else "${idx + 1}:${toolbox[idx].name}" },
|
optionLabel = { idx -> if (idx < 0) "—" else "${idx + 1}:${toolbox[idx].name}" },
|
||||||
|
// Long press: open this effect's settings in the Toolbox.
|
||||||
|
onLongClick = { if (channel.fxSlots[fx] >= 0) vm.openSlotEditor(channel.fxSlots[fx], returnTab = TAB_MIX) },
|
||||||
onSelect = { channel.fxSlots[fx] = it; vm.rebuildAudioRouting() },
|
onSelect = { channel.fxSlots[fx] = it; vm.rebuildAudioRouting() },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import androidx.compose.material3.OutlinedTextField
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.DisposableEffect
|
import androidx.compose.runtime.DisposableEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
@@ -88,20 +89,37 @@ fun ToolboxScreen(vm: AppViewModel) {
|
|||||||
var editing by remember { mutableStateOf<Int?>(null) }
|
var editing by remember { mutableStateOf<Int?>(null) }
|
||||||
var picking by remember { mutableStateOf<Int?>(null) }
|
var picking by remember { mutableStateOf<Int?>(null) }
|
||||||
var clearing by remember { mutableStateOf<Int?>(null) }
|
var clearing by remember { mutableStateOf<Int?>(null) }
|
||||||
|
// The tab to go back to when the open editor closes: set when another tab (the
|
||||||
|
// mixer's long-press) asked for it, so its settings feel like a pop-up over that tab.
|
||||||
|
var returnTab by remember { mutableStateOf<Int?>(null) }
|
||||||
|
|
||||||
|
vm.slotEditorRequest?.let { req ->
|
||||||
|
LaunchedEffect(req) {
|
||||||
|
picking = null; clearing = null
|
||||||
|
editing = req.index
|
||||||
|
returnTab = req.returnTab
|
||||||
|
vm.consumeSlotEditorRequest()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val closeEditor: () -> Unit = {
|
||||||
|
editing = null
|
||||||
|
returnTab?.let { vm.selectTab(it) }
|
||||||
|
returnTab = null
|
||||||
|
}
|
||||||
|
|
||||||
// Back closes an open device editor / picker / confirm before the app-level handler
|
// Back closes an open device editor / picker / confirm before the app-level handler
|
||||||
// switches tabs.
|
// switches tabs.
|
||||||
BackHandler(enabled = editing != null || picking != null || clearing != null) {
|
BackHandler(enabled = editing != null || picking != null || clearing != null) {
|
||||||
when {
|
when {
|
||||||
clearing != null -> clearing = null
|
clearing != null -> clearing = null
|
||||||
editing != null -> editing = null
|
editing != null -> closeEditor()
|
||||||
else -> picking = null
|
else -> picking = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shared tile gestures (index-based) so both layouts drive the same state.
|
// Shared tile gestures (index-based) so both layouts drive the same state.
|
||||||
// Single tap: pick a device for an empty tile, else open the filled tile's settings.
|
// Single tap: pick a device for an empty tile, else open the filled tile's settings.
|
||||||
val onTapTile: (Int) -> Unit = { i -> if (vm.project.toolbox[i].isEmpty) picking = i else editing = i }
|
val onTapTile: (Int) -> Unit = { i -> returnTab = null; if (vm.project.toolbox[i].isEmpty) picking = i else editing = i }
|
||||||
// Long press: clear a filled tile — but confirm first (it discards the device and
|
// Long press: clear a filled tile — but confirm first (it discards the device and
|
||||||
// its settings, and there's no undo). Long-pressing an empty tile does nothing.
|
// its settings, and there's no undo). Long-pressing an empty tile does nothing.
|
||||||
val onLongPressTile: (Int) -> Unit = { i -> if (!vm.project.toolbox[i].isEmpty) clearing = i }
|
val onLongPressTile: (Int) -> Unit = { i -> if (!vm.project.toolbox[i].isEmpty) clearing = i }
|
||||||
@@ -149,7 +167,7 @@ fun ToolboxScreen(vm: AppViewModel) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
editing?.let { index ->
|
editing?.let { index ->
|
||||||
ParamEditor(vm, vm.project.toolbox[index], onClose = { editing = null })
|
ParamEditor(vm, vm.project.toolbox[index], onClose = closeEditor)
|
||||||
}
|
}
|
||||||
clearing?.let { index ->
|
clearing?.let { index ->
|
||||||
val slot = vm.project.toolbox[index]
|
val slot = vm.project.toolbox[index]
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package cc.tiredsysadmin.android.sizzle.audio
|
||||||
|
|
||||||
|
import cc.tiredsysadmin.android.sizzle.model.Project
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertFalse
|
||||||
|
import org.junit.Assert.assertNotNull
|
||||||
|
import org.junit.Assert.assertNull
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
import org.junit.Test
|
||||||
|
import java.io.File
|
||||||
|
import java.io.RandomAccessFile
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.util.concurrent.CountDownLatch
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
/** An armed master recording follows an external MIDI clock's Start/Stop, with its tail. */
|
||||||
|
class ClockRecordingTest {
|
||||||
|
|
||||||
|
private val fs = 48_000
|
||||||
|
private val block = 192
|
||||||
|
|
||||||
|
private fun engine(dir: File, tailBars: Int, done: (File) -> Unit) = AudioEngine(fs).apply {
|
||||||
|
setProject(Project().apply { tempoBpm = 120f })
|
||||||
|
recTempDir = dir
|
||||||
|
onRecordingComplete = { f, _ ->
|
||||||
|
val copy = File(dir, "take-${System.nanoTime()}.wav"); f.copyTo(copy); done(copy)
|
||||||
|
}
|
||||||
|
setRecordingArm(true, tailBars)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Render [frames], paced (about 10x real time) so the recorder's writer thread
|
||||||
|
* keeps up with its one-second ring, as it does on a device. */
|
||||||
|
private fun AudioEngine.run(frames: Int) {
|
||||||
|
val out = FloatArray(block * 2)
|
||||||
|
repeat(frames / block) { i -> fillBlock(out, block); if (i % 25 == 24) Thread.sleep(10) }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sample frames in a 16-bit stereo WAV written by [MasterRecorder] (header patched on close). */
|
||||||
|
private fun frames(f: File): Long = RandomAccessFile(f, "r").use { it.length() - 44 } / 4
|
||||||
|
|
||||||
|
@Test fun clockStartRecordsAndStopEndsAfterTheTail() {
|
||||||
|
val dir = Files.createTempDirectory("rec").toFile()
|
||||||
|
val latch = CountDownLatch(1)
|
||||||
|
var take: File? = null
|
||||||
|
val e = engine(dir, tailBars = 1) { take = it; latch.countDown() }
|
||||||
|
e.run(fs) // armed, no clock: nothing
|
||||||
|
assertNull(take)
|
||||||
|
e.externalClockStart()
|
||||||
|
e.run(fs * 2) // two seconds of "the other app playing"
|
||||||
|
e.externalClockStop()
|
||||||
|
e.run(fs * 3) // 1 bar of 4/4 at 120 BPM = 2 s of tail, then done
|
||||||
|
assertTrue("the take finished", latch.await(5, TimeUnit.SECONDS))
|
||||||
|
val n = frames(assertNotNull(take).let { take!! })
|
||||||
|
// 2 s of clock + 2 s of tail (to a block)
|
||||||
|
assertEquals((fs * 4).toDouble(), n.toDouble(), block * 2.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test fun notArmedRecordsNothing() {
|
||||||
|
val dir = Files.createTempDirectory("rec").toFile()
|
||||||
|
var take: File? = null
|
||||||
|
val e = engine(dir, tailBars = 0) { take = it }
|
||||||
|
e.setRecordingArm(false, 0)
|
||||||
|
e.externalClockStart(); e.run(fs); e.externalClockStop(); e.run(fs)
|
||||||
|
Thread.sleep(200)
|
||||||
|
assertNull(take)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test fun sizzlesStopEndsAClockTake() {
|
||||||
|
val dir = Files.createTempDirectory("rec").toFile()
|
||||||
|
val latch = CountDownLatch(1)
|
||||||
|
val e = engine(dir, tailBars = 0) { latch.countDown() }
|
||||||
|
e.externalClockStart(); e.run(fs)
|
||||||
|
e.stop() // the user stops in Sizzle
|
||||||
|
e.run(fs / 10)
|
||||||
|
assertTrue(latch.await(5, TimeUnit.SECONDS))
|
||||||
|
assertFalse(e.transport.value.isPlaying)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -323,6 +323,15 @@ enum entry that lists its `ParamSpec`s. A `ToolboxSlot` stores the chosen type +
|
|||||||
a `name -> value` string map. The parameter editor UI and the preset text format
|
a `name -> value` string map. The parameter editor UI and the preset text format
|
||||||
are both **generated** from that list. See §6 to add a new device.
|
are both **generated** from that list. See §6 to add a new device.
|
||||||
|
|
||||||
|
### 5.4.1 Opening a device's settings from another tab
|
||||||
|
|
||||||
|
The Toolbox owns its editor state (`editing` in `ToolboxScreen`). Other screens ask
|
||||||
|
for an editor through `AppViewModel.openSlotEditor(index, returnTab)`, which stores a
|
||||||
|
`slotEditorRequest` and switches to the Toolbox; `ToolboxScreen` consumes the request
|
||||||
|
in a `LaunchedEffect`, opens the editor, and on CLOSE / Back returns to `returnTab`.
|
||||||
|
The mixer's INSTRUMENT and FX dropdowns use it on long-press (`RetroDropdown`'s
|
||||||
|
optional `onLongClick`, with a haptic tick; a tap still opens the menu).
|
||||||
|
|
||||||
### 5.5 Sizzle as a background MIDI sound module
|
### 5.5 Sizzle as a background MIDI sound module
|
||||||
|
|
||||||
Goal: another app (Mikro Seq, a DAW, a controller app) plays Sizzle's mixer over
|
Goal: another app (Mikro Seq, a DAW, a controller app) plays Sizzle's mixer over
|
||||||
@@ -388,6 +397,14 @@ one is treated as dead too (events within 1 s of our own open/close are ignored)
|
|||||||
USB and Bluetooth sources are not probed: Android reports their removal.
|
USB and Bluetooth sources are not probed: Android reports their removal.
|
||||||
`MidiInput` logs connects/reconnects under the `SizzleMidi` tag.
|
`MidiInput` logs connects/reconnects under the `SizzleMidi` tag.
|
||||||
|
|
||||||
|
**Recording on the clock (0.34.0).** `MidiClock.onTransport` reports every
|
||||||
|
Start/Continue/Stop byte, before the `receiveEnabled` gate, and `SizzleApp` forwards
|
||||||
|
it to `AudioEngine.externalClockStart/Stop`. The master recorder's state machine
|
||||||
|
treats "the sequencer plays OR an external clock runs" as running: Start begins an
|
||||||
|
armed take (`maybeStartRecording`), and the TAIL countdown starts on the edge where
|
||||||
|
both have stopped. `pause()` / `stop()` clear the external flag, so Sizzle's own
|
||||||
|
Stop ends a clock-started take. `ClockRecordingTest` covers start, tail and stop.
|
||||||
|
|
||||||
**Tracing (0.29.1).** `input/MidiTrace` logs, when switched on with
|
**Tracing (0.29.1).** `input/MidiTrace` logs, when switched on with
|
||||||
`adb shell setprop log.tag.SizzleMidiTrace VERBOSE` (re-read every 500 ms, free
|
`adb shell setprop log.tag.SizzleMidiTrace VERBOSE` (re-read every 500 ms, free
|
||||||
when off), every received packet (`recv <source> [bytes] <decoded> late=…ms`), each
|
when off), every received packet (`recv <source> [bytes] <decoded> late=…ms`), each
|
||||||
|
|||||||
+10
-2
@@ -188,10 +188,18 @@ Four channels, side by side. For each channel:
|
|||||||
- **LIM** — a per‑channel soft‑clip limiter.
|
- **LIM** — a per‑channel soft‑clip limiter.
|
||||||
- **M / S** — mute / solo.
|
- **M / S** — mute / solo.
|
||||||
|
|
||||||
|
**Long‑press** an INSTRUMENT or FX slot to open that device's settings (the same
|
||||||
|
editor as in the Toolbox); **CLOSE** or Back brings you straight back to the Mix.
|
||||||
|
|
||||||
The strip along the top controls **recording** of the master output:
|
The strip along the top controls **recording** of the master output:
|
||||||
|
|
||||||
- **● ARM** — arm recording; capture begins when you press play.
|
- **● ARM** — arm recording; capture begins when you press play, or when a MIDI
|
||||||
- **TAIL** — how many bars of effect tail to keep after the sequencer stops.
|
clock Start arrives from another app or device (Mikro Seq, a DAW, a drum
|
||||||
|
machine), even while Sizzle plays only as a MIDI sound module. A clock Stop (or
|
||||||
|
Sizzle's own Stop) ends the take after its tail. Each Start/Stop while armed is a
|
||||||
|
new take.
|
||||||
|
- **TAIL** — how many bars of effect tail to keep after the sequencer or the
|
||||||
|
external clock stops.
|
||||||
- **DIR** — the destination folder for the rendered file.
|
- **DIR** — the destination folder for the rendered file.
|
||||||
- **master → WAV** — the master bus is captured to a stereo WAV.
|
- **master → WAV** — the master bus is captured to a stereo WAV.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -8,8 +8,8 @@
|
|||||||
# or polish. android.versionCode is monotonic and bumps by 1 on every release,
|
# or polish. android.versionCode is monotonic and bumps by 1 on every release,
|
||||||
# because F-Droid and the Android package manager order installs by it alone.
|
# because F-Droid and the Android package manager order installs by it alone.
|
||||||
|
|
||||||
android.versionName = 0.32.0
|
android.versionName = 0.34.0
|
||||||
android.versionCode = 63
|
android.versionCode = 65
|
||||||
|
|
||||||
# No desktop builds exist yet. These lines are the agreed slots so a port starts
|
# No desktop builds exist yet. These lines are the agreed slots so a port starts
|
||||||
# with a version instead of inventing one; `-` means "not built on this
|
# with a version instead of inventing one; `-` means "not built on this
|
||||||
|
|||||||
Reference in New Issue
Block a user