Search in sources :

Example 51 with SoundObject

use of blue.soundObject.SoundObject in project blue by kunstmusik.

the class SoundObjectLibraryUtils method removeSoundObjectInstances.

protected static void removeSoundObjectInstances(PolyObject polyObject, SoundObject sObj) {
    for (int i = 0; i < polyObject.size(); i++) {
        SoundLayer layer = polyObject.get(i);
        ArrayList<SoundObject> instances = new ArrayList<>();
        for (SoundObject tempObject : layer) {
            if (tempObject instanceof Instance) {
                Instance instance = (Instance) tempObject;
                if (instance.getSoundObject() == sObj) {
                    instances.add(instance);
                }
            } else if (tempObject instanceof PolyObject) {
                removeSoundObjectInstances((PolyObject) tempObject, sObj);
            }
        }
        for (SoundObject tempObject : instances) {
            layer.remove(tempObject);
        }
    }
}
Also used : SoundObject(blue.soundObject.SoundObject) Instance(blue.soundObject.Instance) SoundLayer(blue.SoundLayer) ArrayList(java.util.ArrayList) PolyObject(blue.soundObject.PolyObject)

Example 52 with SoundObject

use of blue.soundObject.SoundObject in project blue by kunstmusik.

the class SoundObjectLibraryUtils method removeLibrarySoundObject.

public static void removeLibrarySoundObject(BlueData data, SoundObject sObj) {
    SoundObjectLibrary library = data.getSoundObjectLibrary();
    library.removeSoundObject(sObj);
    for (SoundObject tempObj : library) {
        if (tempObj instanceof PolyObject) {
            removeSoundObjectInstances((PolyObject) tempObj, sObj);
        }
    }
    Score score = data.getScore();
    for (LayerGroup layerGroup : score) {
        if (layerGroup instanceof PolyObject) {
            PolyObject pObj = (PolyObject) layerGroup;
            removeSoundObjectInstances(pObj, sObj);
        }
    }
}
Also used : Score(blue.score.Score) SoundObject(blue.soundObject.SoundObject) SoundObjectLibrary(blue.SoundObjectLibrary) LayerGroup(blue.score.layers.LayerGroup) PolyObject(blue.soundObject.PolyObject)

Example 53 with SoundObject

use of blue.soundObject.SoundObject in project blue by kunstmusik.

the class SoundObjectLibraryTopComponent method copyButtonActionPerformed.

// </editor-fold>//GEN-END:initComponents
private void copyButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_copyButtonActionPerformed
    int index = sObjLibTable.getSelectedRow();
    if (index != -1) {
        SoundObject sObj = sObjLib.getSoundObject(index);
        SoundObject tempSObj = sObj.deepCopy();
        ScoreController.getInstance().setSelectedScoreObjects(Collections.singleton(tempSObj));
        scoreObjectBuffer.clear();
        scoreObjectBuffer.scoreObjects.add(tempSObj);
        scoreObjectBuffer.layerIndexes.add(0);
    }
}
Also used : SoundObject(blue.soundObject.SoundObject)

Aggregations

SoundObject (blue.soundObject.SoundObject)53 SoundLayer (blue.SoundLayer)12 Instance (blue.soundObject.Instance)11 PolyObject (blue.soundObject.PolyObject)11 ScoreObject (blue.score.ScoreObject)8 ArrayList (java.util.ArrayList)8 Element (electric.xml.Element)7 Point (java.awt.Point)7 IOException (java.io.IOException)6 BlueData (blue.BlueData)5 Layer (blue.score.layers.Layer)5 NoteList (blue.soundObject.NoteList)5 ScoreController (blue.ui.core.score.ScoreController)5 HashMap (java.util.HashMap)5 SoundObjectLibrary (blue.SoundObjectLibrary)4 ScoreObjectLayer (blue.score.layers.ScoreObjectLayer)4 Document (electric.xml.Document)4 ParseException (electric.xml.ParseException)4 File (java.io.File)4 LiveObject (blue.blueLive.LiveObject)3