From 8d95f3e455cdc62107ee30cfa3897c1a07f3c457 Mon Sep 17 00:00:00 2001 From: clement Date: Sun, 28 Jun 2026 16:39:53 +0200 Subject: [PATCH] refactor: route live tempo writers to setTempo --- sound_algo/live/midi_init.scd | 2 +- sound_algo/live/scenes.scd | 2 +- sound_algo/pd/bridge.scd | 4 ++-- sound_algo/web_bridge.scd | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sound_algo/live/midi_init.scd b/sound_algo/live/midi_init.scd index e8c002c..7629157 100644 --- a/sound_algo/live/midi_init.scd +++ b/sound_algo/live/midi_init.scd @@ -91,7 +91,7 @@ ~midiFuncs.add(MIDIFunc.cc({ |val| ~melodyDrive = val.linlin(0,127, 0.5,5.0); ~debouncedReload.() }, 33)); ~midiFuncs.add(MIDIFunc.cc({ |val| ~acidDrive = val.linlin(0,127, 0.5,5.0); ~debouncedReload.() }, 34)); ~midiFuncs.add(MIDIFunc.cc({ |val| ~melodyBoost = val.linlin(0,127, 0.5,3.0); ~debouncedReload.() }, 35)); - ~midiFuncs.add(MIDIFunc.cc({ |val| TempoClock.default.tempo = val.linlin(0,127, 60,200) / 60 }, 36)); + ~midiFuncs.add(MIDIFunc.cc({ |val| ~setTempo.(val.linlin(0,127, 60,200)) }, 36)); // ---- CC : wobble / sidechain / FX ---- ~midiFuncs.add(MIDIFunc.cc({ |val| ~melodyWobbleRate = val.linexp(0,127, 0.5,32); ~debouncedReload.() }, 49)); diff --git a/sound_algo/live/scenes.scd b/sound_algo/live/scenes.scd index 76db1d3..a338c9c 100644 --- a/sound_algo/live/scenes.scd +++ b/sound_algo/live/scenes.scd @@ -58,7 +58,7 @@ } { scene.keysValuesDo { |k, v| if (k == \bpm) { - TempoClock.default.tempo = v / 60; + ~setTempo.(v); } { currentEnvironment.put(k, v); }; diff --git a/sound_algo/pd/bridge.scd b/sound_algo/pd/bridge.scd index 2bf6e4c..899a723 100644 --- a/sound_algo/pd/bridge.scd +++ b/sound_algo/pd/bridge.scd @@ -48,7 +48,7 @@ // --- transport ----------------------------------------------------- ~pd[\defs].add(OSCdef(\pdPlay, { - TempoClock.default.tempo = (~bpm ? 128) / 60; + ~setTempo.(~bpm ? 128); ~reload !? { ~reload.value }; [\kickSeq, \hatSeq, \snareSeq, \clapSeq, \percSeq, \acidSeq, \melodySeq, \harmonySeq] .do { |k| Pdef(k).play }; @@ -99,7 +99,7 @@ // --- tweaks parametriques ------------------------------------------ ~pd[\defs].add(OSCdef(\pdTweakMelCut, { |msg| ~melodyCutoff = msg[1].asFloat; ~reload.value }, '/tweak/melodyCutoff')); ~pd[\defs].add(OSCdef(\pdTweakAcidCut,{ |msg| ~acidCutoff = msg[1].asFloat; ~reload.value }, '/tweak/acidCutoff')); -~pd[\defs].add(OSCdef(\pdTweakBpm, { |msg| ~bpm = msg[1].asFloat; TempoClock.default.tempo = ~bpm/60 }, '/tweak/bpm')); +~pd[\defs].add(OSCdef(\pdTweakBpm, { |msg| ~setTempo.(msg[1].asFloat) }, '/tweak/bpm')); ~pd[\defs].add(OSCdef(\pdTweakMelRq, { |msg| ~melodyRq = msg[1].asFloat; ~reload.value }, '/tweak/melodyRq')); ~pd[\defs].add(OSCdef(\pdTweakAcidRq, { |msg| ~acidRq = msg[1].asFloat; ~reload.value }, '/tweak/acidRq')); ~pd[\defs].add(OSCdef(\pdTweakDrive, { |msg| ~melodyDrive = msg[1].asFloat; ~reload.value }, '/tweak/melodyDrive')); diff --git a/sound_algo/web_bridge.scd b/sound_algo/web_bridge.scd index 6cc171f..83a7528 100644 --- a/sound_algo/web_bridge.scd +++ b/sound_algo/web_bridge.scd @@ -173,8 +173,7 @@ thisProcess.openUDPPort(~webBridgeIn); // ---------- Transport ------------------------------------------------ ~webBridgeAdd.("/control/bpm", { |msg| - ~bpm = msg[1]; - TempoClock.default.tempo = ~bpm / 60; + ~setTempo.(msg[1]); // Debounce reload : evite de reload a chaque tick du slider ~webDebounce.(\webBpmReloadTask, 0.2, { ~reload.value }); ~webBroadcast.value("/sync/bpm", ~bpm);