Allow octaves to be changed outside of using MIDI

pull/35/head
James Ball 2021-07-20 22:20:34 +01:00
rodzic f6218e2c3c
commit 8bbcc1fb07
3 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -6,7 +6,7 @@
<groupId>sh.ball</groupId>
<artifactId>osci-render</artifactId>
<version>1.11.8</version>
<version>1.11.9</version>
<name>osci-render</name>

Wyświetl plik

@ -47,6 +47,7 @@ public class ShapeAudioPlayer implements AudioPlayer<List<Shape>> {
private int count = 0;
private List<Double> frequencies = List.of(MIDDLE_C);
private double mainFrequency = MIDDLE_C;
private double maxFrequency = MIDDLE_C;
private double pitchBend = 1.0;
private double trace = 0.5;
private int octave = 0;
@ -146,7 +147,7 @@ public class ShapeAudioPlayer implements AudioPlayer<List<Shape>> {
@Override
public void setBaseFrequencies(List<Double> frequencies) {
this.frequencies = frequencies;
double maxFrequency = frequencies.stream().max(Double::compareTo).get();
this.maxFrequency = frequencies.stream().max(Double::compareTo).get();
this.mainFrequency = maxFrequency * Math.pow(2, octave - 1);
updateLengthIncrement();
@ -231,6 +232,7 @@ public class ShapeAudioPlayer implements AudioPlayer<List<Shape>> {
@Override
public void setOctave(int octave) {
this.octave = octave;
this.mainFrequency = maxFrequency * Math.pow(2, octave - 1);
}
@Override

Wyświetl plik

@ -184,7 +184,6 @@ public class Controller implements Initializable, FrequencyListener, MidiListene
@FXML
private ComboBox<AudioDevice> deviceComboBox;
public Controller(AudioPlayer<List<Shape>> audioPlayer) throws IOException {
this.audioPlayer = audioPlayer;
FrameSet<List<Shape>> frames = new ObjParser(DEFAULT_OBJ).parse();