Update frequency spinner with mic

pull/65/head
James Ball 2022-05-13 21:42:43 +01:00 zatwierdzone przez James H Ball
rodzic 0fc2c30bd3
commit 8cf56a5a55
7 zmienionych plików z 28 dodań i 9 usunięć

Wyświetl plik

@ -143,6 +143,9 @@ public class EffectComponentGroupController implements Initializable, SubControl
effectCheckBox.setSelected(Boolean.parseBoolean(selected));
}
@Override
public void micSignalReceived() {}
public void setType(EffectType type) {
this.type = type;
}

Wyświetl plik

@ -176,4 +176,7 @@ public class EffectsController implements Initializable, SubController {
Element element = (Element) root.getElementsByTagName("checkBoxes").item(0);
effects().forEach(effect -> effect.controller.load(element));
}
@Override
public void micSignalReceived() {}
}

Wyświetl plik

@ -274,6 +274,9 @@ public class GeneralController implements Initializable, SubController {
}
}
@Override
public void micSignalReceived() {}
public void setFrameSourceName(String name) {
this.frameSourceName = name;
}

Wyświetl plik

@ -163,9 +163,7 @@ public class ImageController implements Initializable, SubController {
translationScaleSlider.valueProperty().addListener((e, old, scale) -> translateEffect.setScale(scale.doubleValue()));
frequencySpinner.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(0, MAX_FREQUENCY, MidiNote.MIDDLE_C, 1));
frequencySpinner.valueProperty().addListener((o, old, f) -> {
frequency.set(f);
});
frequencySpinner.valueProperty().addListener((o, old, f) -> frequency.set(f));
frequency.addListener((o, old, f) -> {
frequencySlider.setValue(Math.log(f.doubleValue()) / Math.log(MAX_FREQUENCY));
@ -179,13 +177,13 @@ public class ImageController implements Initializable, SubController {
frequency.set(Math.pow(MAX_FREQUENCY, frequencySlider.getValue()));
}
});
frequencySlider.setOnMouseDragged(e -> {
frequency.set(Math.pow(MAX_FREQUENCY, frequencySlider.getValue()));
});
frequencySlider.setOnMouseDragged(e ->
frequency.set(Math.pow(MAX_FREQUENCY, frequencySlider.getValue()))
);
volumeSlider.valueProperty().addListener((e, old, value) -> {
audioPlayer.setVolume(value.doubleValue() / 3.0);
});
volumeSlider.valueProperty().addListener((e, old, value) ->
audioPlayer.setVolume(value.doubleValue() / 3.0)
);
volumeSlider.valueProperty().addListener(e -> {
if (!audioPlayer.midiPlaying()) {
audioPlayer.resetMidi();
@ -252,4 +250,9 @@ public class ImageController implements Initializable, SubController {
Element ellipse = (Element) element.getElementsByTagName("ellipse").item(0);
translateEllipseCheckBox.setSelected(ellipse != null && Boolean.parseBoolean(ellipse.getTextContent()));
}
@Override
public void micSignalReceived() {
frequency.set(Math.pow(MAX_FREQUENCY, frequencySlider.getValue()));
}
}

Wyświetl plik

@ -1109,6 +1109,8 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
} else if (sliderValue < slider.getMin()) {
sliderValue = slider.getMin();
}
// TODO: Correctly update frequency spinner!
subControllers().forEach(sub -> sub.micSignalReceived());
sliders.get(i).setValue(sliderValue);
}
}

Wyświetl plik

@ -183,4 +183,7 @@ public class ObjController implements Initializable, SubController {
@Override
public void load(Element root) {
}
@Override
public void micSignalReceived() {}
}

Wyświetl plik

@ -23,4 +23,6 @@ public interface SubController {
Node save(Document document);
void load(Element root);
void micSignalReceived();
}