Sound-module mode ignores clock Start/Stop for Sizzle's own song (v0.29.2)

With "Receive MIDI clock" on, Mikro Seq's Start also started Sizzle's
sequencer, so a song imported from Mikro Seq played along with the live
notes, doubling parts that Mikro Seq's mutes could not reach. While
sound-module mode is on, Start/Stop are now ignored (traced as such);
tempo is still followed. Verified on the emulator with MidiTrace, plus a
control run with the mode off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Reactorcoremeltdown
2026-11-12 23:04:41 +01:00
co-authored by Claude Opus 5.5
parent 3c248028c9
commit dae8ac46ac
5 changed files with 34 additions and 9 deletions
@@ -168,13 +168,26 @@ class SizzleApp : Application() {
midiClock.playingProvider = { audioEngine.transport.value.isPlaying }
midiClock.bpmProvider = { project.tempoBpm }
midiClock.noteSource = { audioEngine.pollMidiOut() } // forward sequenced notes out
// As a sound module, Sizzle plays the notes another app sends; if that app's
// clock Start also started Sizzle's own song, the song would play along
// (doubled parts that the sender's mutes can't reach). So Start/Stop drive
// the transport only while sound-module mode is off. Tempo is still followed
// (tempo-synced LFOs, delays and arpeggiators use it).
midiClock.onReceiveStart = {
if (MidiTrace.on) MidiTrace.log("clock Start -> Sizzle's own sequencer plays the loaded song")
main.post { if (!audioEngine.transport.value.isPlaying) audioEngine.play() }
if (_soundModuleEnabled.value) {
if (MidiTrace.on) MidiTrace.log("clock Start ignored: sound-module mode is on")
} else {
if (MidiTrace.on) MidiTrace.log("clock Start -> Sizzle's own sequencer plays the loaded song")
main.post { if (!audioEngine.transport.value.isPlaying) audioEngine.play() }
}
}
midiClock.onReceiveStop = {
if (MidiTrace.on) MidiTrace.log("clock Stop -> Sizzle's own sequencer pauses")
main.post { audioEngine.pause() }
if (_soundModuleEnabled.value) {
if (MidiTrace.on) MidiTrace.log("clock Stop ignored: sound-module mode is on")
} else {
if (MidiTrace.on) MidiTrace.log("clock Stop -> Sizzle's own sequencer pauses")
main.post { audioEngine.pause() }
}
}
midiClock.onReceiveTempo = { bpm -> main.post { project.tempoBpm = bpm.coerceIn(20f, 300f) } }
val s = runBlocking { settingsStore.load() }
@@ -518,8 +518,8 @@ private fun MidiSyncCard(vm: AppViewModel) {
HorizontalDivider()
ToggleRow(
"Receive MIDI clock",
"Follow an external clock's tempo, and start/stop Sizzle's own song with it. " +
"Its song then plays along with any notes the other app sends.",
"Follow an external clock's tempo, and start/stop Sizzle's own song with it " +
"(tempo only while Sizzle runs as a MIDI sound module).",
vm.receiveMidiClock,
) { vm.updateReceiveMidiClock(it) }
HorizontalDivider()
@@ -527,7 +527,8 @@ private fun MidiSyncCard(vm: AppViewModel) {
ToggleRow(
"Keep running as MIDI sound module",
"Keep playing incoming MIDI with Sizzle in the background (another app can " +
"use it as its synth), with a notification while on.",
"use it as its synth), with a notification while on. Sizzle's own song " +
"doesn't start from the other app's clock meanwhile.",
module,
) { vm.updateSoundModuleMode(it) }
HorizontalDivider()