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
}
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);
}
Aggregations