use of blue.settings.DiskRenderSettings in project blue by kunstmusik.
the class BlueProjectManager method createNewProject.
public static BlueProject createNewProject() {
final BlueData blueData = new BlueData();
BlueProject project = new BlueProject(blueData, null);
for (LayerGroup<?> layerGroup : blueData.getScore()) {
if (layerGroup instanceof PolyObject) {
PolyObject pObj = (PolyObject) layerGroup;
pObj.setDefaultHeightIndex(ProjectDefaultsSettings.getInstance().layerHeightDefault);
if (pObj.size() == 0) {
pObj.newLayerAt(-1);
}
}
}
blueData.getMixer().setEnabled(ProjectDefaultsSettings.getInstance().mixerEnabled);
ProjectProperties proj = blueData.getProjectProperties();
proj.author = ProjectDefaultsSettings.getInstance().defaultAuthor;
RealtimeRenderSettings rtSettings = RealtimeRenderSettings.getInstance();
proj.sampleRate = rtSettings.defaultSr;
proj.ksmps = rtSettings.defaultKsmps;
proj.channels = rtSettings.defaultNchnls;
proj.useZeroDbFS = rtSettings.useZeroDbFS;
proj.zeroDbFS = rtSettings.zeroDbFS;
proj.useAudioOut = rtSettings.audioOutEnabled;
proj.useAudioIn = rtSettings.audioInEnabled;
proj.useMidiIn = rtSettings.midiInEnabled;
proj.useMidiOut = rtSettings.midiOutEnabled;
proj.noteAmpsEnabled = rtSettings.noteAmpsEnabled;
proj.outOfRangeEnabled = rtSettings.outOfRangeEnabled;
proj.warningsEnabled = rtSettings.warningsEnabled;
proj.benchmarkEnabled = rtSettings.benchmarkEnabled;
proj.advancedSettings = rtSettings.advancedSettings;
// proj.commandLine = ProgramOptions.getDefaultCommandline();
DiskRenderSettings diskSettings = DiskRenderSettings.getInstance();
proj.diskSampleRate = diskSettings.defaultSr;
proj.diskKsmps = diskSettings.defaultKsmps;
proj.diskChannels = diskSettings.defaultNchnls;
proj.diskUseZeroDbFS = diskSettings.useZeroDbFS;
proj.diskZeroDbFS = diskSettings.zeroDbFS;
proj.diskNoteAmpsEnabled = diskSettings.noteAmpsEnabled;
proj.diskOutOfRangeEnabled = diskSettings.outOfRangeEnabled;
proj.diskWarningsEnabled = diskSettings.warningsEnabled;
proj.diskBenchmarkEnabled = diskSettings.benchmarkEnabled;
proj.diskAdvancedSettings = diskSettings.advancedSettings;
return project;
}
use of blue.settings.DiskRenderSettings in project blue by kunstmusik.
the class RenderToDiskAndOpenAction 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();
String command = settings.externalOpenCommand;
try {
if (System.getProperty("os.name").contains("Windows")) {
String p = f.getAbsolutePath().replace("\\", "\\\\");
command = command.replaceAll("\\$outfile", p);
Runtime.getRuntime().exec(command);
} else {
command = command.replaceAll("\\$outfile", f.getAbsolutePath());
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();
}
});
}
}
}
use of blue.settings.DiskRenderSettings in project blue by kunstmusik.
the class RenderToDiskUtility method getDiskCommandLine.
/**
* Gets the disk commandline, asking for file output if necessary
*
* SIDE EFFECT: also sets property for dialog for what the outputted file
* was, to be used by clients of the dialog
*
* @param data
* @return
* @throws IOException
*/
private DiskRenderCommand getDiskCommandLine(BlueData data) throws IOException {
String[] args;
String fileOutput;
ProjectProperties props = data.getProjectProperties();
if (props.diskCompleteOverride) {
String command = props.diskAdvancedSettings;
if (!GeneralSettings.getInstance().isMessageColorsEnabled()) {
command += " -+msg_color=false ";
}
args = command.split("\\s+");
fileOutput = getFileOutputFromCommand(command);
} else {
String fileName = "";
if (props.askOnRender || props.fileName.trim().length() == 0) {
File retVal = FileChooserManager.getDefault().showSaveDialog(FILE_CHOOSER_ID, WindowManager.getDefault().getMainWindow());
if (retVal != null) {
fileName = retVal.getCanonicalPath();
} else {
return null;
}
} else {
fileName = props.fileName;
}
fileOutput = fileName;
DiskRenderSettings settings = DiskRenderSettings.getInstance();
String command = settings.getCommandLine() + " " + getMessageLevelFlag(props) + " " + props.diskAdvancedSettings + " -o \"" + fileName + "\"";
args = command.split("\\s+");
}
return new DiskRenderCommand(args, fileOutput);
}
use of blue.settings.DiskRenderSettings 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