Search in sources :

Example 11 with Channel

use of blue.mixer.Channel in project blue by kunstmusik.

the class AutomationManager method setData.

public void setData(BlueData data) {
    if (this.data != null) {
        Arrangement arrangement = this.data.getArrangement();
        arrangement.removeAutomatableCollectionListener(this);
        for (int i = 0; i < arrangement.size(); i++) {
            Instrument instr = arrangement.getInstrument(i);
            if (instr instanceof Automatable) {
                Automatable temp = (Automatable) instr;
                ParameterList parameters = temp.getParameterList();
                // parameterMap.put(temp, parameters);
                parameters.removeListener(parameterListListener);
            }
        }
        Mixer mixer = this.data.getMixer();
        mixer.getChannelListGroups().removeListener(channelListListener);
        for (ChannelList list : mixer.getChannelListGroups()) {
            list.removeListener(this);
            for (Channel c : list) {
                removeListenerFromChannel(c);
            }
        }
        ChannelList channels = mixer.getChannels();
        channels.removeListener(this);
        for (Channel c : channels) {
            removeListenerFromChannel(c);
        }
        ChannelList subChannels = mixer.getSubChannels();
        subChannels.removeListener(this);
        for (int i = 0; i < subChannels.size(); i++) {
            removeListenerFromChannel(subChannels.get(i));
        }
        removeListenerFromChannel(mixer.getMaster());
        if (this.score != null) {
            for (LayerGroup<? extends Layer> layerGroup : score) {
                layerGroup.removeLayerGroupListener(this);
            }
        }
        this.data.removePropertyChangeListener(renderTimeListener);
    }
    // menu = null;
    // dirty = false;
    allParameters.clear();
    if (data == null) {
        return;
    }
    // Build Map from Instruments
    Arrangement arrangement = data.getArrangement();
    for (int i = 0; i < arrangement.size(); i++) {
        Instrument instr = arrangement.getInstrument(i);
        if (instr instanceof Automatable) {
            Automatable temp = (Automatable) instr;
            ParameterList parameters = temp.getParameterList();
            allParameters.addAll(parameters);
            parameters.addListener(parameterListListener);
        }
    }
    arrangement.addAutomatableCollectionListener(this);
    Mixer mixer = data.getMixer();
    mixer.getChannelListGroups().addListener(channelListListener);
    for (ChannelList list : mixer.getChannelListGroups()) {
        list.addListener(this);
        for (Channel c : list) {
            addListenerToChannel(c);
        }
    }
    ChannelList channels = mixer.getChannels();
    channels.addListener(this);
    for (Channel c : channels) {
        addListenerToChannel(c);
    }
    ChannelList subChannels = mixer.getSubChannels();
    subChannels.addListener(this);
    for (int i = 0; i < subChannels.size(); i++) {
        addListenerToChannel(subChannels.get(i));
    }
    addListenerToChannel(mixer.getMaster());
    // System.err.println(this);
    this.data = data;
    this.score = data.getScore();
    for (LayerGroup<? extends Layer> layerGroup : this.score) {
        layerGroup.addLayerGroupListener(this);
    }
    this.data.addPropertyChangeListener(renderTimeListener);
// Build Map from Mixer Channels
}
Also used : Mixer(blue.mixer.Mixer) Channel(blue.mixer.Channel) Instrument(blue.orchestra.Instrument) ChannelList(blue.mixer.ChannelList) Arrangement(blue.Arrangement)

Example 12 with Channel

use of blue.mixer.Channel 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

Channel (blue.mixer.Channel)12 ChannelList (blue.mixer.ChannelList)8 Mixer (blue.mixer.Mixer)4 Instrument (blue.orchestra.Instrument)4 Arrangement (blue.Arrangement)3 InstrumentAssignment (blue.InstrumentAssignment)3 Automatable (blue.automation.Automatable)3 ArrayList (java.util.ArrayList)3 Parameter (blue.automation.Parameter)2 ParameterList (blue.automation.ParameterList)2 AudioLayer (blue.score.layers.audio.core.AudioLayer)2 LinePoint (blue.components.lines.LinePoint)1 GenericInstrument (blue.orchestra.GenericInstrument)1 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)1 Score (blue.score.Score)1 AudioLayerGroup (blue.score.layers.audio.core.AudioLayerGroup)1 AudioLayerChannelBinding (blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding)1 AudioLayerGroupBinding (blue.score.layers.audio.ui.bindings.AudioLayerGroupBinding)1 PolyObject (blue.soundObject.PolyObject)1 Point (java.awt.Point)1