Replace audio device and font dropdowns with a list

pull/108/head v1.27.7
James Ball 2022-08-08 19:54:05 +01:00 zatwierdzone przez James H Ball
rodzic 305837eb12
commit 1e0af7c233
6 zmienionych plików z 30 dodań i 18 usunięć

Wyświetl plik

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

Wyświetl plik

@ -4,10 +4,15 @@ import java.util.Objects;
public record SimpleAudioDevice(String id, String name, int sampleRate, AudioSample sample, int channels) implements AudioDevice {
private static final int MAX_NAME_LENGTH = 30;
@Override
public String toString() {
String simplifiedName = name.replaceFirst(" \\(Shared\\)", "");
simplifiedName = simplifiedName.replaceFirst(" \\(NVIDIA High Definition Audio\\)", "");
if (simplifiedName.length() > MAX_NAME_LENGTH) {
simplifiedName = simplifiedName.substring(0, MAX_NAME_LENGTH - 3) + "...";
}
simplifiedName += " @ " + sampleRate + "Hz, " + sample + ", ";
if (channels == 1) {
simplifiedName += "mono";

Wyświetl plik

@ -170,7 +170,7 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
@FXML
private CheckMenuItem renderUsingGpuCheckMenuItem;
@FXML
private ComboBox<String> fontFamilyComboBox;
private ListView<String> fontFamilyListView;
@FXML
private ComboBox<FontStyle> fontStyleComboBox;
@FXML
@ -190,7 +190,7 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
@FXML
private Spinner<Integer> deadzoneSpinner;
@FXML
private ComboBox<AudioDevice> deviceComboBox;
private ListView<AudioDevice> deviceListView;
@FXML
private CustomMenuItem audioDeviceMenuItem;
@FXML
@ -251,7 +251,7 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
private void toggleRecord() {
recording = !recording;
audioSampleComboBox.setDisable(recording);
deviceComboBox.setDisable(recording);
deviceListView.setDisable(recording);
boolean timedRecord = recordCheckBox.isSelected();
if (recording) {
// if it is a timed recording then a timeline is scheduled to start and
@ -278,7 +278,7 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
recording = false;
Platform.runLater(() -> {
audioSampleComboBox.setDisable(false);
deviceComboBox.setDisable(false);
deviceListView.setDisable(false);
});
}
);
@ -463,13 +463,14 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
sliderComboBox.setValue(printableSliders.get(0));
String[] installedFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
fontFamilyComboBox.setItems(FXCollections.observableList(Arrays.stream(installedFonts).toList()));
if (fontFamilyComboBox.getItems().contains("SansSerif")) {
fontFamilyComboBox.setValue("SansSerif");
fontFamilyListView.setItems(FXCollections.observableList(Arrays.stream(installedFonts).toList()));
if (fontFamilyListView.getItems().contains("SansSerif")) {
fontFamilyListView.getSelectionModel().select("SansSerif");
} else {
fontFamilyComboBox.setValue(installedFonts[0]);
fontFamilyListView.getSelectionModel().select(installedFonts[0]);
}
fontFamilyComboBox.valueProperty().addListener((e, old, family) -> updateFileData(openFiles.get(currentFrameSource), frameSourcePaths.get(currentFrameSource)));
fontFamilyListView.getSelectionModel().selectedItemProperty().addListener((e, old, family) -> updateFileData(openFiles.get(currentFrameSource), frameSourcePaths.get(currentFrameSource)));
fontStyleComboBox.setItems(FXCollections.observableList(Arrays.stream(FontStyle.values()).toList()));
fontStyleComboBox.setValue(FontStyle.PLAIN);
@ -513,9 +514,9 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
new Thread(() -> {
List<AudioDevice> devices = audioPlayer.devices();
Platform.runLater(() -> {
deviceComboBox.setItems(FXCollections.observableList(devices));
deviceComboBox.setValue(defaultDevice);
deviceComboBox.valueProperty().addListener((options, oldDevice, newDevice) -> {
deviceListView.setItems(FXCollections.observableList(devices));
deviceListView.getSelectionModel().select(defaultDevice);
deviceListView.getSelectionModel().selectedItemProperty().addListener((options, oldDevice, newDevice) -> {
if (newDevice != null) {
switchAudioDevice(newDevice);
}
@ -738,7 +739,7 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
Platform.runLater(() -> luaController.updateLuaVariables());
frameSources.add(null);
} else {
frameSources.add(ParserFactory.getParser(name, fileData, fontFamilyComboBox.getValue(), fontStyleComboBox.getValue()).parse());
frameSources.add(ParserFactory.getParser(name, fileData, fontFamilyListView.getSelectionModel().getSelectedItem(), fontStyleComboBox.getValue()).parse());
sampleParsers.add(null);
}
frameSourcePaths.add(name);
@ -799,7 +800,7 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
frameSources.set(index, null);
} else {
FrameSource<List<Shape>> frameSource = frameSources.get(index);
frameSources.set(index, ParserFactory.getParser(name, file, fontFamilyComboBox.getValue(), fontStyleComboBox.getValue()).parse());
frameSources.set(index, ParserFactory.getParser(name, file, fontFamilyListView.getSelectionModel().getSelectedItem(), fontStyleComboBox.getValue()).parse());
frameSource.disable();
sampleParsers.set(index, null);
}

Wyświetl plik

@ -1,3 +1,7 @@
- 1.27.7
- Change audio selection and text font selection to be lists rather than dropdowns
- 1.27.6
- Fix trace min effect being hidden at bottom of effects section

Wyświetl plik

@ -6,6 +6,7 @@
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.CustomMenuItem?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
@ -45,7 +46,8 @@
<content>
<AnchorPane focusTraversable="true">
<children>
<ComboBox fx:id="deviceComboBox" prefHeight="26.0" prefWidth="376.0" />
<Label prefHeight="25.0" text="Audio Device" textFill="WHITE" />
<ListView fx:id="deviceListView" layoutY="25.0" prefHeight="200.0" prefWidth="400.0" />
</children>
</AnchorPane>
</content>
@ -158,7 +160,7 @@
<AnchorPane>
<children>
<Label prefHeight="25.0" text="Text File Font" textFill="WHITE" />
<ComboBox fx:id="fontFamilyComboBox" layoutY="25.0" prefHeight="26.0" prefWidth="376.0" />
<ListView fx:id="fontFamilyListView" layoutY="25.0" prefHeight="200.0" prefWidth="400.0" />
</children>
</AnchorPane>
</content>

Wyświetl plik

@ -27,7 +27,7 @@
<Button fx:id="newProjectButton" layoutX="222.0" layoutY="562.0" mnemonicParsing="false" prefHeight="40.0" prefWidth="131.0" text="Start new project" />
<CheckBox fx:id="startMutedCheckBox" layoutX="240.0" layoutY="623.0" mnemonicParsing="false" text="Start muted" />
<Label layoutX="188.0" layoutY="247.0" styleClass="title" text="Recently opened projects" />
<Label layoutX="14.0" layoutY="700.0" text="v1.27.6" />
<Label layoutX="14.0" layoutY="700.0" text="v1.27.7" />
<Label layoutX="727.0" layoutY="20.0" styleClass="title" text="Changelog" />
<AnchorPane layoutX="582.0" layoutY="65.0" prefHeight="200.0" prefWidth="380.0">
<children>