Search in sources :

Example 6 with PolyObject

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

the class RealtimeRenderManager method auditionSoundObjects.

public void auditionSoundObjects(BlueData data, List<ScoreObject> scoreObjects) {
    if (scoreObjects == null || scoreObjects.isEmpty()) {
        return;
    }
    if (isRendering()) {
        stopRendering();
    }
    BlueData tempData = new BlueData(data);
    tempData.setLoopRendering(false);
    List<PolyObject> path = null;
    filterScore(tempData.getScore(), scoreObjects);
    if (data.getScore().isEmpty()) {
        throw new RuntimeException("Error: unable to find root LayerGroups for objects...");
    }
    double minTime = Double.MAX_VALUE;
    double maxTime = Double.MIN_VALUE;
    for (ScoreObject sObj : scoreObjects) {
        double startTime = sObj.getStartTime();
        double endTime = startTime + sObj.getSubjectiveDuration();
        if (startTime < minTime) {
            minTime = startTime;
        }
        if (endTime > maxTime) {
            maxTime = endTime;
        }
    }
    Mixer m = tempData.getMixer();
    if (m.isEnabled()) {
        maxTime += m.getExtraRenderTime();
    }
    tempData.setRenderStartTime(minTime);
    tempData.setRenderEndTime(maxTime);
    renderProject(tempData, true);
}
Also used : BlueData(blue.BlueData) Mixer(blue.mixer.Mixer) ScoreObject(blue.score.ScoreObject) PolyObject(blue.soundObject.PolyObject)

Example 7 with PolyObject

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

the class SoundObjectLibraryUtilsTest method testRemoveLibrarySoundObject.

/**
 * Test of removeLibrarySoundObject method, of class SoundObjectLibraryUtils.
 */
@Test
public void testRemoveLibrarySoundObject() {
    BlueData data = new BlueData();
    Score score = data.getScore();
    PolyObject polyObj = new PolyObject(true);
    score.add(polyObj);
    SoundObjectLibrary library = data.getSoundObjectLibrary();
    SoundLayer layer = polyObj.newLayerAt(0);
    SoundObject sObj = new GenericScore();
    SoundObject sObj2 = new GenericScore();
    PolyObject pObjInner = new PolyObject(true);
    SoundLayer layerInner = pObjInner.newLayerAt(0);
    layerInner.add(new Instance(sObj));
    layer.add(new Instance(sObj));
    layer.add(new Instance(sObj));
    layer.add(new Instance(sObj));
    layer.add(sObj2);
    layer.add(pObjInner);
    library.add(sObj);
    assertEquals(5, layer.size());
    assertEquals(1, library.size());
    assertEquals(1, layerInner.size());
    SoundObjectLibraryUtils.removeLibrarySoundObject(data, sObj);
    assertEquals(2, layer.size());
    assertEquals(0, library.size());
    assertEquals(0, layerInner.size());
}
Also used : BlueData(blue.BlueData) Score(blue.score.Score) GenericScore(blue.soundObject.GenericScore) SoundObject(blue.soundObject.SoundObject) Instance(blue.soundObject.Instance) SoundLayer(blue.SoundLayer) SoundObjectLibrary(blue.SoundObjectLibrary) GenericScore(blue.soundObject.GenericScore) PolyObject(blue.soundObject.PolyObject) Test(org.junit.Test)

Example 8 with PolyObject

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

the class ScoreControllerTest method setUp.

@Before
public void setUp() {
    System.out.println("@Before setUp");
    this.scoreController = ScoreController.getInstance();
    scoreController.setScrollPane(new JScrollPane());
    InstanceContent content = new InstanceContent();
    Score score = new Score();
    scoreController.setScore(score);
    PolyObject pObj = (PolyObject) score.get(0);
    SoundLayer layer1 = new SoundLayer();
    SoundLayer layer2 = new SoundLayer();
    pObj.add(layer1);
    pObj.add(layer2);
    GenericScore score1 = new GenericScore();
    score1.setStartTime(2.0f);
    GenericScore score2 = new GenericScore();
    score2.setStartTime(4.0f);
    layer2.add(score1);
    layer2.add(score2);
    content.add(score);
    content.add(score1);
    content.add(score2);
    scoreController.setLookupAndContent(new AbstractLookup(content), content);
    this.buffer = scoreController.getScoreObjectBuffer();
}
Also used : JScrollPane(javax.swing.JScrollPane) Score(blue.score.Score) GenericScore(blue.soundObject.GenericScore) SoundLayer(blue.SoundLayer) InstanceContent(org.openide.util.lookup.InstanceContent) GenericScore(blue.soundObject.GenericScore) AbstractLookup(org.openide.util.lookup.AbstractLookup) PolyObject(blue.soundObject.PolyObject) Before(org.junit.Before)

Example 9 with PolyObject

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

the class Score method loadFromXML.

public static Score loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    Score score = new Score(false);
    Elements nodes = data.getElements();
    LayerGroupProviderManager manager = LayerGroupProviderManager.getInstance();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        switch(node.getName()) {
            case "tempo":
                score.tempo = Tempo.loadFromXML(node);
                break;
            case "timeState":
                score.timeState = TimeState.loadFromXML(node);
                break;
            case "noteProcessorChain":
                score.npc = NoteProcessorChain.loadFromXML(node);
                break;
            default:
                LayerGroup layerGroup = manager.loadFromXML(node, objRefMap);
                if (layerGroup == null) {
                    throw new RuntimeException("Unable to load Score LayerGroup of type: " + node.getName());
                }
                score.add(layerGroup);
                if (layerGroup instanceof PolyObject) {
                    ((PolyObject) layerGroup).setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
                }
                break;
        }
    }
    if (score.size() == 0) {
        PolyObject pObj = new PolyObject(true);
        score.add(pObj);
    }
    return score;
}
Also used : Element(electric.xml.Element) LayerGroup(blue.score.layers.LayerGroup) Elements(electric.xml.Elements) PolyObject(blue.soundObject.PolyObject) LayerGroupProviderManager(blue.score.layers.LayerGroupProviderManager)

Example 10 with PolyObject

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

the class PolyObjectEditor method testSoundObject.

public final void testSoundObject() {
    if (this.pObj == null) {
        return;
    }
    BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
    if (data == null) {
        System.err.println("PolyObjectEditor::testSoundObject() - " + "Could not get reference to current BlueData object");
        return;
    }
    Tables tables = new Tables(data.getTableSet());
    Arrangement arrangement = new Arrangement(data.getArrangement());
    PolyObject tempPObj = new PolyObject(this.pObj);
    OpcodeList opcodeList = new OpcodeList(data.getOpcodeList());
    GlobalOrcSco globalOrcSco = new GlobalOrcSco(data.getGlobalOrcSco());
    // adding all compile-time instruments from soundObjects to arrangement
    arrangement.generateFTables(tables);
    CompileData compileData = new CompileData(arrangement, tables);
    // grabbing all notes from soundObjects
    NoteList generatedNotes = null;
    try {
        generatedNotes = tempPObj.generateForCSD(compileData, 0.0f, -1.0f);
    } catch (Exception e) {
        Exceptions.printStackTrace(e);
        return;
    }
    if (generatedNotes != null) {
        InfoDialog.showInformationDialog(SwingUtilities.getRoot(this), generatedNotes.toString(), BlueSystem.getString("soundObject.generatedScore"));
    }
}
Also used : BlueData(blue.BlueData) GlobalOrcSco(blue.GlobalOrcSco) NoteList(blue.soundObject.NoteList) OpcodeList(blue.udo.OpcodeList) Tables(blue.Tables) Arrangement(blue.Arrangement) PolyObject(blue.soundObject.PolyObject) CompileData(blue.CompileData)

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