Fix label clicks to always use auto; reorder click handler: Shift=SC, Ramp=ramp, click=siren

This commit is contained in:
Michael Winter 2026-04-20 18:18:30 +02:00
parent 8f92185e5e
commit a28ebb8a71

View file

@ -473,16 +473,12 @@
// Play each node using chordIndex + localId (let server calculate frequency) // Play each node using chordIndex + localId (let server calculate frequency)
nodes.forEach((node) => { nodes.forEach((node) => {
const localId = node.data('localId'); const localId = node.data('localId');
// Label always uses auto (node's voice) // Label always uses auto (node's voice) - never send sirenNumber
const body = { const body = {
chordIndex: chordIdx, chordIndex: chordIdx,
nodeIndex: localId, nodeIndex: localId,
ip: sirenIp, ip: sirenIp,
}; };
// Only add sirenNumber if a specific siren is selected
if (selectedSiren > 0) {
body.sirenNumber = selectedSiren;
}
fetch('/api/play-siren', { fetch('/api/play-siren', {
method: 'POST', method: 'POST',
@ -741,7 +737,7 @@
// Handle label node clicks // Handle label node clicks
if (node.data('isLabel')) { if (node.data('isLabel')) {
const chordIdx = node.data('chordIndex'); const chordIdx = node.data('chordIndex');
if (rampMode || isShift) { if (rampMode) {
rampToChord(chordIdx); rampToChord(chordIdx);
} else { } else {
playChordOnSiren(chordIdx); playChordOnSiren(chordIdx);
@ -753,18 +749,9 @@
const localId = node.data('localId'); const localId = node.data('localId');
const sirenIp = document.getElementById('sirenIp').value || "192.168.4.200"; const sirenIp = document.getElementById('sirenIp').value || "192.168.4.200";
// Determine action: ramp or play // 1. Shift+click → SuperCollider (FIRST)
if (rampMode || isShift) {
// Ramp to siren
rampToChord(chordIndex, localId);
return;
}
// Check if Shift key is held - send to SuperCollider
if (isShift) { if (isShift) {
// Send to SuperCollider
const endpoint = '/api/play-freq'; const endpoint = '/api/play-freq';
const sirenIp = document.getElementById('sirenIp').value || "192.168.4.200";
const requestBody = { const requestBody = {
chordIndex: chordIndex, chordIndex: chordIndex,
@ -782,7 +769,13 @@
return; return;
} }
// Plain click: play to siren // 2. Ramp mode ON → ramp to siren
if (rampMode) {
rampToChord(chordIndex, localId);
return;
}
// 3. Plain click: play to siren
const endpoint = '/api/play-siren'; const endpoint = '/api/play-siren';
const destination = 'siren'; const destination = 'siren';