Fix streaming primitives namespace in optimized recipe

This commit is contained in:
giles
2026-02-04 10:17:28 +00:00
parent 9ce64ea797
commit 48eed99a28

View File

@@ -14,24 +14,25 @@
:height 1080
:seed 42
;; Load standard primitives (includes proper asset resolution)
(include :name "tpl-standard-primitives")
;; Load optimized GPU primitives (falls back to CPU automatically)
(require-primitives "streaming_gpu") ;; Includes fused-pipeline
(require-primitives "geometry_gpu") ;; Fast CUDA rotate/ripple
(require-primitives "color_ops_gpu") ;; Fast CUDA hue-shift/invert
(require-primitives "blending_gpu") ;; Fast CUDA blend
(require-primitives "core")
(require-primitives "image")
;; === SOURCES ===
;; === SOURCES (using streaming: which has proper asset resolution) ===
(def sources [
(streaming_gpu:make-video-source "woods-1" 30)
(streaming_gpu:make-video-source "woods-2" 30)
(streaming_gpu:make-video-source "woods-3" 30)
(streaming_gpu:make-video-source "woods-4" 30)
(streaming_gpu:make-video-source "woods-5" 30)
(streaming_gpu:make-video-source "woods-6" 30)
(streaming_gpu:make-video-source "woods-7" 30)
(streaming_gpu:make-video-source "woods-8" 30)
(streaming:make-video-source "woods-1" 30)
(streaming:make-video-source "woods-2" 30)
(streaming:make-video-source "woods-3" 30)
(streaming:make-video-source "woods-4" 30)
(streaming:make-video-source "woods-5" 30)
(streaming:make-video-source "woods-6" 30)
(streaming:make-video-source "woods-7" 30)
(streaming:make-video-source "woods-8" 30)
])
;; Per-pair config
@@ -47,21 +48,21 @@
])
;; Audio
(def music (streaming_gpu:make-audio-analyzer "woods-audio"))
(def music (streaming:make-audio-analyzer "woods-audio"))
(audio-playback "woods-audio")
;; === SCANS ===
;; Cycle state
(scan cycle (streaming_gpu:audio-beat music t)
(scan cycle (streaming:audio-beat music t)
:init {:active 0 :beat 0 :clen 16}
:step (if (< (+ beat 1) clen)
(dict :active active :beat (+ beat 1) :clen clen)
(dict :active (mod (+ active 1) (len sources)) :beat 0
:clen (+ 8 (mod (* (streaming_gpu:audio-beat-count music t) 7) 17)))))
:clen (+ 8 (mod (* (streaming:audio-beat-count music t) 7) 17)))))
;; Spin scan
(scan spin (streaming_gpu:audio-beat music t)
(scan spin (streaming:audio-beat music t)
:init {:angle 0 :dir 1 :speed 2}
:step (let [new-dir (if (< (core:rand) 0.05) (* dir -1) dir)
new-speed (if (< (core:rand) 0.1) (+ 1 (core:rand-int 1 4)) speed)]
@@ -70,7 +71,7 @@
:speed new-speed)))
;; Ripple scan
(scan ripple-state (streaming_gpu:audio-beat music t)
(scan ripple-state (streaming:audio-beat music t)
:init {:gate 0 :cx 960 :cy 540}
:step (let [new-gate (if (< (core:rand) 0.15) (+ 3 (core:rand-int 0 5)) (core:max 0 (- gate 1)))
new-cx (if (> new-gate gate) (+ 200 (core:rand-int 0 1520)) cx)
@@ -78,7 +79,7 @@
(dict :gate new-gate :cx new-cx :cy new-cy)))
;; Pair states
(scan pairs (streaming_gpu:audio-beat music t)
(scan pairs (streaming:audio-beat music t)
:init {:states (map (core:range (len sources)) (lambda (_)
{:inv-a 0 :inv-b 0 :hue-a 0 :hue-b 0 :hue-a-val 0 :hue-b-val 0 :mix 0.5 :mix-rem 5 :angle 0 :rot-beat 0 :rot-clen 25}))}
:step (dict :states (map states (lambda (p)
@@ -116,8 +117,8 @@
pstate (nth (bind pairs :states) idx)
;; Read frames (GPU decode, stays on GPU)
frame-a (streaming_gpu:source-read src-a t)
frame-b (streaming_gpu:source-read src-b t)
frame-a (streaming:source-read src-a t)
frame-b (streaming:source-read src-b t)
;; Get state values
dir (get cfg :dir)
@@ -155,7 +156,7 @@
;; === FRAME PIPELINE ===
(frame
(let [now t
e (streaming_gpu:audio-energy music now)
e (streaming:audio-energy music now)
;; Get cycle state
active (bind cycle :active)