Search in sources :

Example 6 with AudioLayer

use of blue.score.layers.audio.core.AudioLayer in project blue by kunstmusik.

the class AudioLayersPanel method updateAudioClipYandHeight.

private void updateAudioClipYandHeight() {
    int y = 0;
    int height = 0;
    for (AudioLayer layer : layerGroup) {
        height = layer.getAudioLayerHeight();
        for (AudioClip clip : layer) {
            AudioClipPanel panel = clipPanelMap.get(clip);
            panel.setBounds(new Rectangle(panel.getX(), y, panel.getWidth(), height));
        }
        y += height;
    }
}
Also used : AudioClip(blue.score.layers.audio.core.AudioClip) Rectangle(java.awt.Rectangle) AudioLayer(blue.score.layers.audio.core.AudioLayer) Point(java.awt.Point)

Example 7 with AudioLayer

use of blue.score.layers.audio.core.AudioLayer in project blue by kunstmusik.

the class AudioLayersPanel method removeNotify.

@Override
public void removeNotify() {
    super.removeNotify();
    layerGroup.removeLayerGroupListener(this);
    timeState.removePropertyChangeListener(this);
    for (AudioLayer layer : layerGroup) {
        layer.removePropertyChangeListener(heightListener);
        layer.removeAudioLayerListener(this);
    }
// clipPanelMap.clear();
}
Also used : AudioLayer(blue.score.layers.audio.core.AudioLayer)

Example 8 with AudioLayer

use of blue.score.layers.audio.core.AudioLayer in project blue by kunstmusik.

the class AudioLayersPanel method paintAudioLayersBackground.

private void paintAudioLayersBackground(Graphics g) {
    int width = getWidth();
    int height = getHeight();
    g.setColor(Color.BLACK);
    g.fillRect(0, 0, width, height);
    int y = 0;
    g.setColor(Color.DARK_GRAY);
    g.drawLine(0, 0, width, 0);
    for (AudioLayer layer : layerGroup) {
        y += layer.getAudioLayerHeight();
        g.drawLine(0, y, width, y);
    }
    g.drawLine(0, getHeight() - 1, width, height - 1);
    if (timeState.isSnapEnabled()) {
        int snapPixels = (int) (timeState.getSnapValue() * timeState.getPixelSecond());
        int x = 0;
        if (snapPixels <= 0) {
            return;
        }
        double snapValue = timeState.getSnapValue();
        int pixelSecond = timeState.getPixelSecond();
        for (int i = 0; x < getWidth(); i++) {
            x = (int) ((i * snapValue) * pixelSecond);
            g.drawLine(x, 0, x, height);
        }
    }
}
Also used : AudioLayer(blue.score.layers.audio.core.AudioLayer) Point(java.awt.Point)

Example 9 with AudioLayer

use of blue.score.layers.audio.core.AudioLayer in project blue by kunstmusik.

the class BlueProjectPropertyChangeListener method attachListeners.

protected void attachListeners(BlueProject project) {
    if (project == null) {
        return;
    }
    Score score = project.getData().getScore();
    Mixer mixer = project.getData().getMixer();
    for (LayerGroup<? extends Layer> lg : score) {
        if (lg instanceof AudioLayerGroup) {
            AudioLayerGroup alg = (AudioLayerGroup) lg;
            ChannelList channelList = findChannelListForAudioLayerGroup(mixer, alg);
            lg.addLayerGroupListener(layerGroupListener);
            AudioLayerGroupBinding binding = new AudioLayerGroupBinding(alg, channelList);
            layerGroupBindings.put(alg, binding);
            for (AudioLayer layer : alg) {
                Channel channel = ChannelList.findChannelByAssociation(channelList, layer.getUniqueId());
                if (channel != null) {
                    layerBindings.put(layer, new AudioLayerChannelBinding(layer, channel));
                }
            }
        }
    }
    score.addListener(scoreListener);
}
Also used : Score(blue.score.Score) Mixer(blue.mixer.Mixer) Channel(blue.mixer.Channel) AudioLayerChannelBinding(blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding) AudioLayerGroup(blue.score.layers.audio.core.AudioLayerGroup) ChannelList(blue.mixer.ChannelList) AudioLayerGroupBinding(blue.score.layers.audio.ui.bindings.AudioLayerGroupBinding) AudioLayer(blue.score.layers.audio.core.AudioLayer)

Aggregations

AudioLayer (blue.score.layers.audio.core.AudioLayer)9 AudioClip (blue.score.layers.audio.core.AudioClip)3 Point (java.awt.Point)3 Channel (blue.mixer.Channel)2 AudioLayerGroup (blue.score.layers.audio.core.AudioLayerGroup)2 ChannelList (blue.mixer.ChannelList)1 Mixer (blue.mixer.Mixer)1 Score (blue.score.Score)1 Layer (blue.score.layers.Layer)1 AudioLayerChannelBinding (blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding)1 AudioLayerGroupBinding (blue.score.layers.audio.ui.bindings.AudioLayerGroupBinding)1 Component (java.awt.Component)1 Rectangle (java.awt.Rectangle)1 Transferable (java.awt.datatransfer.Transferable)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 InvalidDnDOperationException (java.awt.dnd.InvalidDnDOperationException)1 File (java.io.File)1 IOException (java.io.IOException)1 List (java.util.List)1 Node (org.openide.nodes.Node)1