use of blue.mixer.EffectsChain in project blue by kunstmusik.
the class AutomationManager method removeListenerFromChannel.
private void removeListenerFromChannel(Channel channel) {
EffectsChain pre = channel.getPreEffects();
pre.removeAutomatableCollectionListener(this);
for (int i = 0; i < pre.size(); i++) {
((Automatable) pre.getElementAt(i)).getParameterList().removeListener(parameterListListener);
}
EffectsChain post = channel.getPostEffects();
post.removeAutomatableCollectionListener(this);
for (int i = 0; i < post.size(); i++) {
((Automatable) post.getElementAt(i)).getParameterList().removeListener(parameterListListener);
}
}
use of blue.mixer.EffectsChain in project blue by kunstmusik.
the class ParameterHelper method appendParametersFromChannel.
private static void appendParametersFromChannel(List<Parameter> params, Channel channel) {
EffectsChain pre = channel.getPreEffects();
for (int i = 0; i < pre.size(); i++) {
ParameterList list = ((Automatable) pre.getElementAt(i)).getParameterList();
addActiveParametersFromList(params, list);
}
EffectsChain post = channel.getPostEffects();
for (int i = 0; i < post.size(); i++) {
ParameterList list = ((Automatable) post.getElementAt(i)).getParameterList();
addActiveParametersFromList(params, list);
}
if (channel.getLevelParameter().isAutomationEnabled()) {
params.add(channel.getLevelParameter());
}
}
use of blue.mixer.EffectsChain in project blue by kunstmusik.
the class AutomationManager method channelRemoved.
/*
* Remove all parameters, clear them from SoundLayers
*/
public void channelRemoved(Channel channel) {
EffectsChain pre = channel.getPreEffects();
pre.removeAutomatableCollectionListener(this);
ArrayList<String> removedParamIds = new ArrayList<>();
for (int i = 0; i < pre.size(); i++) {
ParameterList parameterList = ((Automatable) pre.getElementAt(i)).getParameterList();
parameterList.removeListener(parameterListListener);
allParameters.removeAll(parameterList);
for (int j = 0; j < parameterList.size(); j++) {
Parameter parameter = parameterList.get(j);
if (parameter.isAutomationEnabled()) {
removedParamIds.add(parameter.getUniqueId());
}
}
}
EffectsChain post = channel.getPostEffects();
post.removeAutomatableCollectionListener(this);
for (int i = 0; i < post.size(); i++) {
ParameterList parameterList = ((Automatable) post.getElementAt(i)).getParameterList();
parameterList.removeListener(parameterListListener);
allParameters.removeAll(parameterList);
for (int j = 0; j < parameterList.size(); j++) {
Parameter parameter = parameterList.get(j);
if (parameter.isAutomationEnabled()) {
removedParamIds.add(parameter.getUniqueId());
}
}
}
Parameter levelParameter = channel.getLevelParameter();
allParameters.remove(levelParameter);
if (levelParameter.isAutomationEnabled()) {
removedParamIds.add(levelParameter.getUniqueId());
}
removeParameters(removedParamIds);
// dirty = true;
}
use of blue.mixer.EffectsChain in project blue by kunstmusik.
the class AutomationManager method buildChannelMenu.
public JMenu buildChannelMenu(Channel channel, ParameterIdList paramIdList) {
this.selectedParamIdList = paramIdList;
JMenu retVal = new JMenu();
retVal.setText(channel.getName());
// pre effects
EffectsChain preEffects = channel.getPreEffects();
if (preEffects.size() > 0) {
JMenu preMenu = new JMenu("Pre-Effects");
retVal.add(preMenu);
MenuScroller.setScrollerFor(preMenu);
for (int i = 0; i < preEffects.size(); i++) {
Automatable automatable = (Automatable) preEffects.getElementAt(i);
ParameterList params = automatable.getParameterList();
if (params.size() > 0) {
JMenu effectMenu = new JMenu();
MenuScroller.setScrollerFor(effectMenu);
if (automatable instanceof Effect) {
effectMenu.setText(((Effect) automatable).getName());
} else if (automatable instanceof Send) {
effectMenu.setText("Send: " + ((Send) automatable).getSendChannel());
} else {
effectMenu.setText("ERROR");
}
preMenu.add(effectMenu);
for (Parameter param : params.sorted()) {
JMenuItem paramItem = new JMenuItem();
paramItem.setText(param.getName());
paramItem.addActionListener(parameterActionListener);
if (param.isAutomationEnabled()) {
if (paramIdList.contains(param.getUniqueId())) {
paramItem.setForeground(Color.GREEN);
} else {
paramItem.setForeground(Color.ORANGE);
}
}
paramItem.putClientProperty("param", param);
effectMenu.add(paramItem);
}
}
}
}
// volume
JMenuItem volItem = new JMenuItem("Volume");
Parameter volParam = channel.getLevelParameter();
volItem.putClientProperty("param", volParam);
volItem.addActionListener(parameterActionListener);
if (volParam.isAutomationEnabled()) {
if (paramIdList.contains(volParam.getUniqueId())) {
volItem.setForeground(Color.GREEN);
} else {
volItem.setForeground(Color.ORANGE);
}
}
retVal.add(volItem);
// post effects
EffectsChain postEffects = channel.getPostEffects();
if (postEffects.size() > 0) {
JMenu postMenu = new JMenu("Post-Effects");
MenuScroller.setScrollerFor(postMenu);
retVal.add(postMenu);
for (int i = 0; i < postEffects.size(); i++) {
Automatable automatable = (Automatable) postEffects.getElementAt(i);
ParameterList params = automatable.getParameterList();
if (params.size() > 0) {
JMenu effectMenu = new JMenu();
MenuScroller.setScrollerFor(effectMenu);
if (automatable instanceof Effect) {
effectMenu.setText(((Effect) automatable).getName());
} else if (automatable instanceof Send) {
effectMenu.setText("Send: " + ((Send) automatable).getSendChannel());
} else {
effectMenu.setText("ERROR");
}
postMenu.add(effectMenu);
for (Parameter param : params.sorted()) {
JMenuItem paramItem = new JMenuItem();
paramItem.setText(param.getName());
paramItem.addActionListener(parameterActionListener);
if (param.isAutomationEnabled()) {
if (paramIdList.contains(param.getUniqueId())) {
paramItem.setForeground(Color.GREEN);
} else {
paramItem.setForeground(Color.ORANGE);
}
}
paramItem.putClientProperty("param", param);
effectMenu.add(paramItem);
}
}
}
}
return retVal;
}
use of blue.mixer.EffectsChain in project blue by kunstmusik.
the class AutomationManager method addListenerToChannel.
private void addListenerToChannel(Channel channel) {
EffectsChain pre = channel.getPreEffects();
pre.addAutomatableCollectionListener(this);
for (int i = 0; i < pre.size(); i++) {
ParameterList parameterList = ((Automatable) pre.getElementAt(i)).getParameterList();
parameterList.addListener(parameterListListener);
allParameters.addAll(parameterList);
}
EffectsChain post = channel.getPostEffects();
post.addAutomatableCollectionListener(this);
for (int i = 0; i < post.size(); i++) {
ParameterList parameterList = ((Automatable) post.getElementAt(i)).getParameterList();
parameterList.addListener(parameterListListener);
allParameters.addAll(parameterList);
}
allParameters.add(channel.getLevelParameter());
}
Aggregations