diff --git a/pom.xml b/pom.xml index 314dd0b..7281885 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ sh.ball osci-render - 1.27.6 + 1.27.7 osci-render diff --git a/src/main/java/sh/ball/audio/engine/SimpleAudioDevice.java b/src/main/java/sh/ball/audio/engine/SimpleAudioDevice.java index c9b8dee..4860624 100644 --- a/src/main/java/sh/ball/audio/engine/SimpleAudioDevice.java +++ b/src/main/java/sh/ball/audio/engine/SimpleAudioDevice.java @@ -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"; diff --git a/src/main/java/sh/ball/gui/controller/MainController.java b/src/main/java/sh/ball/gui/controller/MainController.java index 16a082a..c1834e0 100644 --- a/src/main/java/sh/ball/gui/controller/MainController.java +++ b/src/main/java/sh/ball/gui/controller/MainController.java @@ -170,7 +170,7 @@ public class MainController implements Initializable, FrequencyListener, MidiLis @FXML private CheckMenuItem renderUsingGpuCheckMenuItem; @FXML - private ComboBox fontFamilyComboBox; + private ListView fontFamilyListView; @FXML private ComboBox fontStyleComboBox; @FXML @@ -190,7 +190,7 @@ public class MainController implements Initializable, FrequencyListener, MidiLis @FXML private Spinner deadzoneSpinner; @FXML - private ComboBox deviceComboBox; + private ListView 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 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> 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); } diff --git a/src/main/resources/CHANGELOG.md b/src/main/resources/CHANGELOG.md index 15c6290..e2255ff 100644 --- a/src/main/resources/CHANGELOG.md +++ b/src/main/resources/CHANGELOG.md @@ -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 diff --git a/src/main/resources/fxml/main.fxml b/src/main/resources/fxml/main.fxml index 88d28cc..7f466ad 100644 --- a/src/main/resources/fxml/main.fxml +++ b/src/main/resources/fxml/main.fxml @@ -6,6 +6,7 @@ + @@ -45,7 +46,8 @@ - + @@ -158,7 +160,7 @@ diff --git a/src/main/resources/fxml/projectSelect.fxml b/src/main/resources/fxml/projectSelect.fxml index bd94088..bc5d3c8 100644 --- a/src/main/resources/fxml/projectSelect.fxml +++ b/src/main/resources/fxml/projectSelect.fxml @@ -27,7 +27,7 @@