kopia lustrzana https://github.com/jameshball/osci-render
Correct kHz to Hz and clarify how to change files with MIDI PC
rodzic
0b78d5c1f7
commit
7527ba35c4
|
@ -40,7 +40,7 @@ public class SimpleAudioDevice implements AudioDevice {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String simplifiedName = name.replaceFirst(" \\(Shared\\)", "");
|
String simplifiedName = name.replaceFirst(" \\(Shared\\)", "");
|
||||||
simplifiedName = simplifiedName.replaceFirst(" \\(NVIDIA High Definition Audio\\)", "");
|
simplifiedName = simplifiedName.replaceFirst(" \\(NVIDIA High Definition Audio\\)", "");
|
||||||
return simplifiedName + " @ " + sampleRate + "kHz, " + sample;
|
return simplifiedName + " @ " + sampleRate + "Hz, " + sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -64,6 +64,8 @@ import static sh.ball.math.Math.tryParse;
|
||||||
|
|
||||||
public class Controller implements Initializable, FrequencyListener, MidiListener {
|
public class Controller implements Initializable, FrequencyListener, MidiListener {
|
||||||
|
|
||||||
|
private String openProjectPath;
|
||||||
|
|
||||||
// audio
|
// audio
|
||||||
private static final double MAX_FREQUENCY = 12000;
|
private static final double MAX_FREQUENCY = 12000;
|
||||||
private final ShapeAudioPlayer audioPlayer;
|
private final ShapeAudioPlayer audioPlayer;
|
||||||
|
@ -209,6 +211,8 @@ public class Controller implements Initializable, FrequencyListener, MidiListene
|
||||||
private MenuItem openProjectMenuItem;
|
private MenuItem openProjectMenuItem;
|
||||||
@FXML
|
@FXML
|
||||||
private MenuItem saveProjectMenuItem;
|
private MenuItem saveProjectMenuItem;
|
||||||
|
@FXML
|
||||||
|
private MenuItem saveAsProjectMenuItem;
|
||||||
|
|
||||||
public Controller() throws Exception {
|
public Controller() throws Exception {
|
||||||
MidiCommunicator midiCommunicator = new MidiCommunicator();
|
MidiCommunicator midiCommunicator = new MidiCommunicator();
|
||||||
|
@ -406,6 +410,18 @@ public class Controller implements Initializable, FrequencyListener, MidiListene
|
||||||
);
|
);
|
||||||
|
|
||||||
saveProjectMenuItem.setOnAction(e -> {
|
saveProjectMenuItem.setOnAction(e -> {
|
||||||
|
if (openProjectPath != null) {
|
||||||
|
saveProject(openProjectPath);
|
||||||
|
} else {
|
||||||
|
File file = osciFileChooser.showSaveDialog(stage);
|
||||||
|
if (file != null) {
|
||||||
|
updateLastVisitedDirectory(new File(file.getParent()));
|
||||||
|
saveProject(file.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
saveAsProjectMenuItem.setOnAction(e -> {
|
||||||
File file = osciFileChooser.showSaveDialog(stage);
|
File file = osciFileChooser.showSaveDialog(stage);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
updateLastVisitedDirectory(new File(file.getParent()));
|
updateLastVisitedDirectory(new File(file.getParent()));
|
||||||
|
@ -943,6 +959,7 @@ public class Controller implements Initializable, FrequencyListener, MidiListene
|
||||||
StreamResult streamResult = new StreamResult(new File(projectFileName));
|
StreamResult streamResult = new StreamResult(new File(projectFileName));
|
||||||
|
|
||||||
transformer.transform(domSource, streamResult);
|
transformer.transform(domSource, streamResult);
|
||||||
|
openProjectPath = projectFileName;
|
||||||
} catch (ParserConfigurationException | TransformerException e) {
|
} catch (ParserConfigurationException | TransformerException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1028,6 +1045,7 @@ public class Controller implements Initializable, FrequencyListener, MidiListene
|
||||||
fileNames.add(fileName);
|
fileNames.add(fileName);
|
||||||
}
|
}
|
||||||
updateFiles(files, fileNames);
|
updateFiles(files, fileNames);
|
||||||
|
openProjectPath = projectFileName;
|
||||||
} catch (ParserConfigurationException | SAXException | IOException e) {
|
} catch (ParserConfigurationException | SAXException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
<Label id="frequency" fx:id="frequencyLabel" layoutX="13.0" layoutY="206.0" prefHeight="58.0" prefWidth="376.0" text="L/R Frequency: " />
|
<Label id="frequency" fx:id="frequencyLabel" layoutX="13.0" layoutY="206.0" prefHeight="58.0" prefWidth="376.0" text="L/R Frequency: " />
|
||||||
<ComboBox fx:id="deviceComboBox" layoutX="14.0" layoutY="11.0" prefWidth="376.0" />
|
<ComboBox fx:id="deviceComboBox" layoutX="14.0" layoutY="11.0" prefWidth="376.0" />
|
||||||
<Button fx:id="chooseFolderButton" layoutX="14.0" layoutY="91.0" mnemonicParsing="false" prefHeight="26.0" prefWidth="114.0" text="Choose Folder" />
|
<Button fx:id="chooseFolderButton" layoutX="14.0" layoutY="91.0" mnemonicParsing="false" prefHeight="26.0" prefWidth="114.0" text="Choose Folder" />
|
||||||
<Label fx:id="jkLabel" layoutX="143.0" layoutY="95.0" maxWidth="270.0" prefHeight="18.0" prefWidth="246.0" text="Use j and k to cycle between files" visible="false" />
|
<Label fx:id="jkLabel" layoutX="143.0" layoutY="84.0" maxWidth="270.0" prefHeight="43.0" prefWidth="246.0" text="Use j and k (or MIDI Program Change) to cycle between files" visible="false" wrapText="true" />
|
||||||
<TextField fx:id="recordTextField" disable="true" layoutX="300.0" layoutY="154.0" prefHeight="26.0" prefWidth="70.0" text="2.0" />
|
<TextField fx:id="recordTextField" disable="true" layoutX="300.0" layoutY="154.0" prefHeight="26.0" prefWidth="70.0" text="2.0" />
|
||||||
<Label fx:id="recordLengthLabel" disable="true" layoutX="290.0" layoutY="128.0" text="Record length (s)" />
|
<Label fx:id="recordLengthLabel" disable="true" layoutX="290.0" layoutY="128.0" text="Record length (s)" />
|
||||||
<CheckBox fx:id="recordCheckBox" layoutX="143.0" layoutY="146.0" mnemonicParsing="false" text="Timed record" />
|
<CheckBox fx:id="recordCheckBox" layoutX="143.0" layoutY="146.0" mnemonicParsing="false" text="Timed record" />
|
||||||
|
@ -145,11 +145,16 @@
|
||||||
<KeyCodeCombination alt="UP" code="O" control="UP" meta="UP" shift="UP" shortcut="DOWN" />
|
<KeyCodeCombination alt="UP" code="O" control="UP" meta="UP" shift="UP" shortcut="DOWN" />
|
||||||
</accelerator>
|
</accelerator>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem fx:id="saveProjectMenuItem" mnemonicParsing="false" text="Save Project">
|
<MenuItem fx:id="saveProjectMenuItem" mnemonicParsing="false" text="Save">
|
||||||
<accelerator>
|
<accelerator>
|
||||||
<KeyCodeCombination alt="UP" code="S" control="UP" meta="UP" shift="UP" shortcut="DOWN" />
|
<KeyCodeCombination alt="UP" code="S" control="UP" meta="UP" shift="UP" shortcut="DOWN" />
|
||||||
</accelerator>
|
</accelerator>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem fx:id="saveAsProjectMenuItem" mnemonicParsing="false" text="Save As">
|
||||||
|
<accelerator>
|
||||||
|
<KeyCodeCombination alt="UP" code="S" control="UP" meta="UP" shift="DOWN" shortcut="DOWN" />
|
||||||
|
</accelerator>
|
||||||
|
</MenuItem>
|
||||||
</items>
|
</items>
|
||||||
</Menu>
|
</Menu>
|
||||||
</menus>
|
</menus>
|
||||||
|
|
Ładowanie…
Reference in New Issue