Search in sources :

Example 1 with PolyObject

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;
}
Also used : BlueData(blue.BlueData) RealtimeRenderSettings(blue.settings.RealtimeRenderSettings) DiskRenderSettings(blue.settings.DiskRenderSettings) ProjectProperties(blue.ProjectProperties) PolyObject(blue.soundObject.PolyObject)

Example 2 with PolyObject

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);
}
Also used : BlueData(blue.BlueData) Frame(java.awt.Frame) NoteParseException(blue.soundObject.NoteParseException) BlueProject(blue.projects.BlueProject) File(java.io.File) PolyObject(blue.soundObject.PolyObject)

Example 3 with PolyObject

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);
        }
    }
}
Also used : AudioFile(blue.soundObject.AudioFile) SoundObject(blue.soundObject.SoundObject) PolyObject(blue.soundObject.PolyObject)

Example 4 with PolyObject

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);
            }
        }
    }
}
Also used : Score(blue.score.Score) ArrayList(java.util.ArrayList) PolyObject(blue.soundObject.PolyObject)

Example 5 with PolyObject

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;
}
Also used : SoundLayerListPanel(blue.ui.core.score.soundLayer.SoundLayerListPanel) JComponent(javax.swing.JComponent) PolyObject(blue.soundObject.PolyObject)

Aggregations

PolyObject (blue.soundObject.PolyObject)29 SoundLayer (blue.SoundLayer)10 SoundObject (blue.soundObject.SoundObject)10 BlueData (blue.BlueData)8 Score (blue.score.Score)8 Instance (blue.soundObject.Instance)6 ScoreObject (blue.score.ScoreObject)5 GenericScore (blue.soundObject.GenericScore)5 Point (java.awt.Point)4 ArrayList (java.util.ArrayList)4 SoundObjectLibrary (blue.SoundObjectLibrary)3 Layer (blue.score.layers.Layer)3 LayerGroup (blue.score.layers.LayerGroup)3 AudioFile (blue.soundObject.AudioFile)3 File (java.io.File)3 IOException (java.io.IOException)3 Test (org.junit.Test)3 AbstractLookup (org.openide.util.lookup.AbstractLookup)3 Mixer (blue.mixer.Mixer)2 TimeState (blue.score.TimeState)2