use of blue.mixer.ChannelList in project blue by kunstmusik.
the class MixerChannelsColumnHeader method rebuildUI.
protected void rebuildUI() {
this.removeAll();
for (ChannelList list : mixer.getChannelListGroups()) {
this.add(new NamePanel(list, 0));
}
this.add(new NamePanel(mixer.getChannels(), 0));
this.add(new NamePanel(mixer.getSubChannels(), CHANNEL_STRIP_WIDTH));
repaint();
}
use of blue.mixer.ChannelList in project blue by kunstmusik.
the class MixerTopComponent method switchMixerId.
/**
* Because blue allows multiple instruments to have the same arrangmentId,
* must handle cases of if channels exist for oldId and newId, as well as
* creating or destroying channels
*/
private void switchMixerId(String oldId, String newId) {
ChannelList channels = mixer.getChannels();
int oldIdCount = 0;
int newIdCount = 0;
for (int i = 0; i < arrangement.size(); i++) {
String instrId = arrangement.getInstrumentAssignment(i).arrangementId;
if (instrId.equals(oldId)) {
oldIdCount++;
} else if (instrId.equals(newId)) {
newIdCount++;
}
}
if (oldIdCount == 0 && newIdCount == 1) {
// rename old channel
for (int i = 0; i < channels.size(); i++) {
Channel channel = channels.get(i);
if (channel.getName().equals(oldId)) {
channel.setName(newId);
break;
}
}
} else if (oldIdCount == 0 && newIdCount > 1) {
// remove old channel, use current channel for newId
for (int i = 0; i < channels.size(); i++) {
Channel channel = channels.get(i);
if (channel.getName().equals(oldId)) {
channels.remove(channel);
break;
}
}
} else if (oldIdCount > 0 && newIdCount == 1) {
// create new channel
Channel channel = new Channel();
channel.setName(newId);
channels.add(channel);
}
// else if(oldIdCount > 0 && newIdCount > 1) {
// do neither, as channels exist for both before and after
// }
}
use of blue.mixer.ChannelList in project blue by kunstmusik.
the class MixerTopComponent method reinitialize.
protected void reinitialize() {
BlueProject project = BlueProjectManager.getInstance().getCurrentProject();
BlueData data = null;
channelGroupsPanel.removeAll();
if (project != null) {
data = project.getData();
for (ChannelList list : data.getMixer().getChannelListGroups()) {
ChannelListPanel panel = new ChannelListPanel();
channelGroupsPanel.add(panel);
panel.setChannelList(list, data.getMixer().getSubChannels());
panel.revalidate();
}
channelGroupsPanel.add(channelsPanel);
channelGroupsPanel.add(subChannelsPanel);
setMixer(data.getMixer());
setArrangement(data.getArrangement());
}
channelGroupsPanel.revalidate();
channelGroupsPanel.repaint();
}
use of blue.mixer.ChannelList in project blue by kunstmusik.
the class ArrangementEditPanel method reconcileWithArrangement.
private void reconcileWithArrangement() {
ChannelList channels = mixer.getChannels();
ArrayList<String> idList = new ArrayList<>();
for (int i = 0; i < arrangement.size(); i++) {
String instrId = arrangement.getInstrumentAssignment(i).arrangementId;
if (!idList.contains(instrId)) {
idList.add(instrId);
}
}
for (int i = channels.size() - 1; i >= 0; i--) {
Channel channel = channels.get(i);
if (!idList.contains(channel.getName())) {
channels.remove(channel);
}
}
for (int i = 0; i < idList.size(); i++) {
channels.checkOrCreate(idList.get(i));
}
channels.sort();
// channelsPanel.sort();
}
use of blue.mixer.ChannelList 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
}
Aggregations