Fix falsy value check in getFreqeuncy

|| operator, which causes 0 to be treated as falsy and thus not passed
to getFreq, resulting in incorrect frequency calculation for MIDI note
0.

Replace || with ?? to allow 0 to be correctly passed to getFreq.
This commit is contained in:
jouae
2026-05-17 01:42:46 +08:00
parent f73b395648
commit fe0be6bc53
+1 -1
View File
@@ -137,7 +137,7 @@ export const getFrequency = (hap) => {
if (value.freq) {
return value.freq;
}
return getFreq(value.note || value.n || value.value);
return getFreq(value.note ?? value.n ?? value.value);
}
if (typeof value === 'number' && context.type !== 'frequency') {
value = midiToFreq(hap.value);