Compare commits

..
2 Commits
Author SHA1 Message Date
ReactorcoremeltdownandClaude Opus 5.5 3170e8dd7a One-tap song transfer from Mikro Seq without the replace dialog, with a backup (0.36.0)
Skipped only for ACTION_VIEW + extra.REPLACE + a content URI whose provider
belongs to cc.tiredsysadmin.android.mikroseq. The replaced song is saved as
"Before Mikro Seq import" first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 20:01:02 +01:00
ReactorcoremeltdownandClaude Opus 5.5 1eafe20410 Device editors: redraw knobs, switches, faders and drawings on every edit (0.35.1)
The controls were skipped on a revision bump because their arguments compared
equal by identity; they now take the revision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:29:55 +01:00
9 changed files with 115 additions and 14 deletions
+15
View File
@@ -4,6 +4,21 @@ 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.36.0 (versionCode 68)
- **One-tap transfer from Mikro Seq:** a song sent by Mikro Seq's "Current to
Sizzle" button (the `extra.REPLACE` intent) loads straight away, without the
"replace song?" question. Only Mikro Seq can do this: the URI must come from
its own content provider. The replaced song is saved first as "Before Mikro Seq
import" in the project list, and a toast says so. Every other app still gets
the question.
## 0.35.1 (versionCode 67)
- **Fix:** knobs, switches, EQ faders and the envelope/filter/LFO drawings in the
new device editors did not move when touched (the value changed, the screen
didn't). They now redraw on every edit.
## 0.35.0 (versionCode 66) ## 0.35.0 (versionCode 66)
- **Device editors redesigned:** instruments and effects no longer show two - **Device editors redesigned:** instruments and effects no longer show two
+6
View File
@@ -22,6 +22,12 @@
<uses-feature android:name="android.hardware.bluetooth" android:required="false" /> <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="false" /> <uses-feature android:name="android.hardware.microphone" android:required="false" />
<!-- Lets SongIntents.isTrustedReplace see which app owns a content provider, so
only Mikro Seq's one-tap transfer can replace the song without asking. -->
<queries>
<package android:name="cc.tiredsysadmin.android.mikroseq" />
</queries>
<application <application
android:name=".SizzleApp" android:name=".SizzleApp"
android:allowBackup="true" android:allowBackup="true"
@@ -104,6 +104,7 @@ class MainActivity : ComponentActivity() {
* A `.sng` handed over by another app (Mikro Seq's "Open in Sizzle", a file * A `.sng` handed over by another app (Mikro Seq's "Open in Sizzle", a file
* manager, the share sheet): read it off the main thread, then let the UI ask * manager, the share sheet): read it off the main thread, then let the UI ask
* before it replaces the current song. See [SongIntents] for what is accepted. * before it replaces the current song. See [SongIntents] for what is accepted.
* Mikro Seq's one-tap transfer replaces it straight away, after a backup.
*/ */
private fun handleOpenIntent(intent: Intent?) { private fun handleOpenIntent(intent: Intent?) {
intent ?: return intent ?: return
@@ -113,7 +114,7 @@ class MainActivity : ComponentActivity() {
setIntent(Intent(this, MainActivity::class.java)) setIntent(Intent(this, MainActivity::class.java))
lifecycleScope.launch { lifecycleScope.launch {
val song = withContext(Dispatchers.IO) { SongIntents.read(this@MainActivity, intent) } val song = withContext(Dispatchers.IO) { SongIntents.read(this@MainActivity, intent) }
viewModel.offerIncomingSong(song) if (song.replaceNow) viewModel.replaceFromMikroSeq(song) else viewModel.offerIncomingSong(song)
} }
} }
@@ -12,7 +12,14 @@ import java.io.InputStream
/** A song handed over by another app: its display [name] and [text], or an [error] /** A song handed over by another app: its display [name] and [text], or an [error]
* to show instead. */ * to show instead. */
data class IncomingSong(val name: String, val text: String?, val error: String? = null) data class IncomingSong(
val name: String,
val text: String?,
val error: String? = null,
/** Mikro Seq asked to overwrite the current song without asking (see
* [SongIntents.isTrustedReplace]). */
val replaceNow: Boolean = false,
)
/** /**
* Reads a `.sng` that another app opened in Sizzle (Mikro Seq's "Open in Sizzle", * Reads a `.sng` that another app opened in Sizzle (Mikro Seq's "Open in Sizzle",
@@ -33,6 +40,29 @@ object SongIntents {
/** Larger than any real song (Mikro Seq's biggest export is a few tens of KB). */ /** Larger than any real song (Mikro Seq's biggest export is a few tens of KB). */
const val MAX_BYTES = 4 * 1024 * 1024 const val MAX_BYTES = 4 * 1024 * 1024
/** Boolean extra Mikro Seq's one-tap transfer sets to replace the song without the dialog. */
const val EXTRA_REPLACE = "cc.tiredsysadmin.android.sizzle.extra.REPLACE"
/** The only app allowed to skip the dialog. */
const val MIKROSEQ_PACKAGE = "cc.tiredsysadmin.android.mikroseq"
/**
* True only for Mikro Seq's one-tap transfer: an `ACTION_VIEW` with [EXTRA_REPLACE]
* set, of a `content:` URI served by a provider that belongs to Mikro Seq. That
* provider isn't exported, so nobody else can hand us such a URI; any other app
* setting the extra still gets the confirmation dialog. Needs Mikro Seq in the
* manifest's `<queries>` for the provider lookup to see it.
*/
fun isTrustedReplace(context: Context, intent: Intent): Boolean {
if (intent.action != Intent.ACTION_VIEW) return false
if (!intent.getBooleanExtra(EXTRA_REPLACE, false)) return false
val uri = intent.data ?: return false
if (uri.scheme != "content") return false
val authority = uri.authority ?: return false
val owner = runCatching { context.packageManager.resolveContentProvider(authority, 0)?.packageName }.getOrNull()
return owner == MIKROSEQ_PACKAGE
}
fun read(context: Context, intent: Intent): IncomingSong { fun read(context: Context, intent: Intent): IncomingSong {
val uri: Uri? = when (intent.action) { val uri: Uri? = when (intent.action) {
Intent.ACTION_VIEW -> intent.data Intent.ACTION_VIEW -> intent.data
@@ -55,7 +85,7 @@ object SongIntents {
} ?: return IncomingSong(name, null, "Couldn't read $name.") } ?: return IncomingSong(name, null, "Couldn't read $name.")
val text = String(bytes, Charsets.UTF_8) val text = String(bytes, Charsets.UTF_8)
if (!SngFormat.looksLikeSng(text)) return IncomingSong(name, null, NOT_A_SONG) if (!SngFormat.looksLikeSng(text)) return IncomingSong(name, null, NOT_A_SONG)
return IncomingSong(name, text) return IncomingSong(name, text, replaceNow = isTrustedReplace(context, intent))
} }
private const val NOT_A_SONG = "This doesn't look like a Sizzle .sng song, so nothing was imported." private const val NOT_A_SONG = "This doesn't look like a Sizzle .sng song, so nothing was imported."
@@ -163,12 +163,29 @@ class AppViewModel(
// ----- A song opened from another app (VIEW / SEND intent) ----- // ----- A song opened from another app (VIEW / SEND intent) -----
/** Waiting for the user to confirm replacing the current song, or to read why /** Waiting for the user to confirm replacing the current song, or to read why
* it can't be opened. */ * it can't be opened. */
private val BEFORE_MIKROSEQ = "Before Mikro Seq import"
var incomingSong by mutableStateOf<cc.tiredsysadmin.android.sizzle.io.IncomingSong?>(null); private set var incomingSong by mutableStateOf<cc.tiredsysadmin.android.sizzle.io.IncomingSong?>(null); private set
fun offerIncomingSong(song: cc.tiredsysadmin.android.sizzle.io.IncomingSong) { incomingSong = song } fun offerIncomingSong(song: cc.tiredsysadmin.android.sizzle.io.IncomingSong) { incomingSong = song }
fun dismissIncomingSong() { incomingSong = null } fun dismissIncomingSong() { incomingSong = null }
/**
* Mikro Seq's one-tap transfer ([cc.tiredsysadmin.android.sizzle.io.SongIntents.isTrustedReplace]):
* nothing asks first, so the current song is saved in full to the library as
* [BEFORE_MIKROSEQ] (overwriting the previous such backup), then replaced.
*/
fun replaceFromMikroSeq(song: cc.tiredsysadmin.android.sizzle.io.IncomingSong) {
val backedUp = runCatching { songLibrary.save(BEFORE_MIKROSEQ, saveProjectText()) }.isSuccess
incomingSong = song
if (acceptIncomingSong()) {
val msg = if (backedUp) "Loaded ${song.name}. Previous song saved as \"$BEFORE_MIKROSEQ\"."
else "Loaded ${song.name}. Couldn't back up the previous song."
android.widget.Toast.makeText(appContext, msg, android.widget.Toast.LENGTH_LONG).show()
}
}
/** Replace the current song with the offered one. Stops playback first so the /** Replace the current song with the offered one. Stops playback first so the
* audio thread isn't reading the model while it is rewritten. Returns false * audio thread isn't reading the model while it is rewritten. Returns false
* (leaving the song as it was parsed so far) if the import fails. */ * (leaving the song as it was parsed so far) if the import fails. */
@@ -176,10 +176,10 @@ fun PanelCard(vm: AppViewModel, slot: ToolboxSlot, panel: Panel, rev: Int = vm.r
Text(panel.title.uppercase(), color = tone, fontFamily = FontFamily.Monospace, fontSize = 11.sp, Text(panel.title.uppercase(), color = tone, fontFamily = FontFamily.Monospace, fontSize = 11.sp,
letterSpacing = 1.sp) letterSpacing = 1.sp)
} }
panel.viz?.let { VizCanvas(slot, it, byKey, tone) } panel.viz?.let { VizCanvas(slot, it, byKey, tone, rev) }
if (panel.faders != null) { if (panel.faders != null) {
FaderBank(vm, slot, specs, panel, tone) FaderBank(vm, slot, specs, panel, tone, rev)
return@Column return@Column
} }
@@ -201,7 +201,7 @@ fun PanelCard(vm: AppViewModel, slot: ToolboxSlot, panel: Panel, rev: Int = vm.r
} }
} }
} }
segmented.forEach { Segmented(vm, slot, it, shortLabel(it, panel), tone) } segmented.forEach { Segmented(vm, slot, it, shortLabel(it, panel), tone, rev) }
if (knobs.isNotEmpty()) { if (knobs.isNotEmpty()) {
val n = knobs.size val n = knobs.size
@@ -211,7 +211,7 @@ fun PanelCard(vm: AppViewModel, slot: ToolboxSlot, panel: Panel, rev: Int = vm.r
val pad = (slots - row.size) / 2f val pad = (slots - row.size) / 2f
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(4.dp)) { Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(4.dp)) {
if (pad > 0f) Spacer(Modifier.weight(pad)) if (pad > 0f) Spacer(Modifier.weight(pad))
row.forEach { spec -> SpecKnob(vm, slot, spec, shortLabel(spec, panel), tone, Modifier.weight(1f)) } row.forEach { spec -> SpecKnob(vm, slot, spec, shortLabel(spec, panel), tone, rev, Modifier.weight(1f)) }
if (pad > 0f) Spacer(Modifier.weight(pad)) if (pad > 0f) Spacer(Modifier.weight(pad))
} }
} }
@@ -222,7 +222,8 @@ fun PanelCard(vm: AppViewModel, slot: ToolboxSlot, panel: Panel, rev: Int = vm.r
// ---------------------------------------------------------------- controls // ---------------------------------------------------------------- controls
@Composable @Composable
private fun SpecKnob(vm: AppViewModel, slot: ToolboxSlot, spec: ParamSpec, label: String, tone: Color, modifier: Modifier) { private fun SpecKnob(vm: AppViewModel, slot: ToolboxSlot, spec: ParamSpec, label: String, tone: Color, rev: Int, modifier: Modifier) {
@Suppress("UNUSED_PARAMETER") val ignored = rev
val value = slot.float(spec.key, spec.default).coerceIn(spec.min, spec.max) val value = slot.float(spec.key, spec.default).coerceIn(spec.min, spec.max)
Knob( Knob(
label = label.uppercase(), value = value, min = spec.min, max = spec.max, label = label.uppercase(), value = value, min = spec.min, max = spec.max,
@@ -238,7 +239,8 @@ private fun isSegmentable(spec: ParamSpec): Boolean =
spec.choices.size <= 6 && spec.choices.sumOf { it.length } <= 34 spec.choices.size <= 6 && spec.choices.sumOf { it.length } <= 34
@Composable @Composable
private fun Segmented(vm: AppViewModel, slot: ToolboxSlot, spec: ParamSpec, label: String, tone: Color) { private fun Segmented(vm: AppViewModel, slot: ToolboxSlot, spec: ParamSpec, label: String, tone: Color, rev: Int) {
@Suppress("UNUSED_PARAMETER") val ignored = rev
val c = LocalRetro.current val c = LocalRetro.current
val cur = slot.string(spec.key, spec.choices.first()) val cur = slot.string(spec.key, spec.choices.first())
Column(verticalArrangement = Arrangement.spacedBy(2.dp)) { Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
@@ -265,7 +267,8 @@ private fun Segmented(vm: AppViewModel, slot: ToolboxSlot, spec: ParamSpec, labe
/** Vertical bipolar faders, one per key: drag or tap to set, double-tap to zero. */ /** Vertical bipolar faders, one per key: drag or tap to set, double-tap to zero. */
@Composable @Composable
private fun FaderBank(vm: AppViewModel, slot: ToolboxSlot, specs: List<ParamSpec>, panel: Panel, tone: Color) { private fun FaderBank(vm: AppViewModel, slot: ToolboxSlot, specs: List<ParamSpec>, panel: Panel, tone: Color, rev: Int) {
@Suppress("UNUSED_PARAMETER") val ignored = rev
val c = LocalRetro.current val c = LocalRetro.current
val captions = panel.faders ?: return val captions = panel.faders ?: return
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(3.dp)) { Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(3.dp)) {
@@ -313,13 +316,17 @@ private fun FaderBank(vm: AppViewModel, slot: ToolboxSlot, specs: List<ParamSpec
// ---------------------------------------------------------------- drawings // ---------------------------------------------------------------- drawings
@Composable @Composable
private fun VizCanvas(slot: ToolboxSlot, viz: Viz, byKey: Map<String, ParamSpec>, tone: Color) { private fun VizCanvas(slot: ToolboxSlot, viz: Viz, byKey: Map<String, ParamSpec>, tone: Color, rev: Int) {
@Suppress("UNUSED_PARAMETER") val ignored = rev
val c = LocalRetro.current val c = LocalRetro.current
fun num(key: String?): Float? = key?.let { k -> byKey[k]?.let { slot.float(k, it.default).coerceIn(it.min, it.max) } } fun num(key: String?): Float? = key?.let { k -> byKey[k]?.let { slot.float(k, it.default).coerceIn(it.min, it.max) } }
fun frac(key: String?): Float? = key?.let { k -> byKey[k]?.let { s -> num(k)!!.let { (it - s.min) / (s.max - s.min) } } } fun frac(key: String?): Float? = key?.let { k -> byKey[k]?.let { s -> num(k)!!.let { (it - s.min) / (s.max - s.min) } } }
fun choice(key: String?): String = key?.let { k -> byKey[k]?.let { slot.string(k, it.choices.firstOrNull() ?: "") } } ?: "" fun choice(key: String?): String = key?.let { k -> byKey[k]?.let { slot.string(k, it.choices.firstOrNull() ?: "") } } ?: ""
Canvas(Modifier.fillMaxWidth().height(56.dp).background(c.background).border(1.dp, c.grid, RectangleShape)) { Canvas(Modifier.fillMaxWidth().height(56.dp).background(c.background).border(1.dp, c.grid, RectangleShape)) {
// Capture the revision so this lambda isn't memoized across parameter edits
// (it reads the slot map directly, which Compose can't observe).
if (rev < 0) return@Canvas
val w = size.width; val h = size.height val w = size.width; val h = size.height
val top = h * 0.12f; val bottom = h * 0.92f val top = h * 0.12f; val bottom = h * 0.92f
val path = Path() val path = Path()
+22
View File
@@ -349,6 +349,14 @@ table). `DeviceLayoutsTest` checks that every parameter of every laid-out device
is on exactly one card and that knob labels stay short. A device missing from is on exactly one card and that knob labels stay short. A device missing from
`DeviceLayouts` falls back to one card with all its parameters. `DeviceLayouts` falls back to one card with all its parameters.
**Recomposition pitfall (fixed in 0.35.1).** Slot params live in a plain map that
Compose can't observe; edits bump `vm.revision` instead. Because the compiler's
strong skipping compares `vm`/`slot` by identity, a child composable that receives
only those is *skipped* on a revision bump and shows stale values, and a `Canvas`
lambda that captures only them is memoized and never redraws. So every control in
Panels.kt (`SpecKnob`, `Segmented`, `FaderBank`, `VizCanvas`) takes `rev: Int`,
and `VizCanvas` reads `rev` inside its draw lambda. Do the same in any new control.
### 5.4.1 Opening a device's settings from another tab ### 5.4.1 Opening a device's settings from another tab
The Toolbox owns its editor state (`editing` in `ToolboxScreen`). Other screens ask The Toolbox owns its editor state (`editing` in `ToolboxScreen`). Other screens ask
@@ -465,6 +473,20 @@ than songs. The ViewModel then holds an `incomingSong`, and `App.kt` asks before
stay); the intent is consumed so a rotation can't offer it twice. Mikro Seq's "Open stay); the intent is consumed so a rotation can't offer it twice. Mikro Seq's "Open
in Sizzle" sends its exported `.sng` this way with a FileProvider URI. in Sizzle" sends its exported `.sng` this way with a FileProvider URI.
**One-tap transfer from Mikro Seq (0.36.0).** Mikro Seq's "Current to Sizzle"
button sends the same `ACTION_VIEW` plus the boolean extra
`cc.tiredsysadmin.android.sizzle.extra.REPLACE`. `SongIntents.isTrustedReplace`
skips the dialog only when the action is `ACTION_VIEW`, the extra is true, the URI
is `content:`, and `PackageManager.resolveContentProvider(authority)` belongs to
`cc.tiredsysadmin.android.mikroseq`. Mikro Seq's provider isn't exported, so only
Mikro Seq can grant us such a URI; any other sender, extra or not, gets the
dialog. The lookup needs Mikro Seq in the manifest's `<queries>` (package
visibility, Android 11+). Because nothing asks first, `replaceFromMikroSeq` saves
the current song in full to the library as "Before Mikro Seq import" (one rolling
backup, overwritten on every transfer), then imports and shows a toast. Checked on
the emulator: the Mikro Seq button replaces without a dialog; the same intent from
Sizzle's own FileProvider still asks.
### 5.7 The Morph Pad (FRASIL port, MPL-2.0) ### 5.7 The Morph Pad (FRASIL port, MPL-2.0)
The **Morph Pad** instrument (`ToolboxType.MORPH_PAD`) is the drone voice of The **Morph Pad** instrument (`ToolboxType.MORPH_PAD`) is the drone voice of
+4 -1
View File
@@ -423,7 +423,10 @@ One‑shot actions (play, stop, tab switch, note/clear) still fire once even if
Projects auto‑save, so a crash or process death resumes where you left off. Projects auto‑save, so a crash or process death resumes where you left off.
Other apps can hand Sizzle a `.sng` directly (Mikro Seq's **Open in Sizzle**, Other apps can hand Sizzle a `.sng` directly (Mikro Seq's **Open in Sizzle**,
a file manager's **Open with**, the share sheet); Sizzle asks before it replaces a file manager's **Open with**, the share sheet); Sizzle asks before it replaces
the current song's notes and arrangement. the current song's notes and arrangement. Mikro Seq's one-tap **Current to
Sizzle** button replaces it without asking; the song it replaced is saved first as
**Before Mikro Seq import** (Setup → Project), so you can load it back. Each
transfer overwrites that backup.
Export a `.sng` before wiping data if you want a portable copy of the song. Export a `.sng` before wiping data if you want a portable copy of the song.
--- ---
+2 -2
View File
@@ -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.35.0 android.versionName = 0.36.0
android.versionCode = 66 android.versionCode = 68
# 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