use of blue.mixer.Effect in project blue by kunstmusik.
the class BlueShareRemoteCaller method getEffect.
public static Effect getEffect(EffectOption iOption) throws IOException, XmlRpcException, ParseException {
Vector v = new Vector();
String result;
v.add(new Integer(iOption.getInstrumentId()));
result = (String) xrpc.execute("blueShare.getEffect", v);
Effect effect = null;
try {
Document d = new Document(result);
effect = Effect.loadFromXML(d.getRoot());
} catch (Exception e) {
}
return effect;
}
use of blue.mixer.Effect in project blue by kunstmusik.
the class EffectImportPane method importEffect.
private void importEffect() {
EffectOption effectOption = iTableModel.getInstrumentOption(instrumentTable.getSelectedRow());
if (effectOption == null) {
return;
}
try {
Effect effect = BlueShareRemoteCaller.getEffect(effectOption);
if (effect == null) {
String error = BlueSystem.getString("blueShare.effect.importError");
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
// data.getOrchestra().addInstrument(instrument);
// instrumentTreeModel.reload();
// InstrumentLibrary instrLib =
// BlueSystem.getUserInstrumentLibrary();
EffectsLibrary library = EffectsLibrary.getInstance();
library.importEffect(effect);
library.save();
String message = BlueSystem.getString("blueShare.effect.importSuccess");
JOptionPane.showMessageDialog(null, message, BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
} catch (ParseException pe) {
String error = BlueSystem.getString("blueShare.selectServer.couldNotReadResponse");
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (XmlRpcException xre) {
String error = "Error: " + xre.getLocalizedMessage();
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (IOException ioe) {
String error = "Error: " + ioe.getLocalizedMessage();
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
}
use of blue.mixer.Effect 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.Effect in project blue by kunstmusik.
the class EffectExportPane method submitEffect.
private void submitEffect() {
try {
TreePath path = effectLibraryTree.getSelectionPath();
if (path == null) {
return;
}
Object userObj = path.getLastPathComponent();
if (!(userObj instanceof Effect)) {
return;
}
Effect effect = (Effect) userObj;
DefaultMutableTreeNode tempNode = (DefaultMutableTreeNode) categoryTree.getSelectionPath().getLastPathComponent();
BlueShareEffectCategory category = (BlueShareEffectCategory) tempNode.getUserObject();
String username = namePasswordPanel.getUsername();
String password = namePasswordPanel.getPassword();
int categoryId = category.getCategoryId();
String name = effect.getName();
String description = descriptionText.getText();
String effectText = effect.saveAsXML().toString();
System.out.println(effect.saveAsXML().getTextString());
BlueShareRemoteCaller.submitEffect(username, password, categoryId, name, description, effectText);
} catch (IOException | XmlRpcException e) {
JOptionPane.showMessageDialog(null, BlueSystem.getString("blueShare.effect.errorSubmittingEffect") + "\n\n" + e.getLocalizedMessage(), BlueSystem.getString("common.error"), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
return;
}
JOptionPane.showMessageDialog(null, BlueSystem.getString("blueShare.effect.successfullyReceived"), BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
}
use of blue.mixer.Effect in project blue by kunstmusik.
the class EffectExportPane method jbInit.
private void jbInit() throws Exception {
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
instrumentListPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
categoryPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
cateogriesLabel.setText(BlueSystem.getString("common.categories"));
categoryPanel.setLayout(new BorderLayout());
this.add(namePasswordPanel, BorderLayout.NORTH);
this.add(mainSplitPane, BorderLayout.CENTER);
this.add(jPanel2, BorderLayout.SOUTH);
descriptionText.setText(BlueSystem.getString("blueShare.effect.enterDescription"));
descriptionText.setLineWrap(true);
descriptionScrollPane.setBorder(new TitledBorder(null, BlueSystem.getString("blueShare.effect.effectDescription")));
submitButton.setText(BlueSystem.getString("common.submit"));
instrumentListPanel.setLayout(new BorderLayout());
iLabel.setText(BlueSystem.getString("blueShare.effect.effectsFromEffectsLibrary"));
// instrumentLibraryTree.setSelectionModel(TreeSelectionModel.SINGLE_TREE_SELECTION);
topSplitPane.add(instrumentListPanel, JSplitPane.LEFT);
instrumentListPanel.add(instrumentListScrollPane, BorderLayout.CENTER);
instrumentListPanel.add(iLabel, BorderLayout.NORTH);
instrumentListScrollPane.getViewport().add(effectLibraryTree, null);
descriptionScrollPane.getViewport().add(descriptionText, null);
jPanel2.add(submitButton, null);
topSplitPane.setDividerLocation(300);
mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
mainSplitPane.add(topSplitPane, JSplitPane.TOP);
mainSplitPane.add(descriptionScrollPane, JSplitPane.BOTTOM);
topSplitPane.add(categoryPanel, JSplitPane.RIGHT);
categoryPanel.add(cateogriesLabel, BorderLayout.NORTH);
categoryPanel.add(categoryScrollPane, BorderLayout.CENTER);
categoryScrollPane.getViewport().add(categoryTree, null);
mainSplitPane.setDividerLocation(200);
submitButton.addActionListener((ActionEvent e) -> {
submitEffect();
});
effectLibraryTree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
TreePath path = effectLibraryTree.getSelectionPath();
if (path == null) {
descriptionText.setText(SELECT_EFFECT_TEXT);
descriptionText.setEnabled(false);
return;
}
Object userObj = path.getLastPathComponent();
if (!(userObj instanceof Effect)) {
descriptionText.setText(SELECT_EFFECT_TEXT);
descriptionText.setEnabled(false);
return;
}
Effect effect = (Effect) userObj;
descriptionText.setText(effect.getComments());
descriptionText.setEnabled(true);
}
});
}
Aggregations