memlnaut-nisps/playground/osc-bridge/compile.sh
w1n5t0n b4d3311b32 feat(playground): add OSC output bridge for external synth control
Browser-side OSCOutput module sends parameter values over WebSocket to
a companion Deno bridge script that converts them to OSC/UDP messages.
Enables controlling SuperCollider, Max/MSP, Pure Data, TouchDesigner,
or any OSC-capable software from the NISPS playground.

- Browser module (js/synth/osc-output.js): WebSocket client with
  auto-reconnect, throttle (~20fps), and dead-zone filtering
- Deno bridge (osc-bridge/bridge.ts): zero-dependency, compiles to
  standalone binaries via deno compile for Linux/macOS/Windows
- Test receiver (osc-bridge/test-receive.ts): terminal dashboard
  showing live OSC parameter values with bar charts
- OSC pill button in floating bar for quick connect/disconnect
- Help modal section with platform-aware download, setup guide,
  and examples for SuperCollider/PD/Max
- GitHub Actions workflow for cross-platform binary builds
- OSC sends in both visual and synth modes
2026-03-25 11:55:58 +02:00

62 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# Compile NISPS OSC Bridge for all platforms
# Requires: deno 2.x
# Outputs go to dist/
#
# Note: macOS cross-compilation from Linux has a known Deno bug.
# macOS binaries must be built on macOS (or via GitHub Actions CI).
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
DIST="$SCRIPT_DIR/dist"
SRC="$SCRIPT_DIR/bridge.ts"
NAME="nisps-osc-bridge"
mkdir -p "$DIST"
# Detect host OS for cross-compile compatibility
HOST_OS="$(uname -s)"
TARGETS=(
"x86_64-unknown-linux-gnu:linux-x86_64"
"aarch64-unknown-linux-gnu:linux-arm64"
"x86_64-apple-darwin:macos-x86_64"
"aarch64-apple-darwin:macos-arm64"
"x86_64-pc-windows-msvc:windows-x86_64"
)
FAILED=()
for entry in "${TARGETS[@]}"; do
target="${entry%%:*}"
suffix="${entry##*:}"
outname="$NAME-$suffix"
if [[ "$target" == *windows* ]]; then
outname="$outname.exe"
fi
echo "Compiling $outname ($target)..."
if deno compile \
--allow-net \
--unstable-net \
--target "$target" \
--output "$DIST/$outname" \
"$SRC" 2>&1; then
echo " OK"
else
echo " FAILED (skipping — cross-compile to this target may not work on $HOST_OS)"
FAILED+=("$outname")
fi
echo ""
done
echo "Binaries in $DIST/:"
ls -lh "$DIST/" 2>/dev/null || echo " (none)"
if [[ ${#FAILED[@]} -gt 0 ]]; then
echo ""
echo "Failed targets: ${FAILED[*]}"
echo "These may need to be built natively or via CI."
fi