use of blue.soundObject.PolyObject 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.soundObject.PolyObject in project blue by kunstmusik.
the class ImportMidiAction method importMidiFile.
public void importMidiFile() {
final Frame mainWindow = WindowManager.getDefault().getMainWindow();
List<File> rValue = FileChooserManager.getDefault().showOpenDialog(this.getClass(), mainWindow);
if (rValue.size() == 0) {
StatusDisplayer.getDefault().setStatusText(BlueSystem.getString("message.actionCancelled"));
return;
}
File midiFile = rValue.get(0);
BlueData tempData = new BlueData();
try {
PolyObject pObj = MidiImportUtilities.convertMidiFile(mainWindow, midiFile);
if (pObj == null) {
JOptionPane.showMessageDialog(mainWindow, BlueSystem.getString("message.file.couldNotImport"), BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
tempData.getScore().clear();
tempData.getScore().add(pObj);
} catch (NoteParseException e) {
JOptionPane.showMessageDialog(mainWindow, BlueSystem.getString("message.file.couldNotImport"), BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
BlueProject project = new BlueProject(tempData, null);
BlueProjectManager.getInstance().setCurrentProject(project);
}
use of blue.soundObject.PolyObject in project blue by kunstmusik.
the class OpenProjectAction method checkAudioFiles.
private static void checkAudioFiles(PolyObject pObj, ArrayList<String> filesList) {
for (Iterator<SoundObject> iter = pObj.getSoundObjects(true).iterator(); iter.hasNext(); ) {
SoundObject sObj = iter.next();
if (sObj instanceof AudioFile) {
AudioFile af = (AudioFile) sObj;
String soundFileName = af.getSoundFileName();
if (soundFileName == null) {
continue;
}
if (BlueSystem.findFile(soundFileName) == null) {
if (!filesList.contains(soundFileName)) {
filesList.add(soundFileName);
}
}
} else if (sObj instanceof PolyObject) {
checkAudioFiles((PolyObject) sObj, filesList);
}
}
}
use of blue.soundObject.PolyObject in project blue by kunstmusik.
the class OpenProjectAction method checkDependencies.
private static void checkDependencies(BlueData tempData) {
Score score = tempData.getScore();
ArrayList<String> filesList = new ArrayList<>();
for (LayerGroup<?> layerGroup : score) {
if (!(layerGroup instanceof PolyObject)) {
continue;
}
PolyObject pObj = (PolyObject) layerGroup;
checkAudioFiles(pObj, filesList);
}
if (filesList.size() > 0) {
if (dependencyDialog == null) {
dependencyDialog = new AudioFileDependencyDialog();
}
dependencyDialog.setFilesList(filesList);
if (dependencyDialog.ask()) {
Map<String, String> map = dependencyDialog.getFilesMap();
if (map == null || map.size() == 0) {
return;
}
for (Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
String val = entry.getValue();
val = BlueSystem.getRelativePath(val);
entry.setValue(val);
}
System.out.println(map);
for (LayerGroup<?> layerGroup : score) {
if (!(layerGroup instanceof PolyObject)) {
continue;
}
PolyObject pObj = (PolyObject) layerGroup;
reconcileAudioFiles(pObj, map);
}
}
}
}
use of blue.soundObject.PolyObject in project blue by kunstmusik.
the class PolyObjectUIProvider method getLayerGroupHeaderPanel.
@Override
public JComponent getLayerGroupHeaderPanel(LayerGroup layerGroup, TimeState timeState, BlueData data, InstanceContent ic) {
JComponent returnValue = null;
if (layerGroup instanceof PolyObject) {
SoundLayerListPanel panel = new SoundLayerListPanel();
panel.setPolyObject((PolyObject) layerGroup);
returnValue = panel;
}
return returnValue;
}
Aggregations