Simplify play-siren: remove unused frequency+voice mode

This commit is contained in:
Michael Winter 2026-04-04 19:57:54 +02:00
parent 90f00e56c6
commit 42aa7798d2

View file

@ -130,20 +130,11 @@ def play_siren():
"""Play a single frequency for a node on the siren.""" """Play a single frequency for a node on the siren."""
data = request.json data = request.json
# Support two modes:
# 1. chordIndex + nodeIndex (from clicking a single node)
# 2. frequency + voice (from clicking a chord label)
chord_index = data.get("chordIndex") chord_index = data.get("chordIndex")
node_index = data.get("nodeIndex") node_index = data.get("nodeIndex")
frequency = data.get("frequency")
voice = data.get("voice")
if frequency is None and voice is None:
# Mode 1: use chordIndex/nodeIndex
if chord_index is None or node_index is None: if chord_index is None or node_index is None:
return jsonify( return jsonify({"error": "Missing chordIndex/nodeIndex"}), 400
{"error": "Missing chordIndex/nodeIndex or frequency/voice"}
), 400
if chord_index < 0 or chord_index >= len(chords): if chord_index < 0 or chord_index >= len(chords):
return jsonify({"error": "Invalid chord index"}), 400 return jsonify({"error": "Invalid chord index"}), 400
@ -156,10 +147,6 @@ def play_siren():
fraction = Fraction(pitch.get("fraction", "1")) fraction = Fraction(pitch.get("fraction", "1"))
frequency = fundamental * float(fraction) frequency = fundamental * float(fraction)
voice = node_index + 1 # 1-indexed voice = node_index + 1 # 1-indexed
else:
# Mode 2: use provided frequency/voice
if frequency is None or voice is None:
return jsonify({"error": "Missing frequency or voice"}), 400
# Send to siren (192.168.4.200:54001) using current fundamental # Send to siren (192.168.4.200:54001) using current fundamental
siren_sender = OSCSender(ip="192.168.4.200", port=54001, fundamental=fundamental) siren_sender = OSCSender(ip="192.168.4.200", port=54001, fundamental=fundamental)