Calculate note freq when root freq changes
parent
f39fb3214e
commit
cb25caee08
|
@ -67,16 +67,19 @@ export default function Main() {
|
|||
const setRootValue: ChangeEventHandler<HTMLInputElement> = (e) => {
|
||||
const newRoot = parseInt(e.target.value);
|
||||
if (!isNaN(newRoot)) setRoot(newRoot);
|
||||
const frequency = calculateFrequency(newRoot, note);
|
||||
if (frequency != null) setFrequency(frequency.toFixed(3));
|
||||
};
|
||||
|
||||
const setNoteValue: ChangeEventHandler<HTMLInputElement> = (e) => {
|
||||
setNote(e.target.value);
|
||||
const frequency = calculateFrequency(root, e.target.value);
|
||||
const frequency = calculateFrequency(root, note);
|
||||
if (frequency != null) setFrequency(frequency.toFixed(3));
|
||||
};
|
||||
|
||||
const setFrequencyValue: ChangeEventHandler<HTMLInputElement> = (e) => {
|
||||
setFrequency(e.target.value);
|
||||
|
||||
const newFrequency = parseFloat(e.target.value);
|
||||
if (!isNaN(newFrequency)) {
|
||||
const noteDescriptor = calculateNote(root, newFrequency);
|
||||
|
|
Loading…
Reference in New Issue