Search in sources :

Example 41 with SoundObject

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

the class SoundObjectExportPane method submitSoundObject.

private void submitSoundObject() {
    try {
        TreePath path = soundObjectLibraryTree.getSelectionPath();
        if (path == null) {
            return;
        }
        Object userObj = path.getLastPathComponent();
        TreeItem<LibraryItem<SoundObject>> node = (TreeItem<LibraryItem<SoundObject>>) userObj;
        if (!node.isLeaf()) {
            return;
        }
        SoundObject soundObject = node.getValue().getValue();
        DefaultMutableTreeNode tempNode = (DefaultMutableTreeNode) categoryTree.getSelectionPath().getLastPathComponent();
        BlueShareSoundObjectCategory category = (BlueShareSoundObjectCategory) tempNode.getUserObject();
        String username = namePasswordPanel.getUsername();
        String password = namePasswordPanel.getPassword();
        int categoryId = category.getCategoryId();
        String name = soundObject.getName();
        String soundObjectType = soundObject.getClass().getName();
        String description = descriptionText.getText();
        String soundObjectText = soundObject.saveAsXML(new HashMap<>()).toString();
        System.out.println(soundObject.saveAsXML(new HashMap<>()).getTextString());
        BlueShareRemoteCaller.submitSoundObject(username, password, categoryId, name, soundObjectType, description, soundObjectText);
    } catch (IOException | XmlRpcException e) {
        JOptionPane.showMessageDialog(null, "Error submitting SoundObject" + "\n\n" + e.getLocalizedMessage(), BlueSystem.getString("common.error"), JOptionPane.ERROR_MESSAGE);
        e.printStackTrace();
        return;
    }
    JOptionPane.showMessageDialog(null, "SoundObject was successfully received.", BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
}
Also used : LibraryItem(blue.library.LibraryItem) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreeItem(javafx.scene.control.TreeItem) HashMap(java.util.HashMap) IOException(java.io.IOException) TreePath(javax.swing.tree.TreePath) SoundObject(blue.soundObject.SoundObject) SoundObject(blue.soundObject.SoundObject) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Example 42 with SoundObject

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

the class BlueLiveBinding method triggerLiveData.

protected void triggerLiveData() {
    LiveObjectSet liveObjects = data.getLiveObjectBins().getEnabledLiveObjectSet();
    if (liveObjects.size() > 0) {
        NoteList nl = new NoteList();
        try {
            for (LiveObject liveObj : liveObjects) {
                SoundObject sObj = liveObj.getSoundObject();
                if (sObj.getTimeBehavior() != SoundObject.TIME_BEHAVIOR_NOT_SUPPORTED) {
                    sObj.setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
                }
                nl.addAll(sObj.generateForCSD(compileData, 0.0f, -1.0f));
            }
        } catch (Exception e) {
            Exceptions.printStackTrace(e);
        }
        ScoreUtilities.scaleScore(nl, 60.0f / data.getTempo());
        String scoreText = nl.toString();
        if (scoreText != null && scoreText.length() > 0) {
            // FIXME - this is certainly not good code but functions for now...
            BlueLiveToolBar.getInstance().sendEvents(scoreText);
        }
    }
}
Also used : NoteList(blue.soundObject.NoteList) SoundObject(blue.soundObject.SoundObject) LiveObjectSet(blue.blueLive.LiveObjectSet) LiveObject(blue.blueLive.LiveObject)

Example 43 with SoundObject

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

the class SoundObjectLibraryTopComponent method copyInstanceButtonActionPerformed.

// GEN-LAST:event_copyButtonActionPerformed
private void copyInstanceButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_copyInstanceButtonActionPerformed
    int index = sObjLibTable.getSelectedRow();
    if (index != -1) {
        SoundObject originalSObj = sObjLib.getSoundObject(index);
        Instance tempSObj = new Instance(originalSObj);
        tempSObj.setStartTime(0.0f);
        tempSObj.setSubjectiveDuration(tempSObj.getObjectiveDuration());
        ScoreController.getInstance().setSelectedScoreObjects(Collections.singleton(tempSObj));
        scoreObjectBuffer.clear();
        scoreObjectBuffer.scoreObjects.add(tempSObj);
        scoreObjectBuffer.layerIndexes.add(0);
    }
}
Also used : SoundObject(blue.soundObject.SoundObject) Instance(blue.soundObject.Instance)

Example 44 with SoundObject

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

the class SoundObjectPropertiesTopComponent method setScoreObject.

private void setScoreObject(ScoreObject scoreObj) {
    SoundObject soundObj = null;
    if (scoreObj instanceof SoundObject) {
        soundObj = (SoundObject) scoreObj;
    }
    isUpdating = true;
    if (this.sObj != null) {
        this.sObj.removeScoreObjectListener(this);
    }
    if (scoreObj == null) {
        sObj = null;
        disableFields();
        propEdittor.editObject(null);
        noteProcessorChainEditor2.setNoteProcessorChain(null);
    } else {
        enableFields();
        setFieldsVisible(soundObj != null);
        sObj = scoreObj;
        updateProperties();
        colorPanel.setColor(sObj.getBackgroundColor());
        if (soundObj != null) {
            noteProcessorChainEditor2.setNoteProcessorChain(soundObj.getNoteProcessorChain());
            final int timeBehavior = soundObj.getTimeBehavior();
            if (timeBehavior == SoundObject.TIME_BEHAVIOR_NOT_SUPPORTED) {
                timeBehaviorBox.setEnabled(false);
                useRepeatPoint.setEnabled(false);
                repeatePointText.setEnabled(false);
            } else {
                timeBehaviorBox.setEnabled(true);
                timeBehaviorBox.setSelectedIndex(timeBehavior);
                if (timeBehavior == SoundObject.TIME_BEHAVIOR_REPEAT) {
                    useRepeatPoint.setEnabled(true);
                    double repeatPoint = soundObj.getRepeatPoint();
                    if (repeatPoint <= 0.0f) {
                        useRepeatPoint.setSelected(false);
                        repeatePointText.setEnabled(false);
                    } else {
                        useRepeatPoint.setSelected(true);
                        repeatePointText.setEnabled(true);
                        repeatePointText.setText(Double.toString(repeatPoint));
                    }
                } else {
                    useRepeatPoint.setEnabled(false);
                    repeatePointText.setEnabled(false);
                }
            }
        }
        propEdittor.editObject(null);
        sObj.addScoreObjectListener(this);
    }
    isUpdating = false;
}
Also used : SoundObject(blue.soundObject.SoundObject)

Example 45 with SoundObject

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

the class SoundObjectPropertiesTopComponent method updateTimeBehavior.

private void updateTimeBehavior() {
    if (!(sObj instanceof ScoreObject)) {
        return;
    }
    SoundObject soundObj = (SoundObject) sObj;
    soundObj.setTimeBehavior(timeBehaviorBox.getSelectedIndex());
    if (timeBehaviorBox.getSelectedIndex() == SoundObject.TIME_BEHAVIOR_REPEAT) {
        boolean repeatPointUsed = soundObj.getRepeatPoint() > 0.0f;
        useRepeatPoint.setSelected(repeatPointUsed);
        useRepeatPoint.setEnabled(true);
        repeatePointText.setEnabled(repeatPointUsed);
    } else {
        useRepeatPoint.setSelected(false);
        useRepeatPoint.setEnabled(false);
        repeatePointText.setEnabled(false);
        if (!isUpdating) {
            soundObj.setRepeatPoint(-1.0f);
        }
    }
}
Also used : SoundObject(blue.soundObject.SoundObject) ScoreObject(blue.score.ScoreObject)

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