template.esl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. (lambda (data)
  2. (var alive (&& data.proc data.proc.pid (=== null data.proc.exit-code)))
  3. (var pid (?: alive data.proc.pid null))
  4. (var info (array
  5. (array "text" "Type" "Sampler" )
  6. (array "text" "ID" data.id )
  7. (array "text" "PID" pid )
  8. (array "text" "JACK" data.jack-client )
  9. (array "text" "OSC1" data.local-port )
  10. (array "text" "OSC2" data.remote-port )))
  11. (var elements (array))
  12. (function el (x y z) (elements.push (/h x y z)))
  13. (el ".device-header" (array
  14. (/templates/module/label data.label (+ "Sampler " data.id))
  15. (/h ".device-buttons" (array
  16. (/h (+ ".device-power" (?: alive ".active" ""))
  17. (object "onclick" (/emit (get ./events (?: alive "kill" "spawn")) data.id))
  18. (?: alive "on" "off"))
  19. (new /templates/module/info info)))))
  20. (el "table.sampler-clips"
  21. (data.clips.map (lambda (clip i)
  22. (return (/h "tr.sampler-clip" (array
  23. (/h "td.sampler-clip-number" (String i))
  24. (/h "td.sampler-clip-id" clip.id)
  25. (/h "td.sampler-clip-path"
  26. (/h "a" (object "onclick" (/emit ./events/clip/browse data.id i))
  27. (|| clip.path "load..."))
  28. )))))))
  29. (el "a.sampler-clip-add"
  30. (object "onclick" (/emit ./events/clip/add data.id))
  31. "Add clip...")
  32. (return (/h ".device.sampler" elements)))