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