Mix: long-press an instrument or FX slot to open its settings (0.33.0)
The mixer's INSTRUMENT and FX dropdowns take a long-press (with a haptic tick) that opens that toolbox slot's editor via a view-model request; the Toolbox consumes it and returns to the Mix tab on CLOSE or Back. A tap still opens the slot menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c8d760ed17
commit
3088912264
@@ -4,6 +4,12 @@ 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.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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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]
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -188,6 +188,9 @@ 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.
|
||||||
|
|||||||
+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.33.0
|
||||||
android.versionCode = 63
|
android.versionCode = 64
|
||||||
|
|
||||||
# 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