use of blue.ui.core.soundFile.AudioFilePlayerTopComponent in project blue by kunstmusik.
the class RenderToDiskAndPlayAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
BlueProject project = BlueProjectManager.getInstance().getCurrentProject();
if (project != null) {
BlueData data = project.getData();
if (data != null) {
RenderToDiskUtility.getInstance().renderToDisk(data, f -> {
DiskRenderSettings settings = DiskRenderSettings.getInstance();
if (settings.externalPlayCommandEnabled) {
String command = settings.externalPlayCommand;
command = command.replaceAll("\\$outfile", f.getAbsolutePath());
try {
if (System.getProperty("os.name").contains("Windows")) {
Runtime.getRuntime().exec(command);
} else {
String[] cmdArray = ProcessConsole.splitCommandString(command);
Runtime.getRuntime().exec(cmdArray);
}
System.out.println(command);
} catch (Exception ex) {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), "Could not run command: " + command, "Error", JOptionPane.ERROR_MESSAGE);
System.err.println("[" + BlueSystem.getString("message.error") + "] - " + ex.getLocalizedMessage());
ex.printStackTrace();
}
} else {
SwingUtilities.invokeLater(() -> {
AudioFilePlayerTopComponent tc = (AudioFilePlayerTopComponent) WindowManager.getDefault().findTopComponent("AudioFilePlayerTopComponent");
tc.setAudioFile(f);
});
}
});
}
}
}
Aggregations