Search in sources :

Example 1 with AudioLayerChannelBinding

use of blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding in project blue by kunstmusik.

the class BlueProjectPropertyChangeListener method propertyChange.

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (BlueProjectManager.CURRENT_PROJECT.equals(evt.getPropertyName())) {
        BlueProject oldProject = (BlueProject) evt.getOldValue();
        BlueProject newProject = (BlueProject) evt.getNewValue();
        if (oldProject == newProject) {
            return;
        }
        if (oldProject != null) {
            detachListeners(oldProject);
        }
        for (AudioLayerGroupBinding binding : layerGroupBindings.values()) {
            binding.clearBinding();
        }
        layerGroupBindings.clear();
        for (AudioLayerChannelBinding binding : layerBindings.values()) {
            binding.clearBinding();
        }
        layerBindings.clear();
        if (newProject != null) {
            synchronizeAudioLayersAndMixer(newProject.getData());
            attachListeners(newProject);
        }
        currentProject = newProject;
    }
}
Also used : BlueProject(blue.projects.BlueProject) AudioLayerChannelBinding(blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding) AudioLayerGroupBinding(blue.score.layers.audio.ui.bindings.AudioLayerGroupBinding)

Example 2 with AudioLayerChannelBinding

use of blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding 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

AudioLayerChannelBinding (blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding)2 AudioLayerGroupBinding (blue.score.layers.audio.ui.bindings.AudioLayerGroupBinding)2 Channel (blue.mixer.Channel)1 ChannelList (blue.mixer.ChannelList)1 Mixer (blue.mixer.Mixer)1 BlueProject (blue.projects.BlueProject)1 Score (blue.score.Score)1 AudioLayer (blue.score.layers.audio.core.AudioLayer)1 AudioLayerGroup (blue.score.layers.audio.core.AudioLayerGroup)1