bluemusic-commits Mailing List for blue
Brought to you by:
kunstmusik
You can subscribe to this list here.
2010 |
Jan
|
Feb
(16) |
Mar
(46) |
Apr
(11) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <kun...@us...> - 2010-05-04 18:41:17
|
Revision: 4208 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4208&view=rev Author: kunstmusik Date: 2010-05-04 18:41:11 +0000 (Tue, 04 May 2010) Log Message: ----------- added "Reset (12TET)" to scale selection panel via popup menu Modified Paths: -------------- blue/trunk/ChangeLog blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java Modified: blue/trunk/ChangeLog =================================================================== --- blue/trunk/ChangeLog 2010-05-04 15:24:34 UTC (rev 4207) +++ blue/trunk/ChangeLog 2010-05-04 18:41:11 UTC (rev 4208) @@ -28,6 +28,10 @@ use the index of the selected item rather than the value set for that item, and will also generate a a k-rate signal + [updated] - Scale selectin panels now have a popup menu (triggered by right + mouse button) that has a "Reset (12TET)" option to reset the scale + to the default 12TET tuning + [fix] - blueLive: when using API, no longer tries to update render time Modified: blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java 2010-05-04 15:24:34 UTC (rev 4207) +++ blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java 2010-05-04 18:41:11 UTC (rev 4208) @@ -32,7 +32,13 @@ import blue.BlueSystem; import blue.soundObject.pianoRoll.Scale; import blue.ui.utilities.FileChooserManager; +import java.awt.Component; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.Vector; +import javax.swing.AbstractAction; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -48,6 +54,8 @@ ChangeEvent c = null; + JPopupMenu popup = new JPopupMenu(); + public ScaleSelectionPanel() { this.setLayout(new BorderLayout()); @@ -83,6 +91,26 @@ this.add(fileNameField, BorderLayout.CENTER); this.add(fileButton, BorderLayout.EAST); + popup.add(new AbstractAction("Reset (12TET)") { + + public void actionPerformed(ActionEvent e) { + setScale(Scale.get12TET()); + fireChangeEvent(); + } + }); + + fileNameField.addMouseListener(new MouseAdapter() { + + public void mousePressed(MouseEvent evt) { + if (SwingUtilities.isRightMouseButton(evt) && !SwingUtilities. + isLeftMouseButton(evt)) { + + Component c = evt.getComponent(); + + popup.show(c, evt.getX(), evt.getY()); + } + } + }); } private void initScaleFileSelector() { @@ -146,7 +174,7 @@ if (c == null) { c = new ChangeEvent(this); } - + for (ChangeListener cl : changeListeners) { cl.stateChanged(c); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-05-04 15:24:40
|
Revision: 4207 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4207&view=rev Author: kunstmusik Date: 2010-05-04 15:24:34 +0000 (Tue, 04 May 2010) Log Message: ----------- completed making BSBDropdown automatable Modified Paths: -------------- blue/trunk/ChangeLog blue/trunk/blue-ui-core/src/blue/orchestra/editor/blueSynthBuilder/BSBDropdownView.java blue/trunk/blue-ui-core/src/blue/orchestra/editor/blueSynthBuilder/BSBDropdownViewBeanInfo.java Modified: blue/trunk/ChangeLog =================================================================== --- blue/trunk/ChangeLog 2010-05-03 01:16:57 UTC (rev 4206) +++ blue/trunk/ChangeLog 2010-05-04 15:24:34 UTC (rev 4207) @@ -24,6 +24,10 @@ [updated] - moved blueLive MIDI input to Input Settings Top Component + [updated] - BSBDropdown is now automatable; when set to automatable, will + use the index of the selected item rather than the value set for + that item, and will also generate a a k-rate signal + [fix] - blueLive: when using API, no longer tries to update render time Modified: blue/trunk/blue-ui-core/src/blue/orchestra/editor/blueSynthBuilder/BSBDropdownView.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/orchestra/editor/blueSynthBuilder/BSBDropdownView.java 2010-05-03 01:16:57 UTC (rev 4206) +++ blue/trunk/blue-ui-core/src/blue/orchestra/editor/blueSynthBuilder/BSBDropdownView.java 2010-05-04 15:24:34 UTC (rev 4207) @@ -39,7 +39,7 @@ /** * @author Steven Yi */ -public class BSBDropdownView extends BSBObjectView implements +public class BSBDropdownView extends AutomatableBSBObjectView implements PropertyChangeListener { BSBDropdown dropdown = null; Modified: blue/trunk/blue-ui-core/src/blue/orchestra/editor/blueSynthBuilder/BSBDropdownViewBeanInfo.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/orchestra/editor/blueSynthBuilder/BSBDropdownViewBeanInfo.java 2010-05-03 01:16:57 UTC (rev 4206) +++ blue/trunk/blue-ui-core/src/blue/orchestra/editor/blueSynthBuilder/BSBDropdownViewBeanInfo.java 2010-05-04 15:24:34 UTC (rev 4207) @@ -37,12 +37,14 @@ BSBDropdownView.class); PropertyDescriptor items = new PropertyDescriptor("dropdownView", BSBDropdownView.class); + PropertyDescriptor automatable = new PropertyDescriptor( + "automationAllowed", BSBDropdownView.class); PropertyDescriptor randomizable = new PropertyDescriptor( "randomizable", BSBDropdownView.class); items.setPropertyEditorClass(DropdownItemsPropertyEditor.class); - return new PropertyDescriptor[] { objName, items, randomizable }; + return new PropertyDescriptor[] { objName, items, automatable, randomizable }; } catch (IntrospectionException e) { e.printStackTrace(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-05-03 01:17:04
|
Revision: 4206 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4206&view=rev Author: kunstmusik Date: 2010-05-03 01:16:57 +0000 (Mon, 03 May 2010) Log Message: ----------- modified to support automation Modified Paths: -------------- blue/trunk/blue-core/src/blue/orchestra/blueSynthBuilder/BSBDropdown.java Modified: blue/trunk/blue-core/src/blue/orchestra/blueSynthBuilder/BSBDropdown.java =================================================================== --- blue/trunk/blue-core/src/blue/orchestra/blueSynthBuilder/BSBDropdown.java 2010-04-08 04:50:16 UTC (rev 4205) +++ blue/trunk/blue-core/src/blue/orchestra/blueSynthBuilder/BSBDropdown.java 2010-05-03 01:16:57 UTC (rev 4206) @@ -21,7 +21,9 @@ //import blue.orchestra.editor.blueSynthBuilder.BSBDropdownView; //import blue.orchestra.editor.blueSynthBuilder.BSBObjectView; -import blue.orchestra.blueSynthBuilder.BSBDropdownItem; +import blue.automation.Parameter; +import blue.automation.ParameterListener; +import blue.automation.ParameterTimeManagerFactory; import blue.utility.XMLUtilities; import electric.xml.Element; import electric.xml.Elements; @@ -29,7 +31,8 @@ /** * @author Steven Yi */ -public class BSBDropdown extends BSBObject implements Randomizable { +public class BSBDropdown extends AutomatableBSBObject implements + ParameterListener, Randomizable { BSBDropdownItemList dropdownItems = new BSBDropdownItemList(); @@ -77,27 +80,25 @@ /* * (non-Javadoc) * - * @see blue.orchestra.blueSynthBuilder.BSBObject#getBSBObjectView() - */ -// public BSBObjectView getBSBObjectView() { -// return new BSBDropdownView(this); -// } - - /* - * (non-Javadoc) - * * @see blue.orchestra.blueSynthBuilder.BSBObject#setupForCompilation(blue.orchestra.blueSynthBuilder.BSBCompilationUnit) */ public void setupForCompilation(BSBCompilationUnit compilationUnit) { + + if (parameters != null) { + Parameter param = parameters.getParameter(this.getObjectName()); + if (param != null && param.getCompilationVarName() != null) { + compilationUnit.addReplacementValue(objectName, param + .getCompilationVarName()); + return; + } + } + BSBDropdownItem item = (BSBDropdownItem) dropdownItems.get(selectedIndex); String replaceVal = item.getValue(); compilationUnit.addReplacementValue(objectName, replaceVal); } - public static void main(String[] args) { - } - /** * @return Returns the dropdownItems. */ @@ -129,7 +130,21 @@ if (tempIndex >= dropdownItems.size()) { tempIndex = dropdownItems.size() - 1; } + + int oldValue = this.selectedIndex; this.selectedIndex = tempIndex; + + if (parameters != null) { + Parameter param = parameters.getParameter(this.getObjectName()); + if (param != null) { + param.setValue(this.selectedIndex); + } + } + + if (propListeners != null) { + propListeners.firePropertyChange("value", new Integer(oldValue), + new Integer(this.selectedIndex)); + } } /* @@ -199,4 +214,89 @@ this.randomizable = randomizable; fireBSBObjectChanged(); } + + /* AUTOMATABLE METHODS */ + @Override + protected void initializeParameters() { + if (parameters == null) { + return; + } + + if (!automationAllowed) { + if (objectName != null && !objectName.equals("")) { + Parameter param = parameters.getParameter(objectName); + if (param != null && param.isAutomationEnabled()) { + automationAllowed = true; + } else { + parameters.removeParameter(objectName); + return; + } + } + } + + if (this.objectName == null || this.objectName.trim().length() == 0) { + return; + } + + Parameter parameter = parameters.getParameter(this.objectName); + + if (parameter != null) { + parameter.addParameterListener(this); + + if (!parameter.isAutomationEnabled()) { + parameter.setValue(getSelectedIndex()); + } + + return; + } + + Parameter param = new Parameter(); + param.setValue(getSelectedIndex()); + param.setMax(this.getDropdownItems().size() - 1, true); + param.setMin(0.0f, true); + param.setName(getObjectName()); + param.setResolution(1.0f); + param.addParameterListener(this); + param.setValue(getSelectedIndex()); + + parameters.addParameter(param); + } + + @Override + public void setAutomationAllowed(boolean allowAutomation) { + this.automationAllowed = allowAutomation; + + if (parameters != null) { + if (allowAutomation) { + initializeParameters(); + } else if (objectName != null && !objectName.equals("")) { + parameters.removeParameter(objectName); + } + } + } + + public void parameterChanged(Parameter param) { + } + + + private void updateSelectedIndex(int index) { + int oldValue = this.selectedIndex; + this.selectedIndex = index; + + if (propListeners != null) { + propListeners.firePropertyChange("updateValue", + new Integer(oldValue), new Integer(this.selectedIndex)); + } + } + + public void lineDataChanged(Parameter param) { + Parameter parameter = parameters.getParameter(this.objectName); + + if (parameter != null) { + float time = ParameterTimeManagerFactory.getInstance().getTime(); + int val = Math.round(parameter.getLine().getValue(time)); + + updateSelectedIndex(val); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-08 04:50:23
|
Revision: 4205 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4205&view=rev Author: kunstmusik Date: 2010-04-08 04:50:16 +0000 (Thu, 08 Apr 2010) Log Message: ----------- added serialization of MidiInputProcessor to XML Modified Paths: -------------- blue/trunk/blue-core/src/blue/BlueData.java blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java Modified: blue/trunk/blue-core/src/blue/BlueData.java =================================================================== --- blue/trunk/blue-core/src/blue/BlueData.java 2010-04-08 03:48:45 UTC (rev 4204) +++ blue/trunk/blue-core/src/blue/BlueData.java 2010-04-08 04:50:16 UTC (rev 4205) @@ -513,6 +513,9 @@ .equalsIgnoreCase("true")); } else if (nodeName.equals("tempo")) { blueData.tempo = Tempo.loadFromXML(node); + } else if (nodeName.equals("midiInputProcessor")) { + blueData.midiInputProcessor = MidiInputProcessor.loadFromXML( + node); } } @@ -564,6 +567,7 @@ Boolean.toString(loopRendering)); retVal.addElement(tempo.saveAsXML()); + retVal.addElement(midiInputProcessor.saveAsXML()); return retVal; } Modified: blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java =================================================================== --- blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-08 03:48:45 UTC (rev 4204) +++ blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-08 04:50:16 UTC (rev 4205) @@ -21,7 +21,8 @@ import blue.soundObject.pianoRoll.Scale; import blue.utility.NumberUtilities; -import java.math.BigDecimal; +import electric.xml.Element; +import electric.xml.Elements; import java.text.MessageFormat; /** @@ -32,10 +33,12 @@ private static final MessageFormat PCH_FORMAT = new MessageFormat("{0}.{1}"); - private static final MessageFormat NOTE_FORMAT = new MessageFormat("i{0}.{1} 0 -1 {2} {3}"); + private static final MessageFormat NOTE_FORMAT = new MessageFormat( + "i{0}.{1} 0 -1 {2} {3}"); - private static final MessageFormat NOTE_OFF_FORMAT = new MessageFormat("i-{0}.{1} 0 0"); - + private static final MessageFormat NOTE_OFF_FORMAT = new MessageFormat( + "i-{0}.{1} 0 0"); + private MidiKeyMapping keyMapping = MidiKeyMapping.PCH; private MidiVelocityMapping velMapping = MidiVelocityMapping.MIDI; @@ -91,12 +94,12 @@ } public String getNoteOn(String id, int noteNum, int key, int velocity) { - return NOTE_FORMAT.format(new Object[] { id, noteNum, processKey(key), processVelocity( + return NOTE_FORMAT.format(new Object[]{id, noteNum, processKey(key), processVelocity( velocity)}); } public String getNoteOff(String id, int noteNum) { - return NOTE_OFF_FORMAT.format(new Object[] { id, noteNum}); + return NOTE_OFF_FORMAT.format(new Object[]{id, noteNum}); } protected String processKey(int key) { @@ -104,7 +107,7 @@ int octave, scaleDegree, temp; - switch(keyMapping) { + switch (keyMapping) { case MIDI: retVal = Integer.toString(key); break; @@ -121,23 +124,24 @@ octave = 8 + (temp / scale.getNumScaleDegrees()); scaleDegree = temp % scale.getNumScaleDegrees(); - if(scaleDegree < 0) { + if (scaleDegree < 0) { octave -= 1; scaleDegree = scale.getNumScaleDegrees() + scaleDegree; } - retVal = NumberUtilities.formatFloat(scale.getFrequency(octave, scaleDegree)); + retVal = NumberUtilities.formatFloat(scale.getFrequency(octave, + scaleDegree)); break; case TUNING_BLUE_PCH: temp = key - 60; octave = 8 + (temp / scale.getNumScaleDegrees()); scaleDegree = temp % scale.getNumScaleDegrees(); - - if(scaleDegree < 0) { + + if (scaleDegree < 0) { octave -= 1; scaleDegree = scale.getNumScaleDegrees() + scaleDegree; } - + retVal = octave + "." + scaleDegree; break; } @@ -170,7 +174,7 @@ retVal = Double.toString(((key * key) / 16239.0) * 30000); break; } - + return retVal; } @@ -190,4 +194,52 @@ this.velMapping = velMapping; } + + /* SERIALIZATION */ + public static MidiInputProcessor loadFromXML(Element data) { + MidiInputProcessor processor = new MidiInputProcessor(); + + Elements nodes = data.getElements(); + + while (nodes.hasMoreElements()) { + Element node = nodes.next(); + String nodeName = node.getName(); + + if (nodeName.equals("keyMapping")) { + try { + processor.keyMapping = MidiKeyMapping.valueOf( + node.getTextString()); + } catch (IllegalArgumentException iae) { + + } + } else if (nodeName.equals("velMapping")) { + try { + processor.velMapping = MidiVelocityMapping.valueOf(node. + getTextString()); + } catch (IllegalArgumentException iae) { + + } + } else if (nodeName.equals("pitchConstant")) { + processor.pitchConstant = node.getTextString(); + } else if (nodeName.equals("ampConstant")) { + processor.ampConstant = node.getTextString(); + } else if (nodeName.equals("scale")) { + processor.scale = Scale.loadFromXML(node); + } + } + + return processor; + } + + public Element saveAsXML() { + Element retVal = new Element("midiInputProcessor"); + + retVal.addElement("keyMapping").setText(keyMapping.name()); + retVal.addElement("velMapping").setText(velMapping.name()); + retVal.addElement("pitchConstant").setText(pitchConstant); + retVal.addElement("ampConstant").setText(ampConstant); + retVal.addElement(scale.saveAsXML()); + + return retVal; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-08 03:48:51
|
Revision: 4204 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4204&view=rev Author: kunstmusik Date: 2010-04-08 03:48:45 +0000 (Thu, 08 Apr 2010) Log Message: ----------- implemented processing of bluePCH and Frequency from set Scale Modified Paths: -------------- blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java Modified: blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java =================================================================== --- blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-08 03:46:17 UTC (rev 4203) +++ blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-08 03:48:45 UTC (rev 4204) @@ -102,6 +102,8 @@ protected String processKey(int key) { String retVal = null; + int octave, scaleDegree, temp; + switch(keyMapping) { case MIDI: retVal = Integer.toString(key); @@ -115,9 +117,28 @@ case CONSTANT: retVal = pitchConstant; case TUNING_CPS: + temp = key - 60; + octave = 8 + (temp / scale.getNumScaleDegrees()); + scaleDegree = temp % scale.getNumScaleDegrees(); + + if(scaleDegree < 0) { + octave -= 1; + scaleDegree = scale.getNumScaleDegrees() + scaleDegree; + } + + retVal = NumberUtilities.formatFloat(scale.getFrequency(octave, scaleDegree)); break; case TUNING_BLUE_PCH: + temp = key - 60; + octave = 8 + (temp / scale.getNumScaleDegrees()); + scaleDegree = temp % scale.getNumScaleDegrees(); + if(scaleDegree < 0) { + octave -= 1; + scaleDegree = scale.getNumScaleDegrees() + scaleDegree; + } + + retVal = octave + "." + scaleDegree; break; } Modified: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form 2010-04-08 03:46:17 UTC (rev 4203) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form 2010-04-08 03:48:45 UTC (rev 4204) @@ -19,7 +19,7 @@ <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jSeparator1" alignment="0" pref="203" max="32767" attributes="0"/> + <Component id="jSeparator1" alignment="0" pref="206" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0"> <Component id="jLabel2" min="-2" max="-2" attributes="0"/> @@ -28,9 +28,9 @@ </Group> <EmptySpace type="unrelated" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="keyMapComboBox" alignment="0" pref="132" max="32767" attributes="0"/> - <Component id="keyConstantText" alignment="0" pref="132" max="32767" attributes="0"/> - <Component id="scaleSelectionPanel1" alignment="0" pref="132" max="32767" attributes="0"/> + <Component id="keyMapComboBox" alignment="0" pref="135" max="32767" attributes="0"/> + <Component id="keyConstantText" alignment="0" pref="135" max="32767" attributes="0"/> + <Component id="scaleSelectionPanel1" alignment="0" pref="135" max="32767" attributes="0"/> </Group> </Group> <Group type="102" alignment="0" attributes="0"> @@ -40,8 +40,8 @@ </Group> <EmptySpace type="unrelated" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="ampMapComboBox" alignment="0" pref="132" max="32767" attributes="0"/> - <Component id="ampConstantText" alignment="0" pref="132" max="32767" attributes="0"/> + <Component id="ampMapComboBox" alignment="0" pref="135" max="32767" attributes="0"/> + <Component id="ampConstantText" alignment="0" pref="135" max="32767" attributes="0"/> </Group> </Group> </Group> Modified: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java 2010-04-08 03:46:17 UTC (rev 4203) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java 2010-04-08 03:48:45 UTC (rev 4204) @@ -23,7 +23,6 @@ * * Created on Apr 4, 2010, 6:15:34 PM */ - package blue.ui.core.midi; import blue.event.SimpleDocumentListener; @@ -40,13 +39,16 @@ * @author syi */ public class MidiInputProcessorPanel extends javax.swing.JPanel { + private MidiInputProcessor processor; /** Creates new form MidiInputProcessorPanel */ public MidiInputProcessorPanel() { initComponents(); - keyMapComboBox.setModel(new DefaultComboBoxModel(MidiKeyMapping.values())); - ampMapComboBox.setModel(new DefaultComboBoxModel(MidiVelocityMapping.values())); + keyMapComboBox.setModel( + new DefaultComboBoxModel(MidiKeyMapping.values())); + ampMapComboBox.setModel(new DefaultComboBoxModel(MidiVelocityMapping. + values())); keyConstantText.getDocument().addDocumentListener(new SimpleDocumentListener() { @@ -148,7 +150,7 @@ .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE) + .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE) .add(layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel2) @@ -156,17 +158,17 @@ .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(keyMapComboBox, 0, 132, Short.MAX_VALUE) - .add(keyConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE) - .add(scaleSelectionPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE))) + .add(keyMapComboBox, 0, 135, Short.MAX_VALUE) + .add(keyConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE) + .add(scaleSelectionPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE))) .add(layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel4) .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 61, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(ampMapComboBox, 0, 132, Short.MAX_VALUE) - .add(ampConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE)))) + .add(ampMapComboBox, 0, 135, Short.MAX_VALUE) + .add(ampConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)))) .addContainerGap()) ); layout.setVerticalGroup( @@ -200,17 +202,17 @@ private void keyMapComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keyMapComboBoxActionPerformed if (this.processor != null) { - processor.setKeyMapping((MidiKeyMapping) keyMapComboBox.getSelectedItem()); + processor.setKeyMapping((MidiKeyMapping) keyMapComboBox. + getSelectedItem()); } }//GEN-LAST:event_keyMapComboBoxActionPerformed private void ampMapComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ampMapComboBoxActionPerformed if (this.processor != null) { - processor.setVelMapping((MidiVelocityMapping) ampMapComboBox.getSelectedItem()); + processor.setVelMapping((MidiVelocityMapping) ampMapComboBox. + getSelectedItem()); } }//GEN-LAST:event_ampMapComboBoxActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField ampConstantText; private javax.swing.JComboBox ampMapComboBox; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-08 03:46:24
|
Revision: 4203 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4203&view=rev Author: kunstmusik Date: 2010-04-08 03:46:17 +0000 (Thu, 08 Apr 2010) Log Message: ----------- fixed to update display of Scale name when Scale set Modified Paths: -------------- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java Modified: blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java 2010-04-07 03:00:13 UTC (rev 4202) +++ blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java 2010-04-08 03:46:17 UTC (rev 4203) @@ -108,6 +108,7 @@ public void setScale(Scale scale) { this.scale = scale; + updateDisplay(); } public Scale getScale() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-07 03:00:19
|
Revision: 4202 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4202&view=rev Author: kunstmusik Date: 2010-04-07 03:00:13 +0000 (Wed, 07 Apr 2010) Log Message: ----------- added Scale selection for MidiInputProcessor Modified Paths: -------------- blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java Modified: blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java =================================================================== --- blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-07 02:59:43 UTC (rev 4201) +++ blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-07 03:00:13 UTC (rev 4202) @@ -40,15 +40,15 @@ private MidiVelocityMapping velMapping = MidiVelocityMapping.MIDI; - Scale scale = Scale.get12TET(); + private Scale scale = Scale.get12TET(); - String pitchConstant = ""; + private String pitchConstant = ""; - String ampConstant = ""; + private String ampConstant = ""; - double ampMin = 0.0; + private double ampMin = 0.0; - double ampMax = 1.0; + private double ampMax = 1.0; public String getAmpConstant() { return ampConstant; @@ -82,6 +82,14 @@ this.pitchConstant = pitchConstant; } + public Scale getScale() { + return scale; + } + + public void setScale(Scale scale) { + this.scale = scale; + } + public String getNoteOn(String id, int noteNum, int key, int velocity) { return NOTE_FORMAT.format(new Object[] { id, noteNum, processKey(key), processVelocity( velocity)}); Modified: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form 2010-04-07 02:59:43 UTC (rev 4201) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form 2010-04-07 03:00:13 UTC (rev 4202) @@ -19,17 +19,18 @@ <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jSeparator1" alignment="0" pref="192" max="32767" attributes="0"/> + <Component id="jSeparator1" alignment="0" pref="203" max="32767" attributes="0"/> <Group type="102" alignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0"> <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" min="-2" pref="31" max="-2" attributes="0"/> - <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace type="unrelated" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="keyMapComboBox" alignment="0" pref="121" max="32767" attributes="0"/> - <Component id="keyConstantText" alignment="0" pref="121" max="32767" attributes="0"/> + <Component id="keyMapComboBox" alignment="0" pref="132" max="32767" attributes="0"/> + <Component id="keyConstantText" alignment="0" pref="132" max="32767" attributes="0"/> + <Component id="scaleSelectionPanel1" alignment="0" pref="132" max="32767" attributes="0"/> </Group> </Group> <Group type="102" alignment="0" attributes="0"> @@ -39,8 +40,8 @@ </Group> <EmptySpace type="unrelated" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Component id="ampMapComboBox" alignment="0" pref="121" max="32767" attributes="0"/> - <Component id="ampConstantText" alignment="0" pref="121" max="32767" attributes="0"/> + <Component id="ampMapComboBox" alignment="0" pref="132" max="32767" attributes="0"/> + <Component id="ampConstantText" alignment="0" pref="132" max="32767" attributes="0"/> </Group> </Group> </Group> @@ -56,9 +57,12 @@ <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="keyMapComboBox" alignment="3" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jLabel1" min="-2" max="-2" attributes="1"/> <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="jLabel1" max="32767" attributes="1"/> + <Component id="scaleSelectionPanel1" alignment="1" max="32767" attributes="1"/> + </Group> + <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="keyConstantText" alignment="3" min="-2" max="-2" attributes="0"/> @@ -162,5 +166,7 @@ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ampMapComboBoxActionPerformed"/> </Events> </Component> + <Component class="blue.soundObject.editor.pianoRoll.ScaleSelectionPanel" name="scaleSelectionPanel1"> + </Component> </SubComponents> </Form> Modified: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java 2010-04-07 02:59:43 UTC (rev 4201) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java 2010-04-07 03:00:13 UTC (rev 4202) @@ -31,6 +31,8 @@ import blue.midi.MidiKeyMapping; import blue.midi.MidiVelocityMapping; import javax.swing.DefaultComboBoxModel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; /** @@ -65,6 +67,15 @@ } } }); + + scaleSelectionPanel1.addChangeListener(new ChangeListener() { + + public void stateChanged(ChangeEvent e) { + if (processor != null) { + processor.setScale(scaleSelectionPanel1.getScale()); + } + } + }); } public void setMidiInputProcessor(MidiInputProcessor processor) { @@ -76,6 +87,8 @@ keyMapComboBox.setSelectedItem(processor.getKeyMapping()); ampMapComboBox.setSelectedItem(processor.getVelMapping()); + scaleSelectionPanel1.setScale(processor.getScale()); + this.processor = processor; } @@ -98,6 +111,7 @@ jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); ampMapComboBox = new javax.swing.JComboBox(); + scaleSelectionPanel1 = new blue.soundObject.editor.pianoRoll.ScaleSelectionPanel(); jLabel1.setText(org.openide.util.NbBundle.getMessage(MidiInputProcessorPanel.class, "MidiInputProcessorPanel.jLabel1.text")); // NOI18N @@ -134,24 +148,25 @@ .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE) + .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE) .add(layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel2) - .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(jLabel3)) + .add(jLabel3) + .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(keyMapComboBox, 0, 121, Short.MAX_VALUE) - .add(keyConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE))) + .add(keyMapComboBox, 0, 132, Short.MAX_VALUE) + .add(keyConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE) + .add(scaleSelectionPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE))) .add(layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jLabel4) .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 61, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(ampMapComboBox, 0, 121, Short.MAX_VALUE) - .add(ampConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)))) + .add(ampMapComboBox, 0, 132, Short.MAX_VALUE) + .add(ampConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE)))) .addContainerGap()) ); layout.setVerticalGroup( @@ -161,9 +176,11 @@ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel2) .add(keyMapComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) - .add(jLabel1) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) + .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(scaleSelectionPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(jLabel3) .add(keyConstantText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) @@ -205,6 +222,7 @@ private javax.swing.JSeparator jSeparator1; private javax.swing.JTextField keyConstantText; private javax.swing.JComboBox keyMapComboBox; + private blue.soundObject.editor.pianoRoll.ScaleSelectionPanel scaleSelectionPanel1; // End of variables declaration//GEN-END:variables } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-07 02:59:49
|
Revision: 4201 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4201&view=rev Author: kunstmusik Date: 2010-04-07 02:59:43 +0000 (Wed, 07 Apr 2010) Log Message: ----------- made getTET always return new scale in to prevent issues with shared scale have base freq changed Modified Paths: -------------- blue/trunk/blue-core/src/blue/soundObject/pianoRoll/Scale.java Modified: blue/trunk/blue-core/src/blue/soundObject/pianoRoll/Scale.java =================================================================== --- blue/trunk/blue-core/src/blue/soundObject/pianoRoll/Scale.java 2010-04-07 02:48:51 UTC (rev 4200) +++ blue/trunk/blue-core/src/blue/soundObject/pianoRoll/Scale.java 2010-04-07 02:59:43 UTC (rev 4201) @@ -37,21 +37,7 @@ */ public class Scale implements Serializable { - private static Scale TWELVE_TET; - static { - TWELVE_TET = new Scale(); - - TWELVE_TET.scaleName = "12TET"; - TWELVE_TET.ratios = new float[12]; - - double ratio = Math.pow(2.0, 1.0 / 12.0); - - for (int i = 0; i < TWELVE_TET.ratios.length; i++) { - TWELVE_TET.ratios[i] = (float) Math.pow(ratio, i); - } - } - private String scaleName = ""; private float[] ratios; @@ -128,7 +114,18 @@ } public static Scale get12TET() { - return TWELVE_TET; + Scale retrVal = new Scale(); + + retrVal.scaleName = "12TET"; + retrVal.ratios = new float[12]; + + double ratio = Math.pow(2.0, 1.0 / 12.0); + + for (int i = 0; i < retrVal.ratios.length; i++) { + retrVal.ratios[i] = (float) Math.pow(ratio, i); + } + + return retrVal; } private static float getMultiplier(String lineInput) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-07 02:48:57
|
Revision: 4200 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4200&view=rev Author: kunstmusik Date: 2010-04-07 02:48:51 +0000 (Wed, 07 Apr 2010) Log Message: ----------- made scale selection panel not have a dependency on PianoRoll so that it can be used by other parts of application Modified Paths: -------------- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollPropertiesEditor.java blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java Modified: blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollPropertiesEditor.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollPropertiesEditor.java 2010-04-07 02:42:46 UTC (rev 4199) +++ blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollPropertiesEditor.java 2010-04-07 02:48:51 UTC (rev 4200) @@ -223,6 +223,15 @@ this.setViewportView(mainPanel); this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); this.setBorder(null); + + scalePanel.addChangeListener(new ChangeListener() { + + public void stateChanged(ChangeEvent e) { + if (p != null) { + p.setScale(scalePanel.getScale()); + } + } + }); } /** @@ -294,7 +303,7 @@ instrumentIDText.setText(p.getInstrumentId()); baseFrequencyText.setText(Float.toString(p.getScale() .getBaseFrequency())); - scalePanel.editPianoRoll(p); + scalePanel.setScale(p.getScale()); if (p.getPchGenerationMethod() == PianoRoll.GENERATE_FREQUENCY) { frequencyOption.setSelected(true); Modified: blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java 2010-04-07 02:42:46 UTC (rev 4199) +++ blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/ScaleSelectionPanel.java 2010-04-07 02:48:51 UTC (rev 4200) @@ -30,24 +30,24 @@ import javax.swing.JTextField; import blue.BlueSystem; -import blue.soundObject.PianoRoll; import blue.soundObject.pianoRoll.Scale; import blue.ui.utilities.FileChooserManager; +import java.util.Vector; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; -/** - * @author steven - * - * TODO To change the template for this generated type comment go to Window - - * Preferences - Java - Code Style - Code Templates - */ public class ScaleSelectionPanel extends JComponent { public static String FILE_CHOOSER_ID = "scaleSelectionPanel"; JTextField fileNameField = new JTextField(); - PianoRoll p = null; + Scale scale = null; + Vector<ChangeListener> changeListeners = null; + + ChangeEvent c = null; + public ScaleSelectionPanel() { this.setLayout(new BorderLayout()); @@ -58,28 +58,24 @@ public void actionPerformed(ActionEvent e) { - int rValue = FileChooserManager.getDefault().showOpenDialog(FILE_CHOOSER_ID, + int rValue = FileChooserManager.getDefault().showOpenDialog( + FILE_CHOOSER_ID, null); if (rValue == JFileChooser.APPROVE_OPTION) { - File f = FileChooserManager.getDefault() - .getSelectedFile(FILE_CHOOSER_ID); + File f = FileChooserManager.getDefault().getSelectedFile( + FILE_CHOOSER_ID); if (!f.exists()) { return; } - Scale scale = Scale.loadScale(f); + scale = Scale.loadScale(f); - // TODO - clear notes if new scale - - p.setScale(scale); - updateDisplay(); - + fireChangeEvent(); } } - }); fileNameField.setEditable(false); @@ -95,8 +91,8 @@ return; } - fcm.setDialogTitle(FILE_CHOOSER_ID, BlueSystem - .getString("pianoRoll.selectScalaFile")); + fcm.setDialogTitle(FILE_CHOOSER_ID, BlueSystem.getString( + "pianoRoll.selectScalaFile")); fcm.addFilter(FILE_CHOOSER_ID, new ScalaFileFilter()); // SET DEFAULT DIR @@ -110,13 +106,48 @@ } } - public void editPianoRoll(PianoRoll p) { - this.p = p; - updateDisplay(); + public void setScale(Scale scale) { + this.scale = scale; } + public Scale getScale() { + return this.scale; + } + private void updateDisplay() { - fileNameField.setText(p.getScale().getScaleName()); + if (scale == null) { + fileNameField.setText(""); + } else { + fileNameField.setText(scale.getScaleName()); + } } + // change listener methods + public void addChangeListener(ChangeListener cl) { + if (changeListeners == null) { + changeListeners = new Vector<ChangeListener>(); + } + changeListeners.add(cl); + } + + public void removeChangeListener(ChangeListener cl) { + if (changeListeners != null) { + changeListeners.remove(cl); + } + } + + protected void fireChangeEvent() { + + if (changeListeners == null) { + return; + } + + if (c == null) { + c = new ChangeEvent(this); + } + + for (ChangeListener cl : changeListeners) { + cl.stateChanged(c); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-07 02:42:52
|
Revision: 4199 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4199&view=rev Author: kunstmusik Date: 2010-04-07 02:42:46 +0000 (Wed, 07 Apr 2010) Log Message: ----------- implemented OCT handling Modified Paths: -------------- blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java Modified: blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java =================================================================== --- blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-05 00:31:52 UTC (rev 4198) +++ blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-07 02:42:46 UTC (rev 4199) @@ -20,6 +20,8 @@ package blue.midi; import blue.soundObject.pianoRoll.Scale; +import blue.utility.NumberUtilities; +import java.math.BigDecimal; import java.text.MessageFormat; /** @@ -100,12 +102,14 @@ retVal = convertPch(key); break; case OCT: + retVal = convertOct(key); break; case CONSTANT: retVal = pitchConstant; case TUNING_CPS: break; case TUNING_BLUE_PCH: + break; } @@ -119,6 +123,10 @@ return PCH_FORMAT.format(new Object[]{oct, key < 10 ? "0" + key : key}); } + protected String convertOct(int midiKey) { + return NumberUtilities.formatDouble((midiKey / 12.0) + 3.0); + } + protected String processVelocity(int key) { String retVal = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-05 00:31:59
|
Revision: 4198 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4198&view=rev Author: kunstmusik Date: 2010-04-05 00:31:52 +0000 (Mon, 05 Apr 2010) Log Message: ----------- initial working Midi Input System Modified Paths: -------------- blue/trunk/blue-core/src/blue/BlueData.java blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java blue/trunk/blue-ui-core/src/blue/ui/core/Installer.java blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java Added Paths: ----------- blue/trunk/blue-core/src/blue/midi/ blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java blue/trunk/blue-core/src/blue/midi/MidiKeyMapping.java blue/trunk/blue-core/src/blue/midi/MidiVelocityMapping.java blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputEngine.java blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java Modified: blue/trunk/blue-core/src/blue/BlueData.java =================================================================== --- blue/trunk/blue-core/src/blue/BlueData.java 2010-04-05 00:27:43 UTC (rev 4197) +++ blue/trunk/blue-core/src/blue/BlueData.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -27,7 +27,6 @@ import java.io.Serializable; import java.io.StringReader; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; @@ -37,6 +36,7 @@ import Silence.XMLSerializer; import blue.blueLive.LiveObject; import blue.ftable.FTableSet; +import blue.midi.MidiInputProcessor; import blue.mixer.Mixer; import blue.noteProcessor.NoteProcessorChainMap; import blue.orchestra.Instrument; @@ -117,6 +117,8 @@ private String commandLine; + private MidiInputProcessor midiInputProcessor; + // refactored out to GlobalOrcSco, left in for compatibilty (ver 0.89.5) private String globalScore; @@ -157,6 +159,8 @@ liveData = new LiveData(); tempo = new Tempo(); + + midiInputProcessor = new MidiInputProcessor(); } public PolyObject getPolyObject() { @@ -703,4 +707,8 @@ public void setTempo(Tempo tempo) { this.tempo = tempo; } + + public MidiInputProcessor getMidiInputProcessor() { + return midiInputProcessor; + } } \ No newline at end of file Added: blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java =================================================================== --- blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java (rev 0) +++ blue/trunk/blue-core/src/blue/midi/MidiInputProcessor.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -0,0 +1,156 @@ +/* + * blue - object composition environment for csound Copyright (c) 2000-2009 + * Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to the Free + * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 + * USA + */ +package blue.midi; + +import blue.soundObject.pianoRoll.Scale; +import java.text.MessageFormat; + +/** + * + * @author syi + */ +public class MidiInputProcessor { + + private static final MessageFormat PCH_FORMAT = new MessageFormat("{0}.{1}"); + + private static final MessageFormat NOTE_FORMAT = new MessageFormat("i{0}.{1} 0 -1 {2} {3}"); + + private static final MessageFormat NOTE_OFF_FORMAT = new MessageFormat("i-{0}.{1} 0 0"); + + private MidiKeyMapping keyMapping = MidiKeyMapping.PCH; + + private MidiVelocityMapping velMapping = MidiVelocityMapping.MIDI; + + Scale scale = Scale.get12TET(); + + String pitchConstant = ""; + + String ampConstant = ""; + + double ampMin = 0.0; + + double ampMax = 1.0; + + public String getAmpConstant() { + return ampConstant; + } + + public void setAmpConstant(String ampConstant) { + this.ampConstant = ampConstant; + } + + public double getAmpMax() { + return ampMax; + } + + public void setAmpMax(double ampMax) { + this.ampMax = ampMax; + } + + public double getAmpMin() { + return ampMin; + } + + public void setAmpMin(double ampMin) { + this.ampMin = ampMin; + } + + public String getPitchConstant() { + return pitchConstant; + } + + public void setPitchConstant(String pitchConstant) { + this.pitchConstant = pitchConstant; + } + + public String getNoteOn(String id, int noteNum, int key, int velocity) { + return NOTE_FORMAT.format(new Object[] { id, noteNum, processKey(key), processVelocity( + velocity)}); + } + + public String getNoteOff(String id, int noteNum) { + return NOTE_OFF_FORMAT.format(new Object[] { id, noteNum}); + } + + protected String processKey(int key) { + String retVal = null; + + switch(keyMapping) { + case MIDI: + retVal = Integer.toString(key); + break; + case PCH: + retVal = convertPch(key); + break; + case OCT: + break; + case CONSTANT: + retVal = pitchConstant; + case TUNING_CPS: + break; + case TUNING_BLUE_PCH: + break; + } + + return retVal; + } + + protected String convertPch(int midiKey) { + int oct = midiKey / 12 + 3; + int key = midiKey % 12; + + return PCH_FORMAT.format(new Object[]{oct, key < 10 ? "0" + key : key}); + } + + protected String processVelocity(int key) { + String retVal = null; + + switch (velMapping) { + case MIDI: + retVal = Integer.toString(key); + break; + case CONSTANT: + retVal = ampConstant; + break; + case AMP: + retVal = Double.toString(((key * key) / 16239.0) * 30000); + break; + } + + return retVal; + } + + public MidiKeyMapping getKeyMapping() { + return keyMapping; + } + + public void setKeyMapping(MidiKeyMapping keyMapping) { + this.keyMapping = keyMapping; + } + + public MidiVelocityMapping getVelMapping() { + return velMapping; + } + + public void setVelMapping(MidiVelocityMapping velMapping) { + this.velMapping = velMapping; + } + +} Added: blue/trunk/blue-core/src/blue/midi/MidiKeyMapping.java =================================================================== --- blue/trunk/blue-core/src/blue/midi/MidiKeyMapping.java (rev 0) +++ blue/trunk/blue-core/src/blue/midi/MidiKeyMapping.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -0,0 +1,48 @@ +/* + * blue - object composition environment for csound Copyright (c) 2000-2009 + * Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to the Free + * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 + * USA + */ +package blue.midi; + +/** + * + * @author syi + */ +public enum MidiKeyMapping { + + MIDI, PCH, OCT, CONSTANT, TUNING_BLUE_PCH, TUNING_CPS; + + @Override + public String toString() { + switch (this) { + case MIDI: + return "MIDI"; + case PCH: + return "Csound PCH"; + case OCT: + return "Csound OCT"; + case CONSTANT: + return "Constant"; + case TUNING_BLUE_PCH: + return "Tuning - bluePCH"; + case TUNING_CPS: + return "Tuning - CPS"; + } + return null; + } +} Added: blue/trunk/blue-core/src/blue/midi/MidiVelocityMapping.java =================================================================== --- blue/trunk/blue-core/src/blue/midi/MidiVelocityMapping.java (rev 0) +++ blue/trunk/blue-core/src/blue/midi/MidiVelocityMapping.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -0,0 +1,42 @@ +/* + * blue - object composition environment for csound Copyright (c) 2000-2009 + * Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to the Free + * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 + * USA + */ + +package blue.midi; + +/** + * + * @author syi + */ +public enum MidiVelocityMapping { + MIDI, AMP, CONSTANT; + + @Override + public String toString() { + switch(this) { + case MIDI: + return "MIDI"; + case AMP: + return "Amp"; + case CONSTANT: + return "Constant"; + } + return null; + } +} Modified: blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java 2010-04-05 00:27:43 UTC (rev 4197) +++ blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -63,12 +63,13 @@ try { input = MidiSystem.getMidiDevice(info); input.open(); + cl.stateChanged(e); } catch (MidiUnavailableException ex) { input = null; throw ex; + } catch (IllegalArgumentException ex) { + input = null; } - - cl.stateChanged(e); } public boolean isOpen() { Modified: blue/trunk/blue-ui-core/src/blue/ui/core/Installer.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/Installer.java 2010-04-05 00:27:43 UTC (rev 4197) +++ blue/trunk/blue-ui-core/src/blue/ui/core/Installer.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -22,18 +22,17 @@ import blue.BlueConstants; import blue.BluePlugin; import blue.BluePluginFactory; -import blue.BluePluginManager; import blue.BlueSystem; import blue.MainToolBar; import blue.WindowSettingManager; import blue.automation.ParameterTimeManagerFactory; import blue.automation.ParameterTimeManagerImpl; +import blue.midi.MidiInputManager; import blue.orchestra.BlueSynthBuilder; import blue.orchestra.BlueX7; import blue.orchestra.editor.InstrumentEditor; import blue.projects.BlueProject; import blue.projects.BlueProjectManager; -import blue.scripting.PythonProxy; import blue.settings.TextColorsSettings; import blue.soundObject.*; import blue.soundObject.editor.AudioFileEditor; @@ -53,6 +52,7 @@ import blue.soundObject.editor.SoundObjectEditor; import blue.soundObject.editor.TrackerEditor; import blue.soundObject.editor.ZakLineEditor; +import blue.ui.core.midi.MidiInputEngine; import blue.ui.core.orchestra.editor.BlueSynthBuilderEditor; import blue.ui.core.orchestra.editor.BlueX7Editor; import blue.ui.core.soundObject.renderer.AbstractLineObjectRenderer; @@ -72,8 +72,6 @@ import java.awt.Color; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import org.netbeans.api.progress.ProgressHandle; -import org.netbeans.api.progress.ProgressHandleFactory; import org.openide.modules.ModuleInstall; import org.openide.windows.WindowManager; import org.syntax.jedit.SyntaxStyle; @@ -144,6 +142,8 @@ // }.start(); // } // }); + + MidiInputManager.getInstance().addReceiver(MidiInputEngine.getInstance()); } private void setWindowTitle() { Modified: blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties 2010-04-05 00:27:43 UTC (rev 4197) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties 2010-04-05 00:31:52 UTC (rev 4198) @@ -1,6 +1,11 @@ CTL_MidiInputPanelAction=MidiInputPanel CTL_MidiInputPanelTopComponent=MidiInputPanel Window HINT_MidiInputPanelTopComponent=This is a MidiInputPanel window -MidiInputPanelTopComponent.jRadioButton1.text=Instrument -MidiInputPanelTopComponent.jRadioButton2.text=Custom Note Template -MidiInputPanelTopComponent.jTextField1.text=jTextField1 +MidiInputProcessorPanel.jLabel1.text=Scale +MidiInputProcessorPanel.jLabel2.text=Key Mapping +MidiInputProcessorPanel.jLabel3.text=Constant +MidiInputProcessorPanel.jLabel5.text=Vel Mapping +MidiInputProcessorPanel.jLabel4.text=Constant +MidiInputProcessorPanel.ampConstantText.text=jTextField1 +MidiInputProcessorPanel.keyConstantText.text=jTextField1 +MidiInputPanelTopComponent.midiInputProcessorPanel1.TabConstraints.tabTitle=Realtime Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputEngine.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputEngine.java (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputEngine.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -0,0 +1,124 @@ +/* + * blue - object composition environment for csound Copyright (c) 2000-2010 + * Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to the Free + * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 + * USA + */ +package blue.ui.core.midi; + +import blue.BlueData; +import blue.InstrumentAssignment; +import blue.midi.MidiInputProcessor; +import blue.projects.BlueProject; +import blue.projects.BlueProjectManager; +import blue.ui.core.blueLive.BlueLiveToolBar; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import javax.sound.midi.MidiMessage; +import javax.sound.midi.Receiver; +import javax.sound.midi.ShortMessage; + +/** + * + * @author syi + */ +public final class MidiInputEngine implements Receiver { + + private static MidiInputEngine instance = new MidiInputEngine(); + + private static BlueLiveToolBar toolbar; + + private ArrayList<InstrumentAssignment> arrangement; + + private MidiInputProcessor processor = null; + + public static MidiInputEngine getInstance() { + if (toolbar == null) { + toolbar = BlueLiveToolBar.getInstance(); + } + return instance; + } + + + private MidiInputEngine() { + BlueProjectManager.getInstance().addPropertyChangeListener(new PropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent evt) { + if (BlueProjectManager.CURRENT_PROJECT.equals(evt. + getPropertyName())) { + reinitialize(); + } + } + }); + } + + protected void reinitialize() { + BlueProject project = BlueProjectManager.getInstance().getCurrentProject(); + BlueData data = null; + if (project != null) { + data = project.getData(); + arrangement = data.getArrangement().getArrangement(); + processor = data.getMidiInputProcessor(); + } + } + + public void send(MidiMessage message, long timeStamp) { + + if (message instanceof ShortMessage) { + + ShortMessage shortMsg = (ShortMessage) message; + int channel = shortMsg.getChannel(); + int noteNum = shortMsg.getData1(); + int velocity = shortMsg.getData2(); + + if(processor == null || arrangement == null || channel >= arrangement.size()) { + return; + } + + String id = arrangement.get(channel).arrangementId; + + String score = "i"; + + switch (shortMsg.getCommand()) { + case ShortMessage.NOTE_ON: + if (velocity > 0) { + score = processor.getNoteOn(id, noteNum, noteNum, + velocity); + } else { + score = processor.getNoteOff(id, noteNum); + } + + break; + case ShortMessage.NOTE_OFF: +// noteNum = shortMsg.getData1(); +// velocity = shortMsg.getData2(); + + score = processor.getNoteOff(id, noteNum); + + break; + } + + System.err.println(score); + toolbar.sendEvents(score); + } + + } + + public void close() { + throw new UnsupportedOperationException("Not supported yet."); + } +} Modified: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form 2010-04-05 00:27:43 UTC (rev 4197) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form 2010-04-05 00:31:52 UTC (rev 4198) @@ -16,93 +16,32 @@ <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jComboBox2" alignment="0" pref="194" max="32767" attributes="0"/> - <Component id="jRadioButton1" min="-2" max="-2" attributes="0"/> - <Component id="jRadioButton2" alignment="0" min="-2" max="-2" attributes="0"/> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="21" pref="21" max="-2" attributes="0"/> - <Group type="103" groupAlignment="1" max="-2" attributes="0"> - <Component id="jTextField1" max="32767" attributes="0"/> - <Component id="jComboBox1" alignment="1" min="-2" pref="173" max="-2" attributes="1"/> - </Group> - </Group> - </Group> - <EmptySpace max="-2" attributes="0"/> - </Group> + <Component id="jTabbedPane1" alignment="0" pref="282" max="32767" attributes="0"/> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jComboBox2" min="-2" max="-2" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jRadioButton1" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jComboBox1" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jRadioButton2" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jTextField1" min="-2" max="-2" attributes="0"/> - <EmptySpace pref="166" max="32767" attributes="0"/> - </Group> + <Component id="jTabbedPane1" alignment="0" max="32767" attributes="0"/> </Group> </DimensionLayout> </Layout> <SubComponents> - <Component class="javax.swing.JRadioButton" name="jRadioButton1"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jRadioButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JRadioButton" name="jRadioButton2"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jRadioButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButton2ActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JComboBox" name="jComboBox1"> - <Properties> - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> - <StringArray count="4"> - <StringItem index="0" value="Item 1"/> - <StringItem index="1" value="Item 2"/> - <StringItem index="2" value="Item 3"/> - <StringItem index="3" value="Item 4"/> - </StringArray> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="jTextField1"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jTextField1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JComboBox" name="jComboBox2"> - <Properties> - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> - <StringArray count="4"> - <StringItem index="0" value="Item 1"/> - <StringItem index="1" value="Item 2"/> - <StringItem index="2" value="Item 3"/> - <StringItem index="3" value="Item 4"/> - </StringArray> - </Property> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox2ActionPerformed"/> - </Events> - </Component> + <Container class="javax.swing.JTabbedPane" name="jTabbedPane1"> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/> + <SubComponents> + <Component class="blue.ui.core.midi.MidiInputProcessorPanel" name="midiInputProcessorPanel1"> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> + <JTabbedPaneConstraints tabName="Realtime"> + <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.midiInputProcessorPanel1.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </JTabbedPaneConstraints> + </Constraint> + </Constraints> + </Component> + </SubComponents> + </Container> </SubComponents> </Form> Modified: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java 2010-04-05 00:27:43 UTC (rev 4197) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -4,6 +4,11 @@ */ package blue.ui.core.midi; +import blue.BlueData; +import blue.projects.BlueProject; +import blue.projects.BlueProjectManager; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.logging.Logger; import org.openide.util.NbBundle; import org.openide.windows.TopComponent; @@ -26,12 +31,37 @@ public MidiInputPanelTopComponent() { initComponents(); - setName(NbBundle.getMessage(MidiInputPanelTopComponent.class, "CTL_MidiInputPanelTopComponent")); - setToolTipText(NbBundle.getMessage(MidiInputPanelTopComponent.class, "HINT_MidiInputPanelTopComponent")); + setName(NbBundle.getMessage(MidiInputPanelTopComponent.class, + "CTL_MidiInputPanelTopComponent")); + setToolTipText(NbBundle.getMessage(MidiInputPanelTopComponent.class, + "HINT_MidiInputPanelTopComponent")); // setIcon(ImageUtilities.loadImage(ICON_PATH, true)); + BlueProjectManager.getInstance().addPropertyChangeListener(new PropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent evt) { + if (BlueProjectManager.CURRENT_PROJECT.equals(evt. + getPropertyName())) { + reinitialize(); + } + } + }); + + reinitialize(); } + protected void reinitialize() { + BlueProject project = BlueProjectManager.getInstance(). + getCurrentProject(); + BlueData data = null; + if (project != null) { + data = project.getData(); + + midiInputProcessorPanel1.setMidiInputProcessor(data. + getMidiInputProcessor()); + } + } + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is @@ -40,81 +70,27 @@ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { - jRadioButton1 = new javax.swing.JRadioButton(); - jRadioButton2 = new javax.swing.JRadioButton(); - jComboBox1 = new javax.swing.JComboBox(); - jTextField1 = new javax.swing.JTextField(); - jComboBox2 = new javax.swing.JComboBox(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + midiInputProcessorPanel1 = new blue.ui.core.midi.MidiInputProcessorPanel(); - org.openide.awt.Mnemonics.setLocalizedText(jRadioButton1, org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jRadioButton1.text")); // NOI18N + jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.midiInputProcessorPanel1.TabConstraints.tabTitle"), midiInputProcessorPanel1); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(jRadioButton2, org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jRadioButton2.text")); // NOI18N - jRadioButton2.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jRadioButton2ActionPerformed(evt); - } - }); - - jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - - jTextField1.setText(org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jTextField1.text")); // NOI18N - - jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - jComboBox2.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jComboBox2ActionPerformed(evt); - } - }); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jComboBox2, 0, 194, Short.MAX_VALUE) - .addComponent(jRadioButton1) - .addComponent(jRadioButton2) - .addGroup(layout.createSequentialGroup() - .addGap(21, 21, 21) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(jTextField1) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)))) - .addContainerGap()) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 282, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jRadioButton1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jRadioButton2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(166, Short.MAX_VALUE)) + .addComponent(jTabbedPane1) ); }// </editor-fold>//GEN-END:initComponents - - private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_jRadioButton2ActionPerformed - - private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_jComboBox2ActionPerformed - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JComboBox jComboBox1; - private javax.swing.JComboBox jComboBox2; - private javax.swing.JRadioButton jRadioButton1; - private javax.swing.JRadioButton jRadioButton2; - private javax.swing.JTextField jTextField1; + private javax.swing.JTabbedPane jTabbedPane1; + private blue.ui.core.midi.MidiInputProcessorPanel midiInputProcessorPanel1; // End of variables declaration//GEN-END:variables + /** * Gets default instance. Do not use directly: reserved for *.settings files only, * i.e. deserialization routines; otherwise you could get a non-deserialized instance. @@ -131,7 +107,8 @@ * Obtain the MidiInputPanelTopComponent instance. Never call {@link #getDefault} directly! */ public static synchronized MidiInputPanelTopComponent findInstance() { - TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); + TopComponent win = WindowManager.getDefault().findTopComponent( + PREFERRED_ID); if (win == null) { Logger.getLogger(MidiInputPanelTopComponent.class.getName()).warning( "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system."); Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.form 2010-04-05 00:31:52 UTC (rev 4198) @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jSeparator1" alignment="0" pref="192" max="32767" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" pref="31" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="keyMapComboBox" alignment="0" pref="121" max="32767" attributes="0"/> + <Component id="keyConstantText" alignment="0" pref="121" max="32767" attributes="0"/> + </Group> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel4" min="-2" max="-2" attributes="0"/> + <Component id="jLabel5" min="-2" pref="61" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="ampMapComboBox" alignment="0" pref="121" max="32767" attributes="0"/> + <Component id="ampConstantText" alignment="0" pref="121" max="32767" attributes="0"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="keyMapComboBox" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" max="-2" attributes="1"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="keyConstantText" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Component id="jSeparator1" min="-2" pref="10" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="ampMapComboBox" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="ampConstantText" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="180" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputProcessorPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputProcessorPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="keyMapComboBox"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="keyMapComboBoxActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputProcessorPanel.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="keyConstantText"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputProcessorPanel.keyConstantText.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JSeparator" name="jSeparator1"> + </Component> + <Component class="javax.swing.JTextField" name="ampConstantText"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputProcessorPanel.ampConstantText.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel4"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputProcessorPanel.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel5"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputProcessorPanel.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="ampMapComboBox"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ampMapComboBoxActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputProcessorPanel.java 2010-04-05 00:31:52 UTC (rev 4198) @@ -0,0 +1,210 @@ +/* + * blue - object composition environment for csound Copyright (c) 2000-2009 + * Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to the Free + * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 + * USA + */ + +/* + * MidiInputProcessorPanel.java + * + * Created on Apr 4, 2010, 6:15:34 PM + */ + +package blue.ui.core.midi; + +import blue.event.SimpleDocumentListener; +import blue.midi.MidiInputProcessor; +import blue.midi.MidiKeyMapping; +import blue.midi.MidiVelocityMapping; +import javax.swing.DefaultComboBoxModel; +import javax.swing.event.DocumentEvent; + +/** + * + * @author syi + */ +public class MidiInputProcessorPanel extends javax.swing.JPanel { + private MidiInputProcessor processor; + + /** Creates new form MidiInputProcessorPanel */ + public MidiInputProcessorPanel() { + initComponents(); + keyMapComboBox.setModel(new DefaultComboBoxModel(MidiKeyMapping.values())); + ampMapComboBox.setModel(new DefaultComboBoxModel(MidiVelocityMapping.values())); + + keyConstantText.getDocument().addDocumentListener(new SimpleDocumentListener() { + + @Override + public void documentChanged(DocumentEvent e) { + if (processor != null) { + processor.setPitchConstant(keyConstantText.getText()); + } + } + }); + + ampConstantText.getDocument().addDocumentListener(new SimpleDocumentListener() { + + @Override + public void documentChanged(DocumentEvent e) { + if (processor != null) { + processor.setAmpConstant(ampConstantText.getText()); + } + } + }); + } + + public void setMidiInputProcessor(MidiInputProcessor processor) { + this.processor = null; + + keyConstantText.setText(processor.getPitchConstant()); + ampConstantText.setText(processor.getAmpConstant()); + + keyMapComboBox.setSelectedItem(processor.getKeyMapping()); + ampMapComboBox.setSelectedItem(processor.getVelMapping()); + + this.processor = processor; + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + keyMapComboBox = new javax.swing.JComboBox(); + jLabel3 = new javax.swing.JLabel(); + keyConstantText = new javax.swing.JTextField(); + jSeparator1 = new javax.swing.JSeparator(); + ampConstantText = new javax.swing.JTextField(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + ampMapComboBox = new javax.swing.JComboBox(); + + jLabel1.setText(org.openide.util.NbBundle.getMessage(MidiInputProcessorPanel.class, "MidiInputProcessorPanel.jLabel1.text")); // NOI18N + + jLabel2.setText(org.openide.util.NbBundle.getMessage(MidiInputProcessorPanel.class, "MidiInputProcessorPanel.jLabel2.text")); // NOI18N + + keyMapComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + keyMapComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + keyMapComboBoxActionPerformed(evt); + } + }); + + jLabel3.setText(org.openide.util.NbBundle.getMessage(MidiInputProcessorPanel.class, "MidiInputProcessorPanel.jLabel3.text")); // NOI18N + + keyConstantText.setText(org.openide.util.NbBundle.getMessage(MidiInputProcessorPanel.class, "MidiInputProcessorPanel.keyConstantText.text")); // NOI18N + + ampConstantText.setText(org.openide.util.NbBundle.getMessage(MidiInputProcessorPanel.class, "MidiInputProcessorPanel.ampConstantText.text")); // NOI18N + + jLabel4.setText(org.openide.util.NbBundle.getMessage(MidiInputProcessorPanel.class, "MidiInputProcessorPanel.jLabel4.text")); // NOI18N + + jLabel5.setText(org.openide.util.NbBundle.getMessage(MidiInputProcessorPanel.class, "MidiInputProcessorPanel.jLabel5.text")); // NOI18N + + ampMapComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + ampMapComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ampMapComboBoxActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel2) + .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel3)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(keyMapComboBox, 0, 121, Short.MAX_VALUE) + .add(keyConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE))) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel4) + .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 61, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(ampMapComboBox, 0, 121, Short.MAX_VALUE) + .add(ampConstantText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel2) + .add(keyMapComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) + .add(jLabel1) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel3) + .add(keyConstantText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(ampMapComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel5)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(ampConstantText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel4)) + .add(180, 180, 180)) + ); + }// </editor-fold>//GEN-END:initComponents + + private void keyMapComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keyMapComboBoxActionPerformed + if (this.processor != null) { + processor.setKeyMapping((MidiKeyMapping) keyMapComboBox.getSelectedItem()); + } + }//GEN-LAST:event_keyMapComboBoxActionPerformed + + private void ampMapComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ampMapComboBoxActionPerformed + if (this.processor != null) { + processor.setVelMapping((MidiVelocityMapping) ampMapComboBox.getSelectedItem()); + } + }//GEN-LAST:event_ampMapComboBoxActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTextField ampConstantText; + private javax.swing.JComboBox ampMapComboBox; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JSeparator jSeparator1; + private javax.swing.JTextField keyConstantText; + private javax.swing.JComboBox keyMapComboBox; + // End of variables declaration//GEN-END:variables + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-05 00:27:49
|
Revision: 4197 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4197&view=rev Author: kunstmusik Date: 2010-04-05 00:27:43 +0000 (Mon, 05 Apr 2010) Log Message: ----------- updates for generics Modified Paths: -------------- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/NoteBuffer.java blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollCanvas.java blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollCanvasHeader.java Modified: blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/NoteBuffer.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/NoteBuffer.java 2010-04-02 23:17:17 UTC (rev 4196) +++ blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/NoteBuffer.java 2010-04-05 00:27:43 UTC (rev 4197) @@ -28,7 +28,7 @@ /** * @author steven */ -public class NoteBuffer extends ArrayList implements SelectionListener { +public class NoteBuffer extends ArrayList<PianoNoteView> implements SelectionListener { private static final int EDGE = 5; private PianoRoll pianoRoll = null; @@ -140,7 +140,7 @@ return; } - PianoNoteView temp = (PianoNoteView) this.get(0); + PianoNoteView temp = this.get(0); startWidth = temp.getWidth(); } @@ -160,7 +160,7 @@ newWidth = EDGE; } - PianoNoteView temp = (PianoNoteView) this.get(0); + PianoNoteView temp = this.get(0); temp.setSize(newWidth, temp.getHeight()); Modified: blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollCanvas.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollCanvas.java 2010-04-02 23:17:17 UTC (rev 4196) +++ blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollCanvas.java 2010-04-05 00:27:43 UTC (rev 4197) @@ -221,8 +221,7 @@ } public void copy() { - PianoNote noteInBuffer = ((PianoNoteView) noteBuffer.get(0)) - .getPianoNote(); + PianoNote noteInBuffer = noteBuffer.get(0).getPianoNote(); bufferedNote = (PianoNote) (noteInBuffer.clone()); } @@ -231,7 +230,7 @@ */ protected void removeNotes() { for (int i = 0; i < noteBuffer.size(); i++) { - PianoNoteView noteView = (PianoNoteView) noteBuffer.get(i); + PianoNoteView noteView = noteBuffer.get(i); this.p.getNotes().remove(noteView.getPianoNote()); this.remove(noteView); } Modified: blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollCanvasHeader.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollCanvasHeader.java 2010-04-02 23:17:17 UTC (rev 4196) +++ blue/trunk/blue-ui-core/src/blue/soundObject/editor/pianoRoll/PianoRollCanvasHeader.java 2010-04-05 00:27:43 UTC (rev 4197) @@ -255,7 +255,7 @@ case SelectionEvent.SELECTION_REMOVE: pnv = (PianoNoteView) selectedItem; - snh = (SelectedNoteHighlighter) noteHilightMap.get(pnv); + snh = noteHilightMap.get(pnv); this.remove(snh); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-02 23:17:23
|
Revision: 4196 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4196&view=rev Author: kunstmusik Date: 2010-04-02 23:17:17 +0000 (Fri, 02 Apr 2010) Log Message: ----------- initial work on MIDI input panel Modified Paths: -------------- blue/trunk/blue-ui-core/src/blue/ui/core/layer.xml Modified: blue/trunk/blue-ui-core/src/blue/ui/core/layer.xml =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/layer.xml 2010-04-02 23:16:46 UTC (rev 4195) +++ blue/trunk/blue-ui-core/src/blue/ui/core/layer.xml 2010-04-02 23:17:17 UTC (rev 4196) @@ -139,6 +139,11 @@ <attr name="displayName" bundlevalue="blue.ui.core.blueLive.Bundle#CTL_BlueLiveAction"/> <attr name="instanceCreate" methodvalue="org.openide.windows.TopComponent.openAction"/> </file> + <file name="blue-ui-core-midi-MidiInputPanelAction.instance"> + <attr name="component" methodvalue="blue.ui.core.midi.MidiInputPanelTopComponent.findInstance"/> + <attr name="displayName" bundlevalue="blue.ui.core.midi.Bundle#CTL_MidiInputPanelAction"/> + <attr name="instanceCreate" methodvalue="org.openide.windows.TopComponent.openAction"/> + </file> <file name="blue-ui-core-mixer-MixerAction.instance"> <attr name="SystemFileSystem.localizingBundle" stringvalue="blue.ui.core.Bundle"/> <attr name="component" methodvalue="blue.ui.core.mixer.MixerTopComponent.findInstance"/> @@ -332,6 +337,9 @@ </folder> <folder name="Window"> + <file name="MidiInputPanelAction.shadow"> + <attr name="originalFile" stringvalue="Actions/Window/blue-ui-core-midi-MidiInputPanelAction.instance"/> + </file> <file name="Output_hidden"/> <file name="SoundObjectEditorAction.shadow"> <attr name="originalFile" stringvalue="Actions/Window/blue-ui-core-score-SoundObjectEditorAction.instance"/> @@ -530,6 +538,7 @@ </folder> <folder name="Windows2"> <folder name="Components"> + <file name="MidiInputPanelTopComponent.settings" url="MidiInputPanelTopComponentSettings.xml"/> <file name="ScoreTopComponent.settings" url="ScoreTopComponentSettings.xml"> <attr name="position" intvalue="1"/> </file> @@ -594,6 +603,7 @@ </folder> <folder name="properties"> <file name="MarkersTopComponent.wstcref" url="MarkersTopComponentWstcref.xml"/> + <file name="MidiInputPanelTopComponent.wstcref" url="MidiInputPanelTopComponentWstcref.xml"/> <file name="ScratchPadTopComponent.wstcref" url="ScratchPadTopComponentWstcref.xml"/> <file name="SoundObjectLibraryTopComponent.wstcref" url="SoundObjectLibraryTopComponentWstcref.xml"/> <file name="SoundObjectPropertiesTopComponent.wstcref" url="SoundObjectPropertiesTopComponentWstcref.xml"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-04-02 23:16:53
|
Revision: 4195 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4195&view=rev Author: kunstmusik Date: 2010-04-02 23:16:46 +0000 (Fri, 02 Apr 2010) Log Message: ----------- initial work on MIDI input panel Added Paths: ----------- blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentSettings.xml blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentWstcref.xml blue/trunk/blue-ui-core/src/blue/ui/core/midi/ blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java Added: blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentSettings.xml =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentSettings.xml (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentSettings.xml 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +To change this template, choose Tools | Templates +and open the template in the editor. +--> +<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd"> +<settings version="1.0"> + <module name="blue.ui.core" spec="1.0"/> + <instanceof class="org.openide.windows.TopComponent"/> + <instanceof class="blue.ui.core.midi.MidiInputPanelTopComponent"/> + <instance class="blue.ui.core.midi.MidiInputPanelTopComponent" method="getDefault"/> +</settings> Added: blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentWstcref.xml =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentWstcref.xml (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentWstcref.xml 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +To change this template, choose Tools | Templates +and open the template in the editor. +--> +<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd"> +<tc-ref version="2.0" > + <module name="blue.ui.core" spec="1.0"/> + <tc-id id="MidiInputPanelTopComponent"/> + <state opened="false"/> +</tc-ref> Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,6 @@ +CTL_MidiInputPanelAction=MidiInputPanel +CTL_MidiInputPanelTopComponent=MidiInputPanel Window +HINT_MidiInputPanelTopComponent=This is a MidiInputPanel window +MidiInputPanelTopComponent.jRadioButton1.text=Instrument +MidiInputPanelTopComponent.jRadioButton2.text=Custom Note Template +MidiInputPanelTopComponent.jTextField1.text=jTextField1 Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jComboBox2" alignment="0" pref="194" max="32767" attributes="0"/> + <Component id="jRadioButton1" min="-2" max="-2" attributes="0"/> + <Component id="jRadioButton2" alignment="0" min="-2" max="-2" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="21" pref="21" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="jTextField1" max="32767" attributes="0"/> + <Component id="jComboBox1" alignment="1" min="-2" pref="173" max="-2" attributes="1"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jComboBox2" min="-2" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jRadioButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jComboBox1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jRadioButton2" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jTextField1" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="166" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JRadioButton" name="jRadioButton1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jRadioButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JRadioButton" name="jRadioButton2"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jRadioButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButton2ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JComboBox" name="jComboBox1"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jTextField1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="jComboBox2"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox2ActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,188 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package blue.ui.core.midi; + +import java.util.logging.Logger; +import org.openide.util.NbBundle; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; +//import org.openide.util.ImageUtilities; +import org.netbeans.api.settings.ConvertAsProperties; + +/** + * Top component which displays something. + */ +@ConvertAsProperties(dtd = "-//blue.ui.core.midi//MidiInputPanel//EN", +autostore = false) +public final class MidiInputPanelTopComponent extends TopComponent { + + private static MidiInputPanelTopComponent instance; + + /** path to the icon used by the component and its open action */ +// static final String ICON_PATH = "SET/PATH/TO/ICON/HERE"; + private static final String PREFERRED_ID = "MidiInputPanelTopComponent"; + + public MidiInputPanelTopComponent() { + initComponents(); + setName(NbBundle.getMessage(MidiInputPanelTopComponent.class, "CTL_MidiInputPanelTopComponent")); + setToolTipText(NbBundle.getMessage(MidiInputPanelTopComponent.class, "HINT_MidiInputPanelTopComponent")); +// setIcon(ImageUtilities.loadImage(ICON_PATH, true)); + + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jRadioButton1 = new javax.swing.JRadioButton(); + jRadioButton2 = new javax.swing.JRadioButton(); + jComboBox1 = new javax.swing.JComboBox(); + jTextField1 = new javax.swing.JTextField(); + jComboBox2 = new javax.swing.JComboBox(); + + org.openide.awt.Mnemonics.setLocalizedText(jRadioButton1, org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jRadioButton1.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jRadioButton2, org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jRadioButton2.text")); // NOI18N + jRadioButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton2ActionPerformed(evt); + } + }); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + jTextField1.setText(org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jTextField1.text")); // NOI18N + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jComboBox2, 0, 194, Short.MAX_VALUE) + .addComponent(jRadioButton1) + .addComponent(jRadioButton2) + .addGroup(layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jTextField1) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jRadioButton1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jRadioButton2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(166, Short.MAX_VALUE)) + ); + }// </editor-fold>//GEN-END:initComponents + + private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton2ActionPerformed + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jComboBox2ActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox jComboBox1; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JRadioButton jRadioButton1; + private javax.swing.JRadioButton jRadioButton2; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables + /** + * Gets default instance. Do not use directly: reserved for *.settings files only, + * i.e. deserialization routines; otherwise you could get a non-deserialized instance. + * To obtain the singleton instance, use {@link #findInstance}. + */ + public static synchronized MidiInputPanelTopComponent getDefault() { + if (instance == null) { + instance = new MidiInputPanelTopComponent(); + } + return instance; + } + + /** + * Obtain the MidiInputPanelTopComponent instance. Never call {@link #getDefault} directly! + */ + public static synchronized MidiInputPanelTopComponent findInstance() { + TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); + if (win == null) { + Logger.getLogger(MidiInputPanelTopComponent.class.getName()).warning( + "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system."); + return getDefault(); + } + if (win instanceof MidiInputPanelTopComponent) { + return (MidiInputPanelTopComponent) win; + } + Logger.getLogger(MidiInputPanelTopComponent.class.getName()).warning( + "There seem to be multiple components with the '" + PREFERRED_ID + + "' ID. That is a potential source of errors and unexpected behavior."); + return getDefault(); + } + + @Override + public int getPersistenceType() { + return TopComponent.PERSISTENCE_ALWAYS; + } + + @Override + public void componentOpened() { + // TODO add custom code on component opening + } + + @Override + public void componentClosed() { + // TODO add custom code on component closing + } + + void writeProperties(java.util.Properties p) { + // better to version settings since initial version as advocated at + // http://wiki.apidesign.org/wiki/PropertyFiles + p.setProperty("version", "1.0"); + // TODO store your settings + } + + Object readProperties(java.util.Properties p) { + if (instance == null) { + instance = this; + } + instance.readPropertiesImpl(p); + return instance; + } + + private void readPropertiesImpl(java.util.Properties p) { + String version = p.getProperty("version"); + // TODO read your settings according to their version + } + + @Override + protected String preferredID() { + return PREFERRED_ID; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-29 00:23:48
|
Revision: 4194 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4194&view=rev Author: kunstmusik Date: 2010-03-29 00:23:41 +0000 (Mon, 29 Mar 2010) Log Message: ----------- fixed saving/loading of enabled state for midi devices, implemented "MIDI Input" button for blueLive toolbar, implemented rescanning in MIDI input options panel Modified Paths: -------------- blue/trunk/blue-midi/nbproject/genfiles.properties blue/trunk/blue-midi/nbproject/project.xml blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java blue/trunk/blue-midi/src/blue/midi/Bundle.properties blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java blue/trunk/blue-midi/src/blue/midi/MidiPanel.form blue/trunk/blue-midi/src/blue/midi/MidiPanel.java blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveToolBar.java Modified: blue/trunk/blue-midi/nbproject/genfiles.properties =================================================================== --- blue/trunk/blue-midi/nbproject/genfiles.properties 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-midi/nbproject/genfiles.properties 2010-03-29 00:23:41 UTC (rev 4194) @@ -1,8 +1,8 @@ -build.xml.data.CRC32=354b3c2b +build.xml.data.CRC32=c1f8240b build.xml.script.CRC32=413025f8 -build.xml.stylesheet.CRC32=79c3b980@1.31.1.7 +build.xml.stylesheet.CRC32=79c3b980@1.31.2.7 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=354b3c2b +nbproject/build-impl.xml.data.CRC32=c1f8240b nbproject/build-impl.xml.script.CRC32=2465577f -nbproject/build-impl.xml.stylesheet.CRC32=261c4bef@1.31.1.7 +nbproject/build-impl.xml.stylesheet.CRC32=261c4bef@1.31.2.7 Modified: blue/trunk/blue-midi/nbproject/project.xml =================================================================== --- blue/trunk/blue-midi/nbproject/project.xml 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-midi/nbproject/project.xml 2010-03-29 00:23:41 UTC (rev 4194) @@ -7,6 +7,14 @@ <suite-component/> <module-dependencies> <dependency> + <code-name-base>blue.plaf</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>1.0</specification-version> + </run-dependency> + </dependency> + <dependency> <code-name-base>org.jdesktop.layout</code-name-base> <build-prerequisite/> <compile-dependency/> Modified: blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java 2010-03-29 00:23:41 UTC (rev 4194) @@ -17,7 +17,6 @@ * the Free Software Foundation Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA */ - package blue.midi; import javax.sound.midi.MidiDevice; @@ -82,7 +81,7 @@ } input = null; - if(cl != null) { + if (cl != null) { cl.stateChanged(e); } } @@ -95,7 +94,6 @@ this.enabled = enabled; } - public String toString() { if (info != null) { return info.getName(); @@ -106,5 +104,22 @@ public void setChangeListener(ChangeListener cl) { this.cl = cl; } - + + public final boolean equals(Object obj) { + if (obj instanceof BlueMidiDevice) { + BlueMidiDevice dev2 = (BlueMidiDevice) obj; + MidiDevice.Info info2 = dev2.info; + + return (info.getDescription().equals(info2.getDescription()) + && info.getName().equals(info2.getName()) + && info.getVendor().equals(info2.getVendor()) + && info.getVersion().equals(info2.getVersion())); + } + return false; + } + + public String getSaveName() { + return info.getDescription() + info.getName() + info.getVendor() + info. + getVersion(); + } } Modified: blue/trunk/blue-midi/src/blue/midi/Bundle.properties =================================================================== --- blue/trunk/blue-midi/src/blue/midi/Bundle.properties 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-midi/src/blue/midi/Bundle.properties 2010-03-29 00:23:41 UTC (rev 4194) @@ -1,3 +1,4 @@ AdvancedOption_DisplayName_Midi=MIDI AdvancedOption_Keywords_Midi=MIDI OpenIDE-Module-Name=blue-midi +MidiPanel.jButton1.text=Rescan Modified: blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java 2010-03-29 00:23:41 UTC (rev 4194) @@ -49,17 +49,16 @@ private ChangeEvent changeEvent = null; - private Vector<BlueMidiDevice> items = null; + private Vector<BlueMidiDevice> items = new Vector<BlueMidiDevice>(); private boolean running = false; /** Creates a new instance of MidiInputManager */ private MidiInputManager() { rescan(); - load(); } - public static MidiInputManager getInstance() { + public static synchronized MidiInputManager getInstance() { if (instance == null) { instance = new MidiInputManager(); } @@ -67,36 +66,55 @@ } public void rescan() { - MidiDevice.Info[] info; - info = MidiSystem.getMidiDeviceInfo(); + MidiDevice.Info[] info = MidiSystem.getMidiDeviceInfo(); - Vector<BlueMidiDevice> items = new Vector<BlueMidiDevice>(); + Vector<BlueMidiDevice> newItems = new Vector<BlueMidiDevice>(); for (int i = 0; i < info.length; i++) { try { if (MidiSystem.getMidiDevice(info[i]).getMaxTransmitters() != 0) { - final BlueMidiDevice blueMidiDevice = new BlueMidiDevice(info[i]); - blueMidiDevice.setChangeListener(this); - items.add(blueMidiDevice); + + final BlueMidiDevice blueMidiDevice = new BlueMidiDevice( + info[i]); + BlueMidiDevice old = getDeviceByInfo(blueMidiDevice); + + if (old == null) { + blueMidiDevice.setChangeListener(this); + newItems.add(blueMidiDevice); + } else { + newItems.add(old); + } } - } catch (MidiUnavailableException ex) { ex.printStackTrace(); } } - this.items = items; + this.items = newItems; + + load(); } + private BlueMidiDevice getDeviceByInfo(BlueMidiDevice info) { + for (BlueMidiDevice device : items) { + if (device.equals(info)) { + return device; + } + } + return null; + } + public Vector<BlueMidiDevice> getInputDeviceOptions() { return items; } /* ENGINE METHODS */ - public synchronized void start() { + if (running) { + return; + } for (BlueMidiDevice device : items) { - if(device.isEnabled()) { + if (device.isEnabled()) { try { device.open(); } catch (MidiUnavailableException ex) { @@ -110,6 +128,9 @@ } public synchronized void stop() { + if (!running) { + return; + } for (BlueMidiDevice device : items) { device.close(); } @@ -161,19 +182,19 @@ /* RECEIVER METHODS */ public void send(MidiMessage message, long timeStamp) { broadcastMessage(message, timeStamp); + //System.out.println(timeStamp + " : " + message); } public void close() { } /* SAVE/LOAD METHODS */ - protected void save() { final Preferences prefs = NbPreferences.forModule( MidiInputManager.class); for (BlueMidiDevice device : items) { - prefs.putBoolean(device.toString(), device.isEnabled()); + prefs.putBoolean(device.getSaveName(), device.isEnabled()); } try { @@ -188,7 +209,19 @@ MidiInputManager.class); for (BlueMidiDevice device : items) { - device.setEnabled(prefs.getBoolean(device.toString(), false)); + device.setEnabled(prefs.getBoolean(device.getSaveName(), false)); + + if (running) { + if (device.isEnabled()) { + try { + device.open(); + } catch (MidiUnavailableException ex) { + Exceptions.printStackTrace(ex); + } + } else { + device.close(); + } + } } } } Modified: blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java 2010-03-29 00:23:41 UTC (rev 4194) @@ -38,12 +38,20 @@ @Override public int getColumnCount() { - return 2; + return 3; } @Override public String getColumnName(int column) { - return (column == 0) ? "Open" : "Device Name"; + switch (column) { + case 0: + return "Enabled"; + case 1: + return "Device Name"; + case 2: + return "Description"; + } + return ""; } @Override @@ -55,10 +63,15 @@ public Object getValueAt(int row, int column) { BlueMidiDevice device = devices.get(row); - if (column == 0) { - return device.isEnabled(); + switch (column) { + case 0: + return device.isEnabled(); + case 1: + return device.toString(); + case 2: + return device.getDeviceInfo().getDescription(); } - return device.toString(); + return null; } @Override Modified: blue/trunk/blue-midi/src/blue/midi/MidiPanel.form =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiPanel.form 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-midi/src/blue/midi/MidiPanel.form 2010-03-29 00:23:41 UTC (rev 4194) @@ -16,18 +16,23 @@ <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> + <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> - <Component id="jScrollPane1" pref="256" max="32767" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jScrollPane1" alignment="1" pref="244" max="32767" attributes="0"/> + <Component id="jButton1" alignment="1" min="-2" max="-2" attributes="0"/> + </Group> <EmptySpace max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> <EmptySpace max="-2" attributes="0"/> - <Component id="jScrollPane1" pref="100" max="32767" attributes="0"/> + <Component id="jScrollPane1" pref="93" max="32767" attributes="0"/> + <EmptySpace min="-2" pref="11" max="-2" attributes="0"/> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> </Group> </Group> @@ -55,5 +60,15 @@ </Component> </SubComponents> </Container> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/midi/Bundle.properties" key="MidiPanel.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> </SubComponents> </Form> Modified: blue/trunk/blue-midi/src/blue/midi/MidiPanel.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiPanel.java 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-midi/src/blue/midi/MidiPanel.java 2010-03-29 00:23:41 UTC (rev 4194) @@ -26,7 +26,10 @@ MidiPanel(MidiOptionsPanelController controller) { this.controller = controller; initComponents(); + resetModel(); + } + public void resetModel() { jTable1.setModel(new MidiInputTableModel()); jTable1.getTableHeader().setReorderingAllowed(false); jTable1.getColumnModel().getColumn(0).setMaxWidth(60); @@ -43,6 +46,7 @@ jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); + jButton1 = new javax.swing.JButton(); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { @@ -57,24 +61,40 @@ )); jScrollPane1.setViewportView(jTable1); + org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(MidiPanel.class, "MidiPanel.jButton1.text")); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) + .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE) + .addGap(11, 11, 11) + .addComponent(jButton1) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + MidiInputManager.getInstance().rescan(); + resetModel(); + }//GEN-LAST:event_jButton1ActionPerformed + void load() { // TODO read settings and initialize GUI // Example: @@ -100,6 +120,7 @@ return true; } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; // End of variables declaration//GEN-END:variables Modified: blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveToolBar.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveToolBar.java 2010-03-29 00:21:54 UTC (rev 4193) +++ blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveToolBar.java 2010-03-29 00:23:41 UTC (rev 4194) @@ -22,6 +22,7 @@ import blue.BlueData; import blue.event.PlayModeListener; import blue.gui.ExceptionDialog; +import blue.midi.MidiInputManager; import blue.projects.BlueProject; import blue.projects.BlueProjectManager; import blue.settings.GeneralSettings; @@ -59,6 +60,8 @@ JButton allNotesOffButton = new JButton("All Notes Off"); + JToggleButton midiButton = new JToggleButton("MIDI Input"); + private static BlueLiveToolBar instance = null; public static BlueLiveToolBar getInstance() { @@ -105,9 +108,18 @@ } }); + midiButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + midiButtonActionPerformed(); + } + + }); + this.add(runButton); this.add(refreshButton); this.add(allNotesOffButton); + this.add(midiButton); BlueProjectManager.getInstance().addPropertyChangeListener(new PropertyChangeListener() { @@ -172,6 +184,16 @@ } } + public void midiButtonActionPerformed() { + boolean selected = midiButton.isSelected(); + + if(selected) { + MidiInputManager.getInstance().start(); + } else { + MidiInputManager.getInstance().stop(); + } + } + private void allNotesOffButtonActionPerformed(java.awt.event.ActionEvent evt) { sendEvents("i \"blueAllNotesOff\" 0 1"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-29 00:22:00
|
Revision: 4193 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4193&view=rev Author: kunstmusik Date: 2010-03-29 00:21:54 +0000 (Mon, 29 Mar 2010) Log Message: ----------- fixes for generics Modified Paths: -------------- blue/trunk/blue-core/src/blue/automation/ParameterList.java blue/trunk/blue-core/src/blue/soundObject/PianoRoll.java Modified: blue/trunk/blue-core/src/blue/automation/ParameterList.java =================================================================== --- blue/trunk/blue-core/src/blue/automation/ParameterList.java 2010-03-28 03:15:19 UTC (rev 4192) +++ blue/trunk/blue-core/src/blue/automation/ParameterList.java 2010-03-29 00:21:54 UTC (rev 4193) @@ -33,10 +33,10 @@ import electric.xml.Elements; public class ParameterList implements Serializable { - private static final Comparator comparator = new Comparator() { - public int compare(Object o1, Object o2) { - Parameter para1 = (Parameter) o1; - Parameter para2 = (Parameter) o2; + private static final Comparator<Parameter> comparator = new Comparator<Parameter>() { + public int compare(Parameter o1, Parameter o2) { + Parameter para1 = o1; + Parameter para2 = o2; return para1.getName().compareToIgnoreCase(para2.getName()); @@ -70,7 +70,7 @@ public void addParameter(Parameter param) { parameters.add(param); - Collections.sort(parameters, comparator); + Collections.<Parameter>sort(parameters, comparator); fireParameterAdded(param); } Modified: blue/trunk/blue-core/src/blue/soundObject/PianoRoll.java =================================================================== --- blue/trunk/blue-core/src/blue/soundObject/PianoRoll.java 2010-03-28 03:15:19 UTC (rev 4192) +++ blue/trunk/blue-core/src/blue/soundObject/PianoRoll.java 2010-03-29 00:21:54 UTC (rev 4193) @@ -45,7 +45,7 @@ private Scale scale; - private ArrayList notes; + private ArrayList<PianoNote> notes; private String noteTemplate; @@ -73,7 +73,7 @@ this.setName("PianoRoll"); timeBehavior = TIME_BEHAVIOR_SCALE; scale = Scale.get12TET(); - notes = new ArrayList(); + notes = new ArrayList<PianoNote>(); noteTemplate = "i <INSTR_ID> <START> <DUR> <FREQ>"; instrumentId = "1"; pixelSecond = 64; @@ -116,8 +116,8 @@ instrId = "\"" + instrId + "\""; } - for (Iterator iter = notes.iterator(); iter.hasNext();) { - PianoNote n = (PianoNote) iter.next(); + for (Iterator<PianoNote> iter = notes.iterator(); iter.hasNext();) { + PianoNote n = iter.next(); String freq = ""; @@ -298,8 +298,8 @@ retVal.addElement("transposition").setText( Integer.toString(this.getTransposition())); - for (Iterator iter = notes.iterator(); iter.hasNext();) { - PianoNote note = (PianoNote) iter.next(); + for (Iterator<PianoNote> iter = notes.iterator(); iter.hasNext();) { + PianoNote note = iter.next(); retVal.addElement(note.saveAsXML()); } @@ -309,7 +309,7 @@ /** * @return Returns the notes. */ - public ArrayList getNotes() { + public ArrayList<PianoNote> getNotes() { return notes; } @@ -317,7 +317,7 @@ * @param notes * The notes to set. */ - public void setNotes(ArrayList notes) { + public void setNotes(ArrayList<PianoNote> notes) { this.notes = notes; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-28 03:15:25
|
Revision: 4192 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4192&view=rev Author: kunstmusik Date: 2010-03-28 03:15:19 +0000 (Sun, 28 Mar 2010) Log Message: ----------- updated MIDI to have open and enabled status in BlueMidiDevice, set enabled instead of open/closed in Midi device table, added engine start/stop to MidiInputManager as well as saving/loading of enabled status for MIDI devices Modified Paths: -------------- blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java Modified: blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java 2010-03-28 03:06:11 UTC (rev 4191) +++ blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java 2010-03-28 03:15:19 UTC (rev 4192) @@ -32,10 +32,12 @@ private MidiDevice input = null; - ChangeListener cl = null; + private ChangeListener cl = null; - ChangeEvent e; + private ChangeEvent e; + private boolean enabled = false; + public BlueMidiDevice(MidiDevice.Info info) { this.info = info; e = new ChangeEvent(this); @@ -70,7 +72,7 @@ cl.stateChanged(e); } - public boolean isEnabled() { + public boolean isOpen() { return input != null && input.isOpen(); } @@ -85,6 +87,15 @@ } } + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public String toString() { if (info != null) { return info.getName(); Modified: blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java 2010-03-28 03:06:11 UTC (rev 4191) +++ blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java 2010-03-28 03:15:19 UTC (rev 4192) @@ -21,6 +21,8 @@ import java.util.Iterator; import java.util.Vector; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiMessage; @@ -30,6 +32,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.openide.util.Exceptions; +import org.openide.util.NbPreferences; /** * Manages MIDI Input Device, single device at a time, notifies listeners when @@ -42,16 +45,18 @@ private static MidiInputManager instance = null; - private Vector listeners = null; + private Vector<Receiver> receivers = null; - private Vector receivers = null; - private ChangeEvent changeEvent = null; - Vector<BlueMidiDevice> items = null; + private Vector<BlueMidiDevice> items = null; + private boolean running = false; + /** Creates a new instance of MidiInputManager */ private MidiInputManager() { + rescan(); + load(); } public static MidiInputManager getInstance() { @@ -69,8 +74,6 @@ for (int i = 0; i < info.length; i++) { try { - // System.err.println(MidiSystem.getMidiDevice(info[i]).getMaxTransmitters()); - if (MidiSystem.getMidiDevice(info[i]).getMaxTransmitters() != 0) { final BlueMidiDevice blueMidiDevice = new BlueMidiDevice(info[i]); blueMidiDevice.setChangeListener(this); @@ -86,16 +89,41 @@ } public Vector<BlueMidiDevice> getInputDeviceOptions() { - if (items == null) { - rescan(); - } return items; } + /* ENGINE METHODS */ + + public synchronized void start() { + for (BlueMidiDevice device : items) { + if(device.isEnabled()) { + try { + device.open(); + } catch (MidiUnavailableException ex) { + Exceptions.printStackTrace(ex); + } + } else { + device.close(); + } + } + running = true; + } + + public synchronized void stop() { + for (BlueMidiDevice device : items) { + device.close(); + } + running = false; + } + + public synchronized boolean isRunning() { + return running; + } + /* BROADCAST MIDI TO RECEIVERS */ public void addReceiver(Receiver receiver) { if (receivers == null) { - receivers = new Vector(); + receivers = new Vector<Receiver>(); } receivers.add(receiver); } @@ -121,7 +149,7 @@ public void stateChanged(ChangeEvent e) { BlueMidiDevice device = (BlueMidiDevice) e.getSource(); - if (device.isEnabled()) { + if (device.isOpen()) { try { device.getMidiDevice().getTransmitter().setReceiver(this); } catch (MidiUnavailableException ex) { @@ -137,4 +165,30 @@ public void close() { } + + /* SAVE/LOAD METHODS */ + + protected void save() { + final Preferences prefs = NbPreferences.forModule( + MidiInputManager.class); + + for (BlueMidiDevice device : items) { + prefs.putBoolean(device.toString(), device.isEnabled()); + } + + try { + prefs.sync(); + } catch (BackingStoreException ex) { + Exceptions.printStackTrace(ex); + } + } + + private void load() { + final Preferences prefs = NbPreferences.forModule( + MidiInputManager.class); + + for (BlueMidiDevice device : items) { + device.setEnabled(prefs.getBoolean(device.toString(), false)); + } + } } Modified: blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java 2010-03-28 03:06:11 UTC (rev 4191) +++ blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java 2010-03-28 03:15:19 UTC (rev 4192) @@ -70,19 +70,24 @@ public void setValueAt(Object aValue, int row, int column) { if (column == 0) { BlueMidiDevice device = devices.get(row); - boolean open = ((Boolean) aValue).booleanValue(); + boolean enabled = ((Boolean) aValue).booleanValue(); - if (open) { - try { - device.open(); - } catch (MidiUnavailableException ex) { - Exceptions.printStackTrace(ex); + device.setEnabled(enabled); + + if (MidiInputManager.getInstance().isRunning()) { + if (enabled) { + try { + device.open(); + } catch (MidiUnavailableException ex) { + Exceptions.printStackTrace(ex); + } + } else { + device.close(); } - } else { - device.close(); } + MidiInputManager.getInstance().save(); + fireTableCellUpdated(row, column); } - fireTableCellUpdated(row, column); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-28 03:06:17
|
Revision: 4191 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4191&view=rev Author: kunstmusik Date: 2010-03-28 03:06:11 +0000 (Sun, 28 Mar 2010) Log Message: ----------- fixed for generics Modified Paths: -------------- blue/trunk/blue-core/src/blue/Arrangement.java Modified: blue/trunk/blue-core/src/blue/Arrangement.java =================================================================== --- blue/trunk/blue-core/src/blue/Arrangement.java 2010-03-28 02:55:51 UTC (rev 4190) +++ blue/trunk/blue-core/src/blue/Arrangement.java 2010-03-28 03:06:11 UTC (rev 4191) @@ -17,7 +17,6 @@ * the Free Software Foundation Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA */ - package blue; import java.io.Serializable; @@ -50,7 +49,6 @@ * Selected instruments from instrument library to use for CSD generation. * Instruments are held in a TreeMap. */ - public class Arrangement implements Cloneable, Serializable, TableModel { private static final Pattern NEW_LINES = Pattern.compile("\\n"); @@ -87,7 +85,7 @@ int max = 0; for (int i = 0; i < arrangement.size(); i++) { - InstrumentAssignment ia = (InstrumentAssignment) arrangement.get(i); + InstrumentAssignment ia = arrangement.get(i); try { int instrNum = Integer.parseInt(ia.arrangementId); if (instrNum > max) { @@ -118,14 +116,13 @@ int retVal = -1; try { - int currentInstrumentNum = (instrumentId == null) ? 0 : Integer - .parseInt(instrumentId); + int currentInstrumentNum = (instrumentId == null) ? 0 : Integer. + parseInt(instrumentId); int counter = currentInstrumentNum + 1; for (int i = 0; i < arrangement.size(); i++) { - InstrumentAssignment ia = (InstrumentAssignment) arrangement - .get(i); + InstrumentAssignment ia = arrangement.get(i); try { if (counter == Integer.parseInt(ia.arrangementId)) { counter++; @@ -197,7 +194,7 @@ public boolean containsInstrumentId(String instrId) { for (int i = 0; i < arrangement.size(); i++) { - InstrumentAssignment ia = (InstrumentAssignment) arrangement.get(i); + InstrumentAssignment ia = arrangement.get(i); if (ia.arrangementId.equals(instrId)) { return true; } @@ -216,15 +213,16 @@ } public void replaceInstrument(String instrumentId, Instrument instr) { - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); if (ia.arrangementId.equals(instrumentId)) { ia.instr = instr; } } fireTableDataChanged(); - + if (instr instanceof Automatable) { fireAutomatableAdded((Automatable) instr); } @@ -232,7 +230,7 @@ public Instrument removeInstrument(String instrumentId) { for (int i = 0; i < arrangement.size(); i++) { - InstrumentAssignment ia = (InstrumentAssignment) arrangement.get(i); + InstrumentAssignment ia = arrangement.get(i); if (ia.arrangementId.equals(instrumentId)) { return removeInstrument(i); } @@ -246,14 +244,15 @@ } public String getInstrumentId(int index) { - InstrumentAssignment ia = (InstrumentAssignment) arrangement.get(index); + InstrumentAssignment ia = arrangement.get(index); return ia.arrangementId; } public String getInstrumentId(Instrument instr) { - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); if (ia.instr == instr) { return ia.arrangementId; } @@ -272,14 +271,15 @@ } public Instrument getInstrument(int index) { - InstrumentAssignment ia = (InstrumentAssignment) arrangement.get(index); + InstrumentAssignment ia = arrangement.get(index); return ia.instr; } public Instrument getInstrument(String arrangementId) { - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); if (ia.arrangementId.equals(arrangementId)) { return ia.instr; } @@ -288,8 +288,9 @@ } public void changeInstrumentId(Instrument instr, String newId) { - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); if (ia.instr == instr) { String oldId = ia.arrangementId; @@ -324,8 +325,9 @@ ArrayList<Instrument> instruments = new ArrayList<Instrument>(); - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); if (!ia.enabled) { continue; @@ -352,8 +354,9 @@ public String generateGlobalSco() { StrBuilder retVal = new StrBuilder(); - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); if (!ia.enabled) { continue; @@ -391,8 +394,9 @@ preGenList = new ArrayList<InstrumentAssignment>(); } - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); preGenList.add(ia); @@ -413,8 +417,9 @@ buffer = preGenerationCache; } - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); if (!preGenList.contains(ia)) { @@ -454,22 +459,22 @@ } public void clearUnusedInstrAssignments() { - Iterator iter = arrangement.iterator(); + Iterator<InstrumentAssignment> iter = arrangement.iterator(); while (iter.hasNext()) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + InstrumentAssignment ia = iter.next(); if (!ia.enabled) { iter.remove(); } } } - + public void generateUserDefinedOpcodes(OpcodeList udos) { - Iterator iter = arrangement.iterator(); + Iterator<InstrumentAssignment> iter = arrangement.iterator(); while (iter.hasNext()) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + InstrumentAssignment ia = iter.next(); if (!ia.enabled) { continue; @@ -480,10 +485,10 @@ } public void generateFTables(Tables tables) { - Iterator iter = arrangement.iterator(); + Iterator<InstrumentAssignment> iter = arrangement.iterator(); while (iter.hasNext()) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + InstrumentAssignment ia = iter.next(); if (!ia.enabled) { continue; @@ -521,8 +526,8 @@ StrBuilder buffer = new StrBuilder(); String[] lines = NEW_LINES.split(input); - for(String line : lines) { - + for (String line : lines) { + if (line.trim().startsWith("blueMixerOut")) { String argText = line.trim().substring(12); @@ -555,8 +560,8 @@ i - 1); buffer.append(var).append(" = "); - buffer.append(var).append(" + ").append(arg) - .append("\n"); + buffer.append(var).append(" + ").append(arg).append( + "\n"); } } @@ -573,8 +578,8 @@ String var = Mixer.getChannelVar(arrangementId, i); buffer.append(var).append(" = "); - buffer.append(var).append(" + ").append(arg) - .append("\n"); + buffer.append(var).append(" + ").append(arg).append( + "\n"); } } @@ -593,7 +598,6 @@ * compiling a CSD is happening. Plugins can check variables that are set, * useful for caching ID's, instruments, etc. */ - public Object getCompilationVariable(Object key) { if (compilationVariables == null) { compilationVariables = new HashMap(); @@ -608,7 +612,6 @@ * compiling a CSD is happening. Plugins can set variables, useful for * caching ID's, instruments, etc. */ - public void setCompilationVariable(Object key, Object value) { if (compilationVariables == null) { compilationVariables = new HashMap(); @@ -618,7 +621,6 @@ } // NEW SAVING AND LOADING METHODS - public static Arrangement loadFromXML(Element data) throws Exception { Arrangement arr = new Arrangement(); @@ -638,8 +640,9 @@ public Element saveAsXML() { Element retVal = new Element("arrangement"); - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); retVal.addElement(ia.saveAsXML()); } @@ -648,7 +651,6 @@ } // OLD SAVING AND LOADING METHODS - /** * Used by old pre 0.95.0 code before instrument libraries removed from * project and user instrument library was implemented. @@ -690,8 +692,9 @@ public Element saveAsXML(InstrumentLibrary iLibrary) { Element retVal = new Element("arrangement"); - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); retVal.addElement(ia.saveAsXML(iLibrary)); } @@ -704,8 +707,9 @@ * @return */ public boolean containsInstrument(Instrument instr) { - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); if (ia.instr == instr) { return true; @@ -719,8 +723,7 @@ * @param index */ public Instrument removeInstrument(int index) { - InstrumentAssignment ia = (InstrumentAssignment) arrangement - .remove(index); + InstrumentAssignment ia = arrangement.remove(index); fireTableDataChanged(); @@ -736,15 +739,16 @@ * @return */ public InstrumentAssignment getInstrumentAssignment(int rowIndex) { - return (InstrumentAssignment) arrangement.get(rowIndex); + return arrangement.get(rowIndex); } /** * */ public void normalize() { - for (Iterator iter = arrangement.iterator(); iter.hasNext();) { - InstrumentAssignment ia = (InstrumentAssignment) iter.next(); + for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter. + hasNext();) { + InstrumentAssignment ia = iter.next(); ia.normalize(); @@ -754,7 +758,6 @@ /* * TABLE MODEL METHODS */ - public int getRowCount() { return this.size(); } @@ -899,12 +902,11 @@ private void fireAutomatableAdded(Automatable automatable) { if (automatableCollectionListeners != null) { - Iterator iter = new Vector(automatableCollectionListeners) - .iterator(); + Iterator iter = new Vector(automatableCollectionListeners).iterator(); while (iter.hasNext()) { - AutomatableCollectionListener listener = (AutomatableCollectionListener) iter - .next(); + AutomatableCollectionListener listener = (AutomatableCollectionListener) iter. + next(); listener.automatableAdded(automatable); } } @@ -912,14 +914,12 @@ private void fireAutomatableRemoved(Automatable automatable) { if (automatableCollectionListeners != null) { - Iterator iter = new Vector(automatableCollectionListeners) - .iterator(); + Iterator iter = new Vector(automatableCollectionListeners).iterator(); while (iter.hasNext()) { - AutomatableCollectionListener listener = (AutomatableCollectionListener) iter - .next(); + AutomatableCollectionListener listener = (AutomatableCollectionListener) iter. + next(); listener.automatableRemoved(automatable); } } } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-28 02:55:57
|
Revision: 4190 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4190&view=rev Author: kunstmusik Date: 2010-03-28 02:55:51 +0000 (Sun, 28 Mar 2010) Log Message: ----------- fixes for generics Modified Paths: -------------- blue/trunk/blue-ui-core/src/blue/gui/BlueEditorPane.java Modified: blue/trunk/blue-ui-core/src/blue/gui/BlueEditorPane.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/gui/BlueEditorPane.java 2010-03-28 02:55:38 UTC (rev 4189) +++ blue/trunk/blue-ui-core/src/blue/gui/BlueEditorPane.java 2010-03-28 02:55:51 UTC (rev 4190) @@ -203,11 +203,11 @@ // }); } - private ArrayList findMatches(String source, String toMatch) { + private ArrayList<String> findMatches(String source, String toMatch) { Pattern p = Pattern.compile(toMatch + "\\w*"); Matcher m = p.matcher(source); - ArrayList matches = new ArrayList(); + ArrayList<String> matches = new ArrayList<String>(); while (m.find()) { String match = m.group() + " - [var]"; @@ -357,7 +357,7 @@ String[] matches = opcodePopup.getOpcodeMatches(word); - ArrayList options = new ArrayList(matches.length); + ArrayList<String> options = new ArrayList<String>(matches.length); options.addAll(Arrays.asList(matches)); if (isCsoundVariable(word)) { @@ -366,7 +366,7 @@ options.addAll(varMatches); } - Collections.sort(options); + Collections.<String>sort(options); if (options.size() == 0) { return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-28 02:55:44
|
Revision: 4189 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4189&view=rev Author: kunstmusik Date: 2010-03-28 02:55:38 +0000 (Sun, 28 Mar 2010) Log Message: ----------- fixes for generics Modified Paths: -------------- blue/trunk/blue-ui-core/src/blue/components/FindReplaceDialog.java blue/trunk/blue-ui-core/src/blue/gui/OpcodePopup.java blue/trunk/blue-ui-core/src/blue/ui/core/render/APIRunner.java blue/trunk/blue-ui-core/src/blue/ui/core/render/ProcessConsole.java blue/trunk/blue-ui-core/src/org/syntax/jedit/InputHandler.java Modified: blue/trunk/blue-ui-core/src/blue/components/FindReplaceDialog.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/components/FindReplaceDialog.java 2010-03-28 02:55:08 UTC (rev 4188) +++ blue/trunk/blue-ui-core/src/blue/components/FindReplaceDialog.java 2010-03-28 02:55:38 UTC (rev 4189) @@ -47,7 +47,8 @@ BlueEditorPane textArea = null; - private static WeakHashMap map = new WeakHashMap(); + private static WeakHashMap<Component, FindReplaceDialog> map = + new WeakHashMap<Component, FindReplaceDialog>(); public static void showFindReplace(BlueEditorPane textComponent) { Component root = SwingUtilities.getRoot(textComponent); @@ -65,7 +66,7 @@ map.put(root, dialog); } - FindReplaceDialog findReplaceDialog = (FindReplaceDialog) map.get(root); + FindReplaceDialog findReplaceDialog = map.get(root); findReplaceDialog.setTextArea(textComponent); Modified: blue/trunk/blue-ui-core/src/blue/gui/OpcodePopup.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/gui/OpcodePopup.java 2010-03-28 02:55:08 UTC (rev 4188) +++ blue/trunk/blue-ui-core/src/blue/gui/OpcodePopup.java 2010-03-28 02:55:38 UTC (rev 4189) @@ -52,7 +52,7 @@ private ActionListener syntaxListener; - private static HashMap opcodeSignatures = new HashMap(); + private static HashMap<String, String> opcodeSignatures = new HashMap<String, String>(); private Action addToCodeRepository; @@ -339,7 +339,7 @@ String[] matches = new String[opcodeMatches.size()]; for (int i = 0; i < matches.length; i++) { - matches[i] = (String) opcodeMatches.get(i); + matches[i] = opcodeMatches.get(i); } return matches; Modified: blue/trunk/blue-ui-core/src/blue/ui/core/render/APIRunner.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/render/APIRunner.java 2010-03-28 02:55:08 UTC (rev 4188) +++ blue/trunk/blue-ui-core/src/blue/ui/core/render/APIRunner.java 2010-03-28 02:55:38 UTC (rev 4189) @@ -50,7 +50,7 @@ */ public class APIRunner implements CSDRunner, PlayModeListener { - Vector listeners = null; + Vector<PlayModeListener> listeners = null; private BlueData data = null; @@ -311,7 +311,7 @@ public void addPlayModeListener(PlayModeListener listener) { if (listeners == null) { - listeners = new Vector(); + listeners = new Vector<PlayModeListener>(); } listeners.add(listener); @@ -328,8 +328,8 @@ return; } - for (Iterator iter = listeners.iterator(); iter.hasNext();) { - PlayModeListener listener = (PlayModeListener) iter.next(); + for (Iterator<PlayModeListener> iter = listeners.iterator(); iter.hasNext();) { + PlayModeListener listener = iter.next(); listener.playModeChanged(playMode); } } Modified: blue/trunk/blue-ui-core/src/blue/ui/core/render/ProcessConsole.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/render/ProcessConsole.java 2010-03-28 02:55:08 UTC (rev 4188) +++ blue/trunk/blue-ui-core/src/blue/ui/core/render/ProcessConsole.java 2010-03-28 02:55:38 UTC (rev 4189) @@ -200,7 +200,7 @@ String[] retVal = new String[parts.size()]; for (int i = 0; i < parts.size(); i++) { - retVal[i] = (String) parts.get(i); + retVal[i] = parts.get(i); } return retVal; Modified: blue/trunk/blue-ui-core/src/org/syntax/jedit/InputHandler.java =================================================================== --- blue/trunk/blue-ui-core/src/org/syntax/jedit/InputHandler.java 2010-03-28 02:55:08 UTC (rev 4188) +++ blue/trunk/blue-ui-core/src/org/syntax/jedit/InputHandler.java 2010-03-28 02:55:38 UTC (rev 4189) @@ -125,10 +125,10 @@ // Default action public static final ActionListener INSERT_CHAR = new insert_char(); - private static Hashtable actions; + private static Hashtable<String, ActionListener> actions; static { - actions = new Hashtable(); + actions = new Hashtable<String, ActionListener>(); actions.put("backspace", BACKSPACE); actions.put("backspace-word", BACKSPACE_WORD); actions.put("delete", DELETE); @@ -177,7 +177,7 @@ * The action name */ public static ActionListener getAction(String name) { - return (ActionListener) actions.get(name); + return actions.get(name); } /** @@ -201,7 +201,7 @@ /** * Returns an enumeration of all available actions. */ - public static Enumeration getActions() { + public static Enumeration<String> getActions() { return actions.keys(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-28 02:55:17
|
Revision: 4188 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4188&view=rev Author: kunstmusik Date: 2010-03-28 02:55:08 +0000 (Sun, 28 Mar 2010) Log Message: ----------- removed unused classes Removed Paths: ------------- blue/trunk/blue-ui-core/src/blue/AudioFileDependencyDialog.java blue/trunk/blue-ui-core/src/blue/SplashScreen.java Deleted: blue/trunk/blue-ui-core/src/blue/AudioFileDependencyDialog.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/AudioFileDependencyDialog.java 2010-03-27 03:08:56 UTC (rev 4187) +++ blue/trunk/blue-ui-core/src/blue/AudioFileDependencyDialog.java 2010-03-28 02:55:08 UTC (rev 4188) @@ -1,184 +0,0 @@ -/* - * blue - object composition environment for csound - * Copyright (c) 2000-2005 Steven Yi (ste...@gm...) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307 USA - */ -package blue; - -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; - -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.AbstractTableModel; - -import blue.utility.GUI; - -import com.l2fprod.common.swing.BaseDialog; - -public class AudioFileDependencyDialog extends BaseDialog { - - DependencyTableModel model = new DependencyTableModel(); - - JFileChooser fChooser = null; - - public AudioFileDependencyDialog() { - super((JFrame) null, "Audio File Dependencies", true); - this.getBanner().setTitle("Locate Missing Audio Files"); - - this.setModal(true); - - this.setDefaultCloseOperation(HIDE_ON_CLOSE); - - final JTable table = new JTable(model); - - table.addMouseListener(new MouseAdapter() { - - public void mouseClicked(MouseEvent e) { - int row = table.getSelectedRow(); - - if (row >= model.getRowCount()) { - return; - } - - if (e.getClickCount() == 2) { - if (fChooser == null) { - fChooser = new JFileChooser(); - fChooser.setDialogTitle("Choose Replacement File"); - } - - int retVal = fChooser.showOpenDialog(null); - - File f = fChooser.getSelectedFile(); - - if (retVal == JFileChooser.APPROVE_OPTION) { - model.setValueAt(f.getPath(), row, 1); - } - } - } - - }); - - JScrollPane jsp = new JScrollPane(table); - - this.getContentPane().add(jsp); - - this.setSize(400, 500); - - GUI.centerOnScreen(this); - } - - public void setFilesList(ArrayList filesList) { - model.setFilesList(filesList); - } - - public HashMap getFilesMap() { - return model.getFilesMap(); - } - - /** - * @param args - */ - public static void main(String[] args) { - GUI.setBlueLookAndFeel(); - AudioFileDependencyDialog aDialog = new AudioFileDependencyDialog(); - ArrayList<String> fList = new ArrayList<String>(); - - fList.add("test1"); - fList.add("test2"); - fList.add("test3"); - - aDialog.setFilesList(fList); - boolean value = aDialog.ask(); - System.exit(0); - } - - static class DependencyTableModel extends AbstractTableModel { - - ArrayList filesList = null; - - ArrayList<String> returnList = null; - - public void setFilesList(ArrayList filesList) { - this.filesList = filesList; - this.returnList = new ArrayList<String>(); - - for (int i = 0; i < filesList.size(); i++) { - returnList.add(""); - } - } - - public int getColumnCount() { - // TODO Auto-generated method stub - return 2; - } - - public int getRowCount() { - return (filesList == null) ? 0 : filesList.size(); - } - - public Object getValueAt(int rowIndex, int columnIndex) { - if (columnIndex == 0) { - return filesList.get(rowIndex); - } - - return returnList.get(rowIndex); - - } - - // public boolean isCellEditable(int rowIndex, int columnIndex) { - // return columnIndex == 1; - // } - - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - if (columnIndex != 1) { - return; - } - - returnList.set(rowIndex, (String)aValue); - fireTableCellUpdated(rowIndex, columnIndex); - } - - public String getColumnName(int column) { - if (column == 0) { - return "Original File"; - } - return "New File"; - } - - public HashMap getFilesMap() { - HashMap filesMap = new HashMap(); - - for (int i = 0; i < filesList.size(); i++) { - String key = (String) filesList.get(i); - String val = (String) returnList.get(i); - - if (!key.equals(val) && !val.equals("") && val != null) { - filesMap.put(key, val); - } - } - - return filesMap; - } - - } -} Deleted: blue/trunk/blue-ui-core/src/blue/SplashScreen.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/SplashScreen.java 2010-03-27 03:08:56 UTC (rev 4187) +++ blue/trunk/blue-ui-core/src/blue/SplashScreen.java 2010-03-28 02:55:08 UTC (rev 4188) @@ -1,209 +0,0 @@ -/* - * blue - object composition environment for csound - * Copyright (c) 2001-2003 Steven Yi (ste...@gm...) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307 USA - */ - -package blue; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.Toolkit; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JWindow; -import javax.swing.SwingConstants; -import javax.swing.border.Border; - -/** - * Title: blue (Object Composition Environment) Description: Copyright: - * Copyright (c) steven yi Company: steven yi music - * - * @author steven yi - * @version 0.3 - */ - -public final class SplashScreen extends JWindow { - JPanel jPanel1 = new JPanel(); - - GridLayout gridLayout1 = new GridLayout(); - - JPanel mainPanel = new JPanel(); - - String infoText = "<html>... a music composition environment for Csound<br>" - + "Version: " - + BlueConstants.getVersion() - + "<br>" - + "Copyright (c) 2000-2006 Steven Yi<br>" - + "email: ste...@gm...<br>" - + "web: http://www.csounds.com/stevenyi/blue</html>"; - - JLabel mainLabel = new JLabel(infoText); - - JLabel title1 = new JLabel("blue"); - - boolean clickClose = false; - - public SplashScreen(JFrame parent) { - super(parent); - try { - jbInit(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void remove() { - dispose(); - } - - public SplashScreen() { - try { - jbInit(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void jbInit() throws Exception { - title1.setForeground(Color.BLACK); - mainLabel.setForeground(Color.BLACK); - this.setBackground(Color.BLACK); - - this.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - if (clickClose) { - dispose(); - } - } - }); - - mainPanel.setDoubleBuffered(true); - Border border2 = BorderFactory.createCompoundBorder(BorderFactory - .createLineBorder(new Color(198, 226, 255), 2), BorderFactory - .createEmptyBorder(20, 20, 20, 20)); - - mainPanel.setLayout(new BorderLayout()); - - title1.setHorizontalAlignment(SwingConstants.LEFT); - title1.setAlignmentX((float) 1.0); - title1.setFont(new java.awt.Font("Dialog", 0, 48)); - - this.getContentPane().add(mainPanel, BorderLayout.CENTER); - mainPanel.setBorder(border2); - - mainPanel.add(title1, BorderLayout.NORTH); - mainPanel.add(mainLabel, BorderLayout.SOUTH); - - // mainPanel.setPreferredSize(new Dimension(400, 175)); - pack(); - Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((screenDim.width - getSize().width) / 2, - (screenDim.height - getSize().height) / 2); - } - - public void show() { - super.show(); - new Thread(new ColorChanger(mainPanel, this)).start(); - } - - public static void main(String args[]) { - SplashScreen s = new SplashScreen(); - s.addWindowListener(new WindowAdapter() { - - public void windowClosed(WindowEvent e) { - System.exit(0); - } - - }); - s.show(); - } -} - -class ColorChanger implements Runnable { - Color fgColor = new Color(198, 226, 255); - - Color bgcolor = new Color(1, 40, 74); - - int r1 = 198; - - int g1 = 226; - - int b1 = 255; - - int r2 = 1; - - int g2 = 40; - - int b2 = 74; - - JComponent jc; - - SplashScreen sc; - - int time; - - public ColorChanger(JComponent jc, SplashScreen sc) { - this.jc = jc; - this.sc = sc; - } - - public void run() { - jc.setForeground(Color.black); - float x; - int loopLength = 40; - for (int i = 0; i < loopLength; i++) { - x = i; - x = x / loopLength; - - int fr = (int) (r1 * x); - int fg = (int) (g1 * x); - int fb = (int) (b1 * x); - - Component[] c = jc.getComponents(); - - Color fgColor = new Color(fr, fg, fb); - for (int j = 0; j < c.length; j++) { - c[j].setForeground(fgColor); - } - - int br = (int) (r2 * x); - int bg = (int) (g2 * x); - int bb = (int) (b2 * x); - - jc.setBackground(new Color(br, bg, bb)); - - jc.paintImmediately(jc.getBounds()); - try { - Thread.sleep(50); - } catch (Exception e) { - } - } - sc.clickClose = true; - } -} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-27 03:09:04
|
Revision: 4187 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4187&view=rev Author: kunstmusik Date: 2010-03-27 03:08:56 +0000 (Sat, 27 Mar 2010) Log Message: ----------- removed older MIDI classes and created new blue-midi module Modified Paths: -------------- blue/trunk/blue-core/nbproject/project.xml blue/trunk/blue-ui-core/nbproject/project.xml blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveTopComponent.form blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveTopComponent.java blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/Bundle.properties blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/ScoPadReceiver.java blue/trunk/nbproject/project.properties Added Paths: ----------- blue/trunk/blue-midi/ blue/trunk/blue-midi/build.xml blue/trunk/blue-midi/manifest.mf blue/trunk/blue-midi/nbproject/ blue/trunk/blue-midi/nbproject/build-impl.xml blue/trunk/blue-midi/nbproject/genfiles.properties blue/trunk/blue-midi/nbproject/project.properties blue/trunk/blue-midi/nbproject/project.xml blue/trunk/blue-midi/nbproject/suite.properties blue/trunk/blue-midi/src/ blue/trunk/blue-midi/src/blue/ blue/trunk/blue-midi/src/blue/midi/ blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java blue/trunk/blue-midi/src/blue/midi/Bundle.properties blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java blue/trunk/blue-midi/src/blue/midi/MidiOptionsPanelController.java blue/trunk/blue-midi/src/blue/midi/MidiPanel.form blue/trunk/blue-midi/src/blue/midi/MidiPanel.java blue/trunk/blue-midi/src/blue/midi/layer.xml blue/trunk/blue-midi/test/ blue/trunk/blue-midi/test/unit/ blue/trunk/blue-midi/test/unit/src/ Modified: blue/trunk/blue-core/nbproject/project.xml =================================================================== --- blue/trunk/blue-core/nbproject/project.xml 2010-03-27 03:08:37 UTC (rev 4186) +++ blue/trunk/blue-core/nbproject/project.xml 2010-03-27 03:08:56 UTC (rev 4187) @@ -7,6 +7,14 @@ <suite-component/> <module-dependencies> <dependency> + <code-name-base>blue.midi</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>1.0</specification-version> + </run-dependency> + </dependency> + <dependency> <code-name-base>blue.utilities</code-name-base> <build-prerequisite/> <compile-dependency/> Property changes on: blue/trunk/blue-midi ___________________________________________________________________ Added: svn:ignore + build Added: blue/trunk/blue-midi/build.xml =================================================================== --- blue/trunk/blue-midi/build.xml (rev 0) +++ blue/trunk/blue-midi/build.xml 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- You may freely edit this file. See harness/README in the NetBeans platform --> +<!-- for some information on what you could do (e.g. targets to override). --> +<!-- If you delete this file and reopen the project it will be recreated. --> +<project name="blue.midi" default="netbeans" basedir="."> + <description>Builds, tests, and runs the project blue.midi.</description> + <import file="nbproject/build-impl.xml"/> +</project> Added: blue/trunk/blue-midi/manifest.mf =================================================================== --- blue/trunk/blue-midi/manifest.mf (rev 0) +++ blue/trunk/blue-midi/manifest.mf 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +OpenIDE-Module: blue.midi +OpenIDE-Module-Layer: blue/midi/layer.xml +OpenIDE-Module-Localizing-Bundle: blue/midi/Bundle.properties +OpenIDE-Module-Specification-Version: 1.0 + Added: blue/trunk/blue-midi/nbproject/build-impl.xml =================================================================== --- blue/trunk/blue-midi/nbproject/build-impl.xml (rev 0) +++ blue/trunk/blue-midi/nbproject/build-impl.xml 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +*** GENERATED FROM project.xml - DO NOT EDIT *** +*** EDIT ../build.xml INSTEAD *** +--> +<project name="blue.midi-impl" basedir=".."> + <fail message="Please build using Ant 1.7.1 or higher."> + <condition> + <not> + <antversion atleast="1.7.1"/> + </not> + </condition> + </fail> + <property file="nbproject/private/suite-private.properties"/> + <property file="nbproject/suite.properties"/> + <fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail> + <property file="${suite.dir}/nbproject/private/platform-private.properties"/> + <property file="${suite.dir}/nbproject/platform.properties"/> + <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="${@{value}}"/> + </sequential> + </macrodef> + <macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2"> + <attribute name="property"/> + <attribute name="value"/> + <sequential> + <property name="@{property}" value="@{value}"/> + </sequential> + </macrodef> + <property file="${user.properties.file}"/> + <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> + <nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> + <nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> + <fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness)."> + <condition> + <not> + <contains string="${cluster.path.evaluated}" substring="platform"/> + </not> + </condition> + </fail> + <import file="${harness.dir}/build.xml"/> +</project> Added: blue/trunk/blue-midi/nbproject/genfiles.properties =================================================================== --- blue/trunk/blue-midi/nbproject/genfiles.properties (rev 0) +++ blue/trunk/blue-midi/nbproject/genfiles.properties 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,8 @@ +build.xml.data.CRC32=354b3c2b +build.xml.script.CRC32=413025f8 +build.xml.stylesheet.CRC32=79c3b980@1.31.1.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=354b3c2b +nbproject/build-impl.xml.script.CRC32=2465577f +nbproject/build-impl.xml.stylesheet.CRC32=261c4bef@1.31.1.7 Added: blue/trunk/blue-midi/nbproject/project.properties =================================================================== --- blue/trunk/blue-midi/nbproject/project.properties (rev 0) +++ blue/trunk/blue-midi/nbproject/project.properties 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,2 @@ +javac.source=1.5 +javac.compilerargs=-Xlint -Xlint:-serial Added: blue/trunk/blue-midi/nbproject/project.xml =================================================================== --- blue/trunk/blue-midi/nbproject/project.xml (rev 0) +++ blue/trunk/blue-midi/nbproject/project.xml 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.apisupport.project</type> + <configuration> + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3"> + <code-name-base>blue.midi</code-name-base> + <suite-component/> + <module-dependencies> + <dependency> + <code-name-base>org.jdesktop.layout</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.10.1.103</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.netbeans.modules.options.api</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <release-version>1</release-version> + <specification-version>1.16.2</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.awt</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.19.1.1</specification-version> + </run-dependency> + </dependency> + <dependency> + <code-name-base>org.openide.util</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>7.31.2.1</specification-version> + </run-dependency> + </dependency> + </module-dependencies> + <public-packages> + <package>blue.midi</package> + </public-packages> + </data> + </configuration> +</project> Added: blue/trunk/blue-midi/nbproject/suite.properties =================================================================== --- blue/trunk/blue-midi/nbproject/suite.properties (rev 0) +++ blue/trunk/blue-midi/nbproject/suite.properties 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1 @@ +suite.dir=${basedir}/.. Added: blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java (rev 0) +++ blue/trunk/blue-midi/src/blue/midi/BlueMidiDevice.java 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,99 @@ +/* + * blue - object composition environment for csound + * Copyright (c) 2000-2010 Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307 USA + */ + +package blue.midi; + +import javax.sound.midi.MidiDevice; +import javax.sound.midi.MidiSystem; +import javax.sound.midi.MidiUnavailableException; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +public class BlueMidiDevice { + + private MidiDevice.Info info = null; + + private MidiDevice input = null; + + ChangeListener cl = null; + + ChangeEvent e; + + public BlueMidiDevice(MidiDevice.Info info) { + this.info = info; + e = new ChangeEvent(this); + } + + public MidiDevice.Info getDeviceInfo() { + return info; + } + + protected void setMidiDevice(MidiDevice input) { + this.input = input; + } + + protected MidiDevice getMidiDevice() { + return this.input; + } + + public void open() throws MidiUnavailableException { + + if (input != null && input.isOpen()) { + return; + } + + try { + input = MidiSystem.getMidiDevice(info); + input.open(); + } catch (MidiUnavailableException ex) { + input = null; + throw ex; + } + + cl.stateChanged(e); + } + + public boolean isEnabled() { + return input != null && input.isOpen(); + } + + public void close() { + if (input != null) { + input.close(); + } + input = null; + + if(cl != null) { + cl.stateChanged(e); + } + } + + public String toString() { + if (info != null) { + return info.getName(); + } + return "Error"; + } + + public void setChangeListener(ChangeListener cl) { + this.cl = cl; + } + +} Added: blue/trunk/blue-midi/src/blue/midi/Bundle.properties =================================================================== --- blue/trunk/blue-midi/src/blue/midi/Bundle.properties (rev 0) +++ blue/trunk/blue-midi/src/blue/midi/Bundle.properties 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,3 @@ +AdvancedOption_DisplayName_Midi=MIDI +AdvancedOption_Keywords_Midi=MIDI +OpenIDE-Module-Name=blue-midi Added: blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java (rev 0) +++ blue/trunk/blue-midi/src/blue/midi/MidiInputManager.java 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,140 @@ +/* + * blue - object composition environment for csound + * Copyright (c) 2000-2006 Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307 USA + */ +package blue.midi; + +import java.util.Iterator; +import java.util.Vector; + +import javax.sound.midi.MidiDevice; +import javax.sound.midi.MidiMessage; +import javax.sound.midi.MidiSystem; +import javax.sound.midi.MidiUnavailableException; +import javax.sound.midi.Receiver; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.openide.util.Exceptions; + +/** + * Manages MIDI Input Device, single device at a time, notifies listeners when + * state has changed. Listeners should check if device has changed as well as if + * device is open. + * + * @author steven + */ +public class MidiInputManager implements Receiver, ChangeListener { + + private static MidiInputManager instance = null; + + private Vector listeners = null; + + private Vector receivers = null; + + private ChangeEvent changeEvent = null; + + Vector<BlueMidiDevice> items = null; + + /** Creates a new instance of MidiInputManager */ + private MidiInputManager() { + } + + public static MidiInputManager getInstance() { + if (instance == null) { + instance = new MidiInputManager(); + } + return instance; + } + + public void rescan() { + MidiDevice.Info[] info; + info = MidiSystem.getMidiDeviceInfo(); + + Vector<BlueMidiDevice> items = new Vector<BlueMidiDevice>(); + + for (int i = 0; i < info.length; i++) { + try { + // System.err.println(MidiSystem.getMidiDevice(info[i]).getMaxTransmitters()); + + if (MidiSystem.getMidiDevice(info[i]).getMaxTransmitters() != 0) { + final BlueMidiDevice blueMidiDevice = new BlueMidiDevice(info[i]); + blueMidiDevice.setChangeListener(this); + items.add(blueMidiDevice); + } + + } catch (MidiUnavailableException ex) { + ex.printStackTrace(); + } + } + + this.items = items; + } + + public Vector<BlueMidiDevice> getInputDeviceOptions() { + if (items == null) { + rescan(); + } + return items; + } + + /* BROADCAST MIDI TO RECEIVERS */ + public void addReceiver(Receiver receiver) { + if (receivers == null) { + receivers = new Vector(); + } + receivers.add(receiver); + } + + public void removeReceiver(Receiver receiver) { + if (receivers != null) { + receivers.remove(receiver); + } + } + + private void broadcastMessage(MidiMessage message, long timeStamp) { + if (receivers != null) { + Iterator iter = new Vector(receivers).iterator(); + + while (iter.hasNext()) { + Receiver receiver = (Receiver) iter.next(); + receiver.send(message, timeStamp); + } + } + } + + /* CHANGE LISTENER CODE */ + public void stateChanged(ChangeEvent e) { + BlueMidiDevice device = (BlueMidiDevice) e.getSource(); + + if (device.isEnabled()) { + try { + device.getMidiDevice().getTransmitter().setReceiver(this); + } catch (MidiUnavailableException ex) { + Exceptions.printStackTrace(ex); + } + } + } + + /* RECEIVER METHODS */ + public void send(MidiMessage message, long timeStamp) { + broadcastMessage(message, timeStamp); + } + + public void close() { + } +} Added: blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java (rev 0) +++ blue/trunk/blue-midi/src/blue/midi/MidiInputTableModel.java 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,92 @@ +/* + * blue - object composition environment for csound + * Copyright (c) 2000-2010 Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307 USA + */ +package blue.midi; + +import java.util.Vector; +import javax.sound.midi.MidiUnavailableException; +import javax.swing.table.AbstractTableModel; +import org.openide.util.Exceptions; + +/** + * + * @author Steven + */ +public class MidiInputTableModel extends AbstractTableModel { + + private final Vector<BlueMidiDevice> devices; + + public MidiInputTableModel() { + devices = MidiInputManager.getInstance().getInputDeviceOptions(); + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public String getColumnName(int column) { + return (column == 0) ? "Open" : "Device Name"; + } + + @Override + public int getRowCount() { + return devices.size(); + } + + @Override + public Object getValueAt(int row, int column) { + BlueMidiDevice device = devices.get(row); + + if (column == 0) { + return device.isEnabled(); + } + return device.toString(); + } + + @Override + public boolean isCellEditable(int row, int column) { + return (column == 0); + } + + @Override + public void setValueAt(Object aValue, int row, int column) { + if (column == 0) { + BlueMidiDevice device = devices.get(row); + boolean open = ((Boolean) aValue).booleanValue(); + + if (open) { + try { + device.open(); + } catch (MidiUnavailableException ex) { + Exceptions.printStackTrace(ex); + } + } else { + device.close(); + } + } + fireTableCellUpdated(row, column); + } + + @Override + public Class<?> getColumnClass(int columnIndex) { + return (columnIndex == 0) ? Boolean.class : String.class; + } +} Added: blue/trunk/blue-midi/src/blue/midi/MidiOptionsPanelController.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiOptionsPanelController.java (rev 0) +++ blue/trunk/blue-midi/src/blue/midi/MidiOptionsPanelController.java 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,95 @@ +/* + * blue - object composition environment for csound + * Copyright (c) 2000-2010 Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307 USA + */ + +package blue.midi; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import javax.swing.JComponent; +import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; + +@OptionsPanelController.SubRegistration(location = "BlueOptionsCategory", +displayName = "#AdvancedOption_DisplayName_Midi", +keywords = "#AdvancedOption_Keywords_Midi", +keywordsCategory = "BlueOptionsCategory/Midi", +position=800) +public final class MidiOptionsPanelController extends OptionsPanelController { + + private MidiPanel panel; + + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + private boolean changed; + + public void update() { + getPanel().load(); + changed = false; + } + + public void applyChanges() { + getPanel().store(); + changed = false; + } + + public void cancel() { + // need not do anything special, if no changes have been persisted yet + } + + public boolean isValid() { + return getPanel().valid(); + } + + public boolean isChanged() { + return changed; + } + + public HelpCtx getHelpCtx() { + return null; // new HelpCtx("...ID") if you have a help set + } + + public JComponent getComponent(Lookup masterLookup) { + return getPanel(); + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + pcs.addPropertyChangeListener(l); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + pcs.removePropertyChangeListener(l); + } + + private MidiPanel getPanel() { + if (panel == null) { + panel = new MidiPanel(this); + } + return panel; + } + + void changed() { + if (!changed) { + changed = true; + pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); + } + pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); + } +} Added: blue/trunk/blue-midi/src/blue/midi/MidiPanel.form =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiPanel.form (rev 0) +++ blue/trunk/blue-midi/src/blue/midi/MidiPanel.form 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jScrollPane1" pref="256" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jScrollPane1" pref="100" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTable" name="jTable1"> + <Properties> + <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> + <Table columnCount="4" rowCount="4"> + <Column editable="true" title="Title 1" type="java.lang.Object"/> + <Column editable="true" title="Title 2" type="java.lang.Object"/> + <Column editable="true" title="Title 3" type="java.lang.Object"/> + <Column editable="true" title="Title 4" type="java.lang.Object"/> + </Table> + </Property> + </Properties> + </Component> + </SubComponents> + </Container> + </SubComponents> +</Form> Added: blue/trunk/blue-midi/src/blue/midi/MidiPanel.java =================================================================== --- blue/trunk/blue-midi/src/blue/midi/MidiPanel.java (rev 0) +++ blue/trunk/blue-midi/src/blue/midi/MidiPanel.java 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,106 @@ +/* + * blue - object composition environment for csound + * Copyright (c) 2000-2010 Steven Yi (ste...@gm...) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307 USA + */ +package blue.midi; + +final class MidiPanel extends javax.swing.JPanel { + + private final MidiOptionsPanelController controller; + + MidiPanel(MidiOptionsPanelController controller) { + this.controller = controller; + initComponents(); + + jTable1.setModel(new MidiInputTableModel()); + jTable1.getTableHeader().setReorderingAllowed(false); + jTable1.getColumnModel().getColumn(0).setMaxWidth(60); + // TODO listen to changes in form fields and call controller.changed() + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jScrollPane1 = new javax.swing.JScrollPane(); + jTable1 = new javax.swing.JTable(); + + jTable1.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null}, + {null, null, null, null} + }, + new String [] { + "Title 1", "Title 2", "Title 3", "Title 4" + } + )); + jScrollPane1.setViewportView(jTable1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE) + .addContainerGap()) + ); + }// </editor-fold>//GEN-END:initComponents + + void load() { + // TODO read settings and initialize GUI + // Example: + // someCheckBox.setSelected(Preferences.userNodeForPackage(MidiPanel.class).getBoolean("someFlag", false)); + // or for org.openide.util with API spec. version >= 7.4: + // someCheckBox.setSelected(NbPreferences.forModule(MidiPanel.class).getBoolean("someFlag", false)); + // or: + // someTextField.setText(SomeSystemOption.getDefault().getSomeStringProperty()); + } + + void store() { + // TODO store modified settings + // Example: + // Preferences.userNodeForPackage(MidiPanel.class).putBoolean("someFlag", someCheckBox.isSelected()); + // or for org.openide.util with API spec. version >= 7.4: + // NbPreferences.forModule(MidiPanel.class).putBoolean("someFlag", someCheckBox.isSelected()); + // or: + // SomeSystemOption.getDefault().setSomeStringProperty(someTextField.getText()); + } + + boolean valid() { + // TODO check whether form is consistent and complete + return true; + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTable jTable1; + // End of variables declaration//GEN-END:variables +} Added: blue/trunk/blue-midi/src/blue/midi/layer.xml =================================================================== --- blue/trunk/blue-midi/src/blue/midi/layer.xml (rev 0) +++ blue/trunk/blue-midi/src/blue/midi/layer.xml 2010-03-27 03:08:56 UTC (rev 4187) @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd"> +<filesystem> +</filesystem> Modified: blue/trunk/blue-ui-core/nbproject/project.xml =================================================================== --- blue/trunk/blue-ui-core/nbproject/project.xml 2010-03-27 03:08:37 UTC (rev 4186) +++ blue/trunk/blue-ui-core/nbproject/project.xml 2010-03-27 03:08:56 UTC (rev 4187) @@ -7,6 +7,14 @@ <suite-component/> <module-dependencies> <dependency> + <code-name-base>blue.midi</code-name-base> + <build-prerequisite/> + <compile-dependency/> + <run-dependency> + <specification-version>1.0</specification-version> + </run-dependency> + </dependency> + <dependency> <code-name-base>blue.plaf</code-name-base> <build-prerequisite/> <compile-dependency/> Modified: blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveTopComponent.form =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveTopComponent.form 2010-03-27 03:08:37 UTC (rev 4186) +++ blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveTopComponent.form 2010-03-27 03:08:56 UTC (rev 4187) @@ -18,144 +18,22 @@ <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jTabbedPane1" alignment="0" pref="526" max="32767" attributes="0"/> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="midiInputLabel" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="enableAdvancedFlags" alignment="0" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <Component id="midiInputComboBox" pref="266" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="rescanButton1" pref="84" max="32767" attributes="1"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="midiOpenButton" min="-2" max="-2" attributes="1"/> - </Group> - <Group type="102" attributes="0"> - <Component id="commandLineText" pref="314" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="completeOverride" min="-2" max="-2" attributes="0"/> - </Group> - </Group> - </Group> - </Group> - <EmptySpace min="-2" max="-2" attributes="0"/> + <Component id="jTabbedPane1" pref="526" max="32767" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="enableAdvancedFlags" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="commandLineText" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="completeOverride" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="midiInputLabel" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="midiInputComboBox" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - </Group> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="29" max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="midiOpenButton" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="rescanButton1" alignment="3" min="-2" max="-2" attributes="0"/> - </Group> - </Group> - </Group> + <Component id="jTabbedPane1" pref="402" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/> - <Component id="jTabbedPane1" pref="344" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> </Layout> <SubComponents> - <Component class="javax.swing.JCheckBox" name="completeOverride"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="blue/ui/core/blueLive/Bundle.properties" key="BlueLiveTopComponent.completeOverride.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> - <EmptyBorder bottom="0" left="0" right="0" top="0"/> - </Border> - </Property> - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor"> - <Insets value="[0, 0, 0, 0]"/> - </Property> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="completeOverrideActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JTextField" name="commandLineText"> - </Component> - <Component class="javax.swing.JCheckBox" name="enableAdvancedFlags"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="blue/ui/core/blueLive/Bundle.properties" key="BlueLiveTopComponent.enableAdvancedFlags.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> - <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> - <EmptyBorder bottom="0" left="0" right="0" top="0"/> - </Border> - </Property> - <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor"> - <Insets value="[0, 0, 0, 0]"/> - </Property> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="enableAdvancedFlagsActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JToggleButton" name="midiOpenButton"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="blue/ui/core/blueLive/Bundle.properties" key="BlueLiveTopComponent.midiOpenButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="midiOpenButtonActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JLabel" name="midiInputLabel"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="blue/ui/core/blueLive/Bundle.properties" key="BlueLiveTopComponent.midiInputLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JComboBox" name="midiInputComboBox"> - <Properties> - <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> - <StringArray count="4"> - <StringItem index="0" value="Item 1"/> - <StringItem index="1" value="Item 2"/> - <StringItem index="2" value="Item 3"/> - <StringItem index="3" value="Item 4"/> - </StringArray> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JButton" name="rescanButton1"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="blue/ui/core/blueLive/Bundle.properties" key="BlueLiveTopComponent.rescanButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rescanButton1ActionPerformed"/> - </Events> - </Component> <Container class="javax.swing.JTabbedPane" name="jTabbedPane1"> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/> @@ -203,7 +81,7 @@ <Component id="pushDownButton" alignment="3" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> - <Component id="jScrollPane1" pref="268" max="32767" attributes="0"/> + <Component id="jScrollPane1" pref="326" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/> </Group> </Group> @@ -338,7 +216,7 @@ <EmptySpace max="-2" attributes="0"/> <Component id="jLabel3" min="-2" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> - <Component id="jScrollPane2" pref="225" max="32767" attributes="0"/> + <Component id="jScrollPane2" pref="283" max="32767" attributes="0"/> <EmptySpace max="-2" attributes="0"/> </Group> </Group> @@ -419,6 +297,88 @@ </Component> </SubComponents> </Container> + <Container class="javax.swing.JPanel" name="jPanel1"> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription"> + <JTabbedPaneConstraints tabName="Options"> + <Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/blueLive/Bundle.properties" key="BlueLiveTopComponent.jPanel1.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </JTabbedPaneConstraints> + </Constraint> + </Constraints> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="enableAdvancedFlags" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="completeOverride" min="-2" max="-2" attributes="0"/> + <Component id="commandLineText" pref="402" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="enableAdvancedFlags" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="commandLineText" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Component id="completeOverride" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="325" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JCheckBox" name="completeOverride"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/blueLive/Bundle.properties" key="BlueLiveTopComponent.completeOverride.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> + <EmptyBorder bottom="0" left="0" right="0" top="0"/> + </Border> + </Property> + <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor"> + <Insets value="[0, 0, 0, 0]"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="completeOverrideActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JTextField" name="commandLineText"> + </Component> + <Component class="javax.swing.JCheckBox" name="enableAdvancedFlags"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/blueLive/Bundle.properties" key="BlueLiveTopComponent.enableAdvancedFlags.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> + <EmptyBorder bottom="0" left="0" right="0" top="0"/> + </Border> + </Property> + <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor"> + <Insets value="[0, 0, 0, 0]"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="enableAdvancedFlagsActionPerformed"/> + </Events> + </Component> + </SubComponents> + </Container> </SubComponents> </Container> </SubComponents> Modified: blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveTopComponent.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveTopComponent.java 2010-03-27 03:08:37 UTC (rev 4186) +++ blue/trunk/blue-ui-core/src/blue/ui/core/blueLive/BlueLiveTopComponent.java 2010-03-27 03:08:56 UTC (rev 4187) @@ -27,27 +27,19 @@ import blue.LiveData; import blue.Tables; import blue.blueLive.LiveObject; -import blue.event.PlayModeListener; import blue.event.SelectionEvent; import blue.event.SimpleDocumentListener; import blue.gui.ExceptionDialog; -import blue.midi.MidiInputManager; +import blue.midi.*; import blue.projects.BlueProject; import blue.projects.BlueProjectManager; -import blue.settings.GeneralSettings; import blue.soundObject.SoundObject; import blue.soundObject.SoundObjectException; -import blue.ui.core.render.APIRunner; -import blue.ui.core.render.CSDRunner; -import blue.ui.core.render.CommandlineRunner; import blue.ui.core.score.SoundObjectBuffer; import blue.ui.core.score.SoundObjectSelectionBus; -import blue.utility.APIUtilities; import blue.utility.ObjectUtilities; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -55,12 +47,9 @@ import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.HashMap; -import java.util.Vector; import java.util.logging.Logger; import javax.sound.midi.MidiMessage; -import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Receiver; -import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JMenuItem; import javax.swing.JOptionPane; @@ -69,8 +58,6 @@ import javax.swing.ListSelectionModel; import javax.swing.SpinnerNumberModel; import javax.swing.SwingUtilities; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -202,15 +189,6 @@ midiManager = MidiInputManager.getInstance(); - midiManager.addChangeListener(new ChangeListener() { - - public void stateChanged(ChangeEvent e) { - if (midiOpenButton.isSelected() != midiManager.isMidiDeviceOpen()) { - midiOpenButton.setSelected(midiManager.isMidiDeviceOpen()); - } - } - }); - // receiver for live space tab midiManager.addReceiver(new Receiver() { @@ -227,8 +205,6 @@ // receiver for SCO pad tab midiManager.addReceiver(scoPadReceiver); - rescanMidiInputDrivers(); - startSpinner.setModel(new SpinnerNumberModel(0.0, 0.0, Double.POSITIVE_INFINITY, 1.0)); quarterNoteSpinner.setModel(new SpinnerNumberModel(1.0, 0.0, @@ -292,13 +268,6 @@ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { - completeOverride = new javax.swing.JCheckBox(); - commandLineText = new javax.swing.JTextField(); - enableAdvancedFlags = new javax.swing.JCheckBox(); - midiOpenButton = new javax.swing.JToggleButton(); - midiInputLabel = new javax.swing.JLabel(); - midiInputComboBox = new javax.swing.JComboBox(); - rescanButton1 = new javax.swing.JButton(); jTabbedPane1 = new javax.swing.JTabbedPane(); liveSpacePanel = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); @@ -319,43 +288,11 @@ quarterNoteSpinner = new javax.swing.JSpinner(); jLabel5 = new javax.swing.JLabel(); instrIdText = new javax.swing.JTextField(); + jPanel1 = new javax.swing.JPanel(); + completeOverride = new javax.swing.JCheckBox(); + commandLineText = new javax.swing.JTextField(); + enableAdvancedFlags = new javax.swing.JCheckBox(); - org.openide.awt.Mnemonics.setLocalizedText(completeOverride, org.openide.util.NbBundle.getMessage(BlueLiveTopComponent.class, "BlueLiveTopComponent.completeOverride.text")); // NOI18N - completeOverride.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); - completeOverride.setMargin(new java.awt.Insets(0, 0, 0, 0)); - completeOverride.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - completeOverrideActionPerformed(evt); - } - }); - - org.openide.awt.Mnemonics.setLocalizedText(enableAdvancedFlags, org.openide.util.NbBundle.getMessage(BlueLiveTopComponent.class, "BlueLiveTopComponent.enableAdvancedFlags.text")); // NOI18N - enableAdvancedFlags.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); - enableAdvancedFlags.setMargin(new java.awt.Insets(0, 0, 0, 0)); - enableAdvancedFlags.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - enableAdvancedFlagsActionPerformed(evt); - } - }); - - org.openide.awt.Mnemonics.setLocalizedText(midiOpenButton, org.openide.util.NbBundle.getMessage(BlueLiveTopComponent.class, "BlueLiveTopComponent.midiOpenButton.text")); // NOI18N - midiOpenButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - midiOpenButtonActionPerformed(evt); - } - }); - - org.openide.awt.Mnemonics.setLocalizedText(midiInputLabel, org.openide.util.NbBundle.getMessage(BlueLiveTopComponent.class, "BlueLiveTopComponent.midiInputLabel.text")); // NOI18N - - midiInputComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); - - org.openide.awt.Mnemonics.setLocalizedText(rescanButton1, org.openide.util.NbBundle.getMessage(BlueLiveTopComponent.class, "BlueLiveTopComponent.rescanButton1.text")); // NOI18N - rescanButton1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - rescanButton1ActionPerformed(evt); - } - }); - liveObjectsTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, @@ -425,7 +362,7 @@ .add(pushUpBUtton) .add(pushDownButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE) + .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE) .addContainerGap()) ); @@ -506,59 +443,71 @@ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jLabel3) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE) + .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE) .addContainerGap()) ); jTabbedPane1.addTab(org.openide.util.NbBundle.getMessage(BlueLiveTopComponent.class, "BlueLiveTopComponent.scoPadPanel.TabConstraints.tabTitle"), scoPadPanel); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(completeOverride, org.openide.util.NbBundle.getMessage(BlueLiveTopComponent.class, "BlueLiveTopComponent.completeOverride.text")); // NOI18N + completeOverride.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); + completeOverride.setMargin(new java.awt.Insets(0, 0, 0, 0)); + completeOverride.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + completeOverrideActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(enableAdvancedFlags, org.openide.util.NbBundle.getMessage(BlueLiveTopComponent.class, "BlueLiveTopComponent.enableAdvancedFlags.text")); // NOI18N + enableAdvancedFlags.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); + enableAdvancedFlags.setMargin(new java.awt.Insets(0, 0, 0, 0)); + enableAdvancedFlags.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + enableAdvancedFlagsActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .add(enableAdvancedFlags) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(completeOverride) + .add(commandLineText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)) + ... [truncated message content] |
From: <kun...@us...> - 2010-03-27 03:08:43
|
Revision: 4186 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4186&view=rev Author: kunstmusik Date: 2010-03-27 03:08:37 +0000 (Sat, 27 Mar 2010) Log Message: ----------- removed older MIDI classes and created new blue-midi module Removed Paths: ------------- blue/trunk/blue-core/src/blue/midi/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-27 03:07:43
|
Revision: 4185 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4185&view=rev Author: kunstmusik Date: 2010-03-27 03:07:37 +0000 (Sat, 27 Mar 2010) Log Message: ----------- removed unnecessary casts Modified Paths: -------------- blue/trunk/blue-core/src/blue/InstrumentLibrary.java Modified: blue/trunk/blue-core/src/blue/InstrumentLibrary.java =================================================================== --- blue/trunk/blue-core/src/blue/InstrumentLibrary.java 2010-03-27 03:05:00 UTC (rev 4184) +++ blue/trunk/blue-core/src/blue/InstrumentLibrary.java 2010-03-27 03:07:37 UTC (rev 4185) @@ -288,25 +288,25 @@ private void fireNodesChanged(TreeModelEvent e) { for (int i = 0; i < listeners.size(); i++) { - ((TreeModelListener) listeners.get(i)).treeNodesChanged(e); + listeners.get(i).treeNodesChanged(e); } } private void fireNodesInserted(TreeModelEvent e) { for (int i = 0; i < listeners.size(); i++) { - ((TreeModelListener) listeners.get(i)).treeNodesInserted(e); + listeners.get(i).treeNodesInserted(e); } } private void fireNodesRemoved(TreeModelEvent e) { for (int i = 0; i < listeners.size(); i++) { - ((TreeModelListener) listeners.get(i)).treeNodesRemoved(e); + listeners.get(i).treeNodesRemoved(e); } } private void fireTreeStructureChanged(TreeModelEvent e) { for (int i = 0; i < listeners.size(); i++) { - ((TreeModelListener) listeners.get(i)).treeStructureChanged(e); + listeners.get(i).treeStructureChanged(e); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kun...@us...> - 2010-03-27 03:05:12
|
Revision: 4184 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4184&view=rev Author: kunstmusik Date: 2010-03-27 03:05:00 +0000 (Sat, 27 Mar 2010) Log Message: ----------- commented out older clone tests and removed from other test suites to get tests building Modified Paths: -------------- blue/trunk/blue-core/test/unit/src/blue/noteProcessor/CloneTest.java blue/trunk/blue-core/test/unit/src/blue/noteProcessor/NoteProcessorTests.java blue/trunk/blue-core/test/unit/src/blue/orchestra/CloneTest.java blue/trunk/blue-core/test/unit/src/blue/orchestra/InstrumentTests.java blue/trunk/blue-core/test/unit/src/blue/soundObject/CloneTest.java blue/trunk/blue-core/test/unit/src/blue/soundObject/SoundObjectTests.java Modified: blue/trunk/blue-core/test/unit/src/blue/noteProcessor/CloneTest.java =================================================================== --- blue/trunk/blue-core/test/unit/src/blue/noteProcessor/CloneTest.java 2010-03-23 04:36:35 UTC (rev 4183) +++ blue/trunk/blue-core/test/unit/src/blue/noteProcessor/CloneTest.java 2010-03-27 03:05:00 UTC (rev 4184) @@ -1,190 +1,190 @@ -/* - * blue - object composition environment for csound - * Copyright (c) 2000-2004 Steven Yi (ste...@gm...) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307 USA - */ - -package blue.noteProcessor; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import junit.framework.TestCase; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -import blue.BlueSystem; -import blue.utility.ObjectUtilities; -import electric.xml.Element; - -/** - * @author Steven Yi - */ -public class CloneTest extends TestCase { - - public void testSerialize() { - Class[] noteProcessors = BlueSystem.getNoteProcessorClasses(); - - for (int i = 0; i < noteProcessors.length; i++) { - Class class1 = noteProcessors[i]; - NoteProcessor np = null; - - try { - np = (NoteProcessor) class1.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - assertNotNull(np); - - if (np == null) { - continue; - } - - Object obj = ObjectUtilities.clone(np); - assertNotNull(obj); - } - - } - - public void testClone() { - Class[] noteProcessors = BlueSystem.getNoteProcessorClasses(); - - for (int i = 0; i < noteProcessors.length; i++) { - Class class1 = noteProcessors[i]; - NoteProcessor np = null; - - try { - np = (NoteProcessor) class1.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - assertNotNull(np); - - if (np == null) { - continue; - } - - NoteProcessor clone = (NoteProcessor) ObjectUtilities.clone(np); - - boolean isEqual = EqualsBuilder.reflectionEquals(np, clone); - - if (!isEqual) { - StringBuffer buffer = new StringBuffer(); - buffer.append("Problem with class: " + class1.getName() + "\n"); - buffer.append("Original Object\n"); - buffer.append(ToStringBuilder.reflectionToString(np) + "\n"); - buffer.append("Cloned Object\n"); - buffer.append(ToStringBuilder.reflectionToString(clone) + "\n"); - - System.out.println(buffer.toString()); - - } - - assertTrue(isEqual); - - Element elem1 = np.saveAsXML(); - - Element elem2 = (clone).saveAsXML(); - - assertEquals(elem1.getTextString(), elem2.getTextString()); - } - - } - - public void testLoadSave() { - Class[] noteProcessors = BlueSystem.getNoteProcessorClasses(); - - for (int i = 0; i < noteProcessors.length; i++) { - Class class1 = noteProcessors[i]; - NoteProcessor np = null; - - try { - np = (NoteProcessor) class1.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - assertNotNull(np); - - if (np == null) { - continue; - } - - Element elem1 = np.saveAsXML(); - - Method m = null; - try { - m = class1.getMethod("loadFromXML", - new Class[] { Element.class }); - } catch (SecurityException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (NoSuchMethodException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - NoteProcessor np2 = null; - - assertNotNull(m); - if (m == null) { - continue; - } - - try { - np2 = (NoteProcessor) m.invoke(np, new Object[] { elem1 }); - } catch (IllegalArgumentException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (IllegalAccessException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (InvocationTargetException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - - boolean isEqual = EqualsBuilder.reflectionEquals(np, np2); - - if (!isEqual) { - StringBuffer buffer = new StringBuffer(); - buffer.append("Problem with class: " + class1.getName() + "\n"); - buffer.append("Original Object\n"); - buffer.append(ToStringBuilder.reflectionToString(np) + "\n"); - buffer.append("Cloned Object\n"); - buffer.append(ToStringBuilder.reflectionToString(np2) + "\n"); - - System.out.println(buffer.toString()); - - } - - assertTrue(isEqual); - - } - - } - -} \ No newline at end of file +///* +// * blue - object composition environment for csound +// * Copyright (c) 2000-2004 Steven Yi (ste...@gm...) +// * +// * This program is free software; you can redistribute it and/or modify +// * it under the terms of the GNU General Public License as published +// * by the Free Software Foundation; either version 2 of the License or +// * (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, but +// * WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU General Public License +// * along with this program; see the file COPYING.LIB. If not, write to +// * the Free Software Foundation Inc., 59 Temple Place - Suite 330, +// * Boston, MA 02111-1307 USA +// */ +// +//package blue.noteProcessor; +// +//import java.lang.reflect.InvocationTargetException; +//import java.lang.reflect.Method; +// +//import junit.framework.TestCase; +// +//import org.apache.commons.lang.builder.EqualsBuilder; +//import org.apache.commons.lang.builder.ToStringBuilder; +// +//import blue.BlueSystem; +//import blue.utility.ObjectUtilities; +//import electric.xml.Element; +// +///** +// * @author Steven Yi +// */ +//public class CloneTest extends TestCase { +// +// public void testSerialize() { +// Class[] noteProcessors = BlueSystem.getNoteProcessorClasses(); +// +// for (int i = 0; i < noteProcessors.length; i++) { +// Class class1 = noteProcessors[i]; +// NoteProcessor np = null; +// +// try { +// np = (NoteProcessor) class1.newInstance(); +// } catch (InstantiationException e) { +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// e.printStackTrace(); +// } +// +// assertNotNull(np); +// +// if (np == null) { +// continue; +// } +// +// Object obj = ObjectUtilities.clone(np); +// assertNotNull(obj); +// } +// +// } +// +// public void testClone() { +// Class[] noteProcessors = BlueSystem.getNoteProcessorClasses(); +// +// for (int i = 0; i < noteProcessors.length; i++) { +// Class class1 = noteProcessors[i]; +// NoteProcessor np = null; +// +// try { +// np = (NoteProcessor) class1.newInstance(); +// } catch (InstantiationException e) { +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// e.printStackTrace(); +// } +// +// assertNotNull(np); +// +// if (np == null) { +// continue; +// } +// +// NoteProcessor clone = (NoteProcessor) ObjectUtilities.clone(np); +// +// boolean isEqual = EqualsBuilder.reflectionEquals(np, clone); +// +// if (!isEqual) { +// StringBuffer buffer = new StringBuffer(); +// buffer.append("Problem with class: " + class1.getName() + "\n"); +// buffer.append("Original Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(np) + "\n"); +// buffer.append("Cloned Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(clone) + "\n"); +// +// System.out.println(buffer.toString()); +// +// } +// +// assertTrue(isEqual); +// +// Element elem1 = np.saveAsXML(); +// +// Element elem2 = (clone).saveAsXML(); +// +// assertEquals(elem1.getTextString(), elem2.getTextString()); +// } +// +// } +// +// public void testLoadSave() { +// Class[] noteProcessors = BlueSystem.getNoteProcessorClasses(); +// +// for (int i = 0; i < noteProcessors.length; i++) { +// Class class1 = noteProcessors[i]; +// NoteProcessor np = null; +// +// try { +// np = (NoteProcessor) class1.newInstance(); +// } catch (InstantiationException e) { +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// e.printStackTrace(); +// } +// +// assertNotNull(np); +// +// if (np == null) { +// continue; +// } +// +// Element elem1 = np.saveAsXML(); +// +// Method m = null; +// try { +// m = class1.getMethod("loadFromXML", +// new Class[] { Element.class }); +// } catch (SecurityException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } catch (NoSuchMethodException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// +// NoteProcessor np2 = null; +// +// assertNotNull(m); +// if (m == null) { +// continue; +// } +// +// try { +// np2 = (NoteProcessor) m.invoke(np, new Object[] { elem1 }); +// } catch (IllegalArgumentException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } catch (IllegalAccessException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } catch (InvocationTargetException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// +// boolean isEqual = EqualsBuilder.reflectionEquals(np, np2); +// +// if (!isEqual) { +// StringBuffer buffer = new StringBuffer(); +// buffer.append("Problem with class: " + class1.getName() + "\n"); +// buffer.append("Original Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(np) + "\n"); +// buffer.append("Cloned Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(np2) + "\n"); +// +// System.out.println(buffer.toString()); +// +// } +// +// assertTrue(isEqual); +// +// } +// +// } +// +//} \ No newline at end of file Modified: blue/trunk/blue-core/test/unit/src/blue/noteProcessor/NoteProcessorTests.java =================================================================== --- blue/trunk/blue-core/test/unit/src/blue/noteProcessor/NoteProcessorTests.java 2010-03-23 04:36:35 UTC (rev 4183) +++ blue/trunk/blue-core/test/unit/src/blue/noteProcessor/NoteProcessorTests.java 2010-03-27 03:05:00 UTC (rev 4184) @@ -33,7 +33,7 @@ TestSuite suite = new TestSuite("Test for blue.noteProcessor"); // $JUnit-BEGIN$ suite.addTestSuite(AddProcessorTest.class); - suite.addTestSuite(CloneTest.class); +// suite.addTestSuite(CloneTest.class); // $JUnit-END$ return suite; } Modified: blue/trunk/blue-core/test/unit/src/blue/orchestra/CloneTest.java =================================================================== --- blue/trunk/blue-core/test/unit/src/blue/orchestra/CloneTest.java 2010-03-23 04:36:35 UTC (rev 4183) +++ blue/trunk/blue-core/test/unit/src/blue/orchestra/CloneTest.java 2010-03-27 03:05:00 UTC (rev 4184) @@ -1,191 +1,191 @@ -/* - * blue - object composition environment for csound - * Copyright (c) 2000-2004 Steven Yi (ste...@gm...) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307 USA - */ - -package blue.orchestra; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import junit.framework.TestCase; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -import blue.BlueSystem; -import blue.utility.ObjectUtilities; -import electric.xml.Element; - -/** - * @author Steven Yi - */ -public class CloneTest extends TestCase { - - public void testSerialize() { - Class[] instruments = BlueSystem.getInstrumentClasses(); - - for (int i = 0; i < instruments.length; i++) { - Class class1 = instruments[i]; - Instrument instr = null; - - try { - instr = (Instrument) class1.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - assertNotNull(instr); - - if (instr == null) { - continue; - } - - Object obj = ObjectUtilities.clone(instr); - assertNotNull(obj); - } - - } - - public void testClone() { - Class[] instruments = BlueSystem.getInstrumentClasses(); - - for (int i = 0; i < instruments.length; i++) { - Class class1 = instruments[i]; - Instrument instr = null; - - try { - instr = (Instrument) class1.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - assertNotNull(instr); - - if (instr == null) { - continue; - } - - Instrument clone = (Instrument) ObjectUtilities.clone(instr); - - boolean isEqual = EqualsBuilder.reflectionEquals(instr, clone); - - if (!isEqual) { - StringBuffer buffer = new StringBuffer(); - buffer.append("Problem with class: " + class1.getName() + "\n"); - buffer.append("Original Object\n"); - buffer.append(ToStringBuilder.reflectionToString(instr) + "\n"); - buffer.append("Cloned Object\n"); - buffer.append(ToStringBuilder.reflectionToString(clone) + "\n"); - - System.out.println(buffer.toString()); - - } - - assertTrue(isEqual); - - Element elem1 = instr.saveAsXML(); - - Element elem2 = (clone).saveAsXML(); - - assertEquals(elem1.getTextString(), elem2.getTextString()); - } - - } - - public void testLoadSave() { - Class[] instruments = BlueSystem.getInstrumentClasses(); - - for (int i = 0; i < instruments.length; i++) { - Class class1 = instruments[i]; - Instrument instr = null; - - try { - instr = (Instrument) class1.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - assertNotNull(instr); - - if (instr == null) { - continue; - } - - Element elem1 = instr.saveAsXML(); - - Method m = null; - try { - m = class1.getMethod("loadFromXML", - new Class[] { Element.class }); - } catch (SecurityException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (NoSuchMethodException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - Instrument instr2 = null; - - assertNotNull(m); - if (m == null) { - continue; - } - - try { - instr2 = (Instrument) m.invoke(instr, new Object[] { elem1 }); - } catch (IllegalArgumentException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (IllegalAccessException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (InvocationTargetException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - - boolean isEqual = EqualsBuilder.reflectionEquals(instr, instr2); - - if (!isEqual) { - StringBuffer buffer = new StringBuffer(); - buffer.append("Problem with class: " + class1.getName() + "\n"); - buffer.append("Original Object\n"); - buffer.append(ToStringBuilder.reflectionToString(instr) + "\n"); - buffer.append("Cloned Object\n"); - buffer - .append(ToStringBuilder.reflectionToString(instr2) - + "\n"); - - System.out.println(buffer.toString()); - - } - - assertTrue(isEqual); - - } - - } -} \ No newline at end of file +///* +// * blue - object composition environment for csound +// * Copyright (c) 2000-2004 Steven Yi (ste...@gm...) +// * +// * This program is free software; you can redistribute it and/or modify +// * it under the terms of the GNU General Public License as published +// * by the Free Software Foundation; either version 2 of the License or +// * (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, but +// * WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU General Public License +// * along with this program; see the file COPYING.LIB. If not, write to +// * the Free Software Foundation Inc., 59 Temple Place - Suite 330, +// * Boston, MA 02111-1307 USA +// */ +// +//package blue.orchestra; +// +//import java.lang.reflect.InvocationTargetException; +//import java.lang.reflect.Method; +// +//import junit.framework.TestCase; +// +//import org.apache.commons.lang.builder.EqualsBuilder; +//import org.apache.commons.lang.builder.ToStringBuilder; +// +//import blue.BlueSystem; +//import blue.utility.ObjectUtilities; +//import electric.xml.Element; +// +///** +// * @author Steven Yi +// */ +//public class CloneTest extends TestCase { +// +// public void testSerialize() { +// Class[] instruments = BlueSystem.getInstrumentClasses(); +// +// for (int i = 0; i < instruments.length; i++) { +// Class class1 = instruments[i]; +// Instrument instr = null; +// +// try { +// instr = (Instrument) class1.newInstance(); +// } catch (InstantiationException e) { +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// e.printStackTrace(); +// } +// +// assertNotNull(instr); +// +// if (instr == null) { +// continue; +// } +// +// Object obj = ObjectUtilities.clone(instr); +// assertNotNull(obj); +// } +// +// } +// +// public void testClone() { +// Class[] instruments = BlueSystem.getInstrumentClasses(); +// +// for (int i = 0; i < instruments.length; i++) { +// Class class1 = instruments[i]; +// Instrument instr = null; +// +// try { +// instr = (Instrument) class1.newInstance(); +// } catch (InstantiationException e) { +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// e.printStackTrace(); +// } +// +// assertNotNull(instr); +// +// if (instr == null) { +// continue; +// } +// +// Instrument clone = (Instrument) ObjectUtilities.clone(instr); +// +// boolean isEqual = EqualsBuilder.reflectionEquals(instr, clone); +// +// if (!isEqual) { +// StringBuffer buffer = new StringBuffer(); +// buffer.append("Problem with class: " + class1.getName() + "\n"); +// buffer.append("Original Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(instr) + "\n"); +// buffer.append("Cloned Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(clone) + "\n"); +// +// System.out.println(buffer.toString()); +// +// } +// +// assertTrue(isEqual); +// +// Element elem1 = instr.saveAsXML(); +// +// Element elem2 = (clone).saveAsXML(); +// +// assertEquals(elem1.getTextString(), elem2.getTextString()); +// } +// +// } +// +// public void testLoadSave() { +// Class[] instruments = BlueSystem.getInstrumentClasses(); +// +// for (int i = 0; i < instruments.length; i++) { +// Class class1 = instruments[i]; +// Instrument instr = null; +// +// try { +// instr = (Instrument) class1.newInstance(); +// } catch (InstantiationException e) { +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// e.printStackTrace(); +// } +// +// assertNotNull(instr); +// +// if (instr == null) { +// continue; +// } +// +// Element elem1 = instr.saveAsXML(); +// +// Method m = null; +// try { +// m = class1.getMethod("loadFromXML", +// new Class[] { Element.class }); +// } catch (SecurityException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } catch (NoSuchMethodException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// +// Instrument instr2 = null; +// +// assertNotNull(m); +// if (m == null) { +// continue; +// } +// +// try { +// instr2 = (Instrument) m.invoke(instr, new Object[] { elem1 }); +// } catch (IllegalArgumentException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } catch (IllegalAccessException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } catch (InvocationTargetException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// +// boolean isEqual = EqualsBuilder.reflectionEquals(instr, instr2); +// +// if (!isEqual) { +// StringBuffer buffer = new StringBuffer(); +// buffer.append("Problem with class: " + class1.getName() + "\n"); +// buffer.append("Original Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(instr) + "\n"); +// buffer.append("Cloned Object\n"); +// buffer +// .append(ToStringBuilder.reflectionToString(instr2) +// + "\n"); +// +// System.out.println(buffer.toString()); +// +// } +// +// assertTrue(isEqual); +// +// } +// +// } +//} \ No newline at end of file Modified: blue/trunk/blue-core/test/unit/src/blue/orchestra/InstrumentTests.java =================================================================== --- blue/trunk/blue-core/test/unit/src/blue/orchestra/InstrumentTests.java 2010-03-23 04:36:35 UTC (rev 4183) +++ blue/trunk/blue-core/test/unit/src/blue/orchestra/InstrumentTests.java 2010-03-27 03:05:00 UTC (rev 4184) @@ -34,7 +34,7 @@ public static Test suite() { TestSuite suite = new TestSuite("Test for blue.orchestra"); // $JUnit-BEGIN$ - suite.addTestSuite(CloneTest.class); +// suite.addTestSuite(CloneTest.class); suite.addTestSuite(BSBCloneTest.class); suite.addTestSuite(BSBGraphicInterfaceTest.class); // $JUnit-END$ Modified: blue/trunk/blue-core/test/unit/src/blue/soundObject/CloneTest.java =================================================================== --- blue/trunk/blue-core/test/unit/src/blue/soundObject/CloneTest.java 2010-03-23 04:36:35 UTC (rev 4183) +++ blue/trunk/blue-core/test/unit/src/blue/soundObject/CloneTest.java 2010-03-27 03:05:00 UTC (rev 4184) @@ -1,275 +1,275 @@ -/* - * blue - object composition environment for csound - * Copyright (c) 2000-2004 Steven Yi (ste...@gm...) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING.LIB. If not, write to - * the Free Software Foundation Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307 USA - */ - -package blue.soundObject; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; - -import junit.framework.TestCase; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -import blue.BlueSystem; -import blue.SoundObjectLibrary; -import blue.soundObject.tracker.Track; -import blue.soundObject.tracker.TrackerNote; -import blue.utility.ObjectUtilities; -import electric.xml.Element; - -/** - * TODO - These tests need to randomly set values of objects to know if - * deserialization is really happening correctly - * - * @author Steven Yi - */ -public class CloneTest extends TestCase { - - ArrayList soundObjects = new ArrayList(); - - protected void setUp() throws Exception { - super.setUp(); - - Class[] soundObjClasses = BlueSystem.getSoundObjectClasses(); - - for (int i = 0; i < soundObjClasses.length; i++) { - Class class1 = soundObjClasses[i]; - SoundObject sObj = null; - - try { - sObj = (SoundObject) class1.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - /* EXTRA INITIALIZATION */ - if (sObj instanceof TrackerObject) { - TrackerObject tracker = (TrackerObject) sObj; - Track tr = new Track(); - - tracker.getTracks().addTrack(tr); - - TrackerNote tn = tr.getTrackerNote(0); - - tn.setTied(true); - tn.setValue(1, "8.00"); - tn.setValue(2, "80"); - - } - - soundObjects.add(sObj); - } - } - - protected void tearDown() throws Exception { - super.tearDown(); - - soundObjects.clear(); - soundObjects = null; - } - - public void testSerialize() { - - for (int i = 0; i < soundObjects.size(); i++) { - SoundObject sObj = (SoundObject) soundObjects.get(i); - - assertNotNull(sObj); - - if (sObj == null) { - continue; - } - - Object obj = ObjectUtilities.clone(sObj); - assertNotNull(obj); - } - - } - - public void testClone() { - SoundObjectLibrary sObjLib = new SoundObjectLibrary(); - - for (int i = 0; i < soundObjects.size(); i++) { - SoundObject sObj = (SoundObject) soundObjects.get(i); - - assertNotNull(sObj); - - if (sObj == null) { - continue; - } - - // Method[] methods = sObj.getClass().getDeclaredMethods(); - // - // for (int j = 0; j < methods.length; j++) { - // Method method = methods[j]; - // - // method.get - // } - - SoundObject clone = (SoundObject) sObj.clone(); - - boolean isEqual = EqualsBuilder.reflectionEquals(sObj, clone); - - if (!isEqual) { - StringBuffer buffer = new StringBuffer(); - buffer.append("Problem with class: ").append( - sObj.getClass().getName()).append("\n"); - buffer.append("Original Object\n"); - buffer.append(ToStringBuilder.reflectionToString(sObj)).append( - "\n"); - buffer.append("Cloned Object\n"); - if (clone == null) { - buffer.append("[null]\n"); - } else { - buffer.append(ToStringBuilder.reflectionToString(clone)) - .append("\n"); - } - - System.out.println(buffer.toString()); - - } - - assertTrue(isEqual); - - Element elem1 = sObj.saveAsXML(sObjLib); - - Element elem2 = (clone).saveAsXML(sObjLib); - - assertEquals(elem1.getTextString(), elem2.getTextString()); - } - - } - - public void testCloneWithRepetition() { - SoundObjectLibrary sObjLib = new SoundObjectLibrary(); - - for (int i = 0; i < soundObjects.size(); i++) { - SoundObject sObj = (SoundObject) soundObjects.get(i); - - assertNotNull(sObj); - - if (sObj == null) { - continue; - } - - if (sObj.getTimeBehavior() != SoundObject.TIME_BEHAVIOR_NOT_SUPPORTED) { - sObj.setTimeBehavior(SoundObject.TIME_BEHAVIOR_REPEAT); - sObj.setRepeatPoint(2.0f); - } else { - continue; - } - - SoundObject sObjClone = (SoundObject) sObj.clone(); - - Element elem1 = sObj.saveAsXML(sObjLib); - Element elem2 = sObjClone.saveAsXML(sObjLib); - - assertEquals(elem1.getTextString(), elem2.getTextString()); - assertTrue(sObj.getRepeatPoint() == sObjClone.getRepeatPoint()); - } - - } - - public void testLoadSave() { - for (int i = 0; i < soundObjects.size(); i++) { - SoundObject sObj = (SoundObject) soundObjects.get(i); - - assertNotNull(sObj); - - if (sObj == null) { - continue; - } - - SoundObjectLibrary sObjLib = new SoundObjectLibrary(); - - Element elem1 = sObj.saveAsXML(sObjLib); - - Method m = null; - try { - m = sObj.getClass() - .getMethod( - "loadFromXML", - new Class[] { Element.class, - SoundObjectLibrary.class }); - } catch (SecurityException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (NoSuchMethodException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - SoundObject sObj2 = null; - - assertNotNull(m); - if (m == null) { - continue; - } - - try { - sObj2 = (SoundObject) m.invoke(sObj, new Object[] { elem1, - sObjLib }); - } catch (IllegalArgumentException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (IllegalAccessException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } catch (InvocationTargetException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - - boolean isEqual = EqualsBuilder.reflectionEquals(sObj, sObj2); - - if (!isEqual) { - StringBuffer buffer = new StringBuffer(); - buffer.append("Problem with class: ").append( - sObj.getClass().getName()).append("\n"); - buffer.append("Original Object\n"); - buffer.append(ToStringBuilder.reflectionToString(sObj)).append( - "\n"); - - Element sObjXML = sObj.saveAsXML(new SoundObjectLibrary()); - Element sObjXML2 = sObj2.saveAsXML(new SoundObjectLibrary()); - - buffer.append("Cloned Object\n"); - buffer.append(ToStringBuilder.reflectionToString(sObj2)) - .append("\n"); - - System.out.println(buffer.toString()); - - if (!sObjXML.toString().equals(sObjXML2.toString())) { - System.out.println("XML String Unequal\n"); - buffer.append(sObjXML); - buffer.append(sObjXML2); - } - } - - assertTrue(isEqual); - - } - - } - -} \ No newline at end of file +///* +// * blue - object composition environment for csound +// * Copyright (c) 2000-2004 Steven Yi (ste...@gm...) +// * +// * This program is free software; you can redistribute it and/or modify +// * it under the terms of the GNU General Public License as published +// * by the Free Software Foundation; either version 2 of the License or +// * (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, but +// * WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU General Public License +// * along with this program; see the file COPYING.LIB. If not, write to +// * the Free Software Foundation Inc., 59 Temple Place - Suite 330, +// * Boston, MA 02111-1307 USA +// */ +// +//package blue.soundObject; +// +//import java.lang.reflect.InvocationTargetException; +//import java.lang.reflect.Method; +//import java.util.ArrayList; +// +//import junit.framework.TestCase; +// +//import org.apache.commons.lang.builder.EqualsBuilder; +//import org.apache.commons.lang.builder.ToStringBuilder; +// +//import blue.BlueSystem; +//import blue.SoundObjectLibrary; +//import blue.soundObject.tracker.Track; +//import blue.soundObject.tracker.TrackerNote; +//import blue.utility.ObjectUtilities; +//import electric.xml.Element; +// +///** +// * TODO - These tests need to randomly set values of objects to know if +// * deserialization is really happening correctly +// * +// * @author Steven Yi +// */ +//public class CloneTest extends TestCase { +// +// ArrayList soundObjects = new ArrayList(); +// +// protected void setUp() throws Exception { +// super.setUp(); +// +// Class[] soundObjClasses = BlueSystem.getSoundObjectClasses(); +// +// for (int i = 0; i < soundObjClasses.length; i++) { +// Class class1 = soundObjClasses[i]; +// SoundObject sObj = null; +// +// try { +// sObj = (SoundObject) class1.newInstance(); +// } catch (InstantiationException e) { +// e.printStackTrace(); +// } catch (IllegalAccessException e) { +// e.printStackTrace(); +// } +// +// /* EXTRA INITIALIZATION */ +// if (sObj instanceof TrackerObject) { +// TrackerObject tracker = (TrackerObject) sObj; +// Track tr = new Track(); +// +// tracker.getTracks().addTrack(tr); +// +// TrackerNote tn = tr.getTrackerNote(0); +// +// tn.setTied(true); +// tn.setValue(1, "8.00"); +// tn.setValue(2, "80"); +// +// } +// +// soundObjects.add(sObj); +// } +// } +// +// protected void tearDown() throws Exception { +// super.tearDown(); +// +// soundObjects.clear(); +// soundObjects = null; +// } +// +// public void testSerialize() { +// +// for (int i = 0; i < soundObjects.size(); i++) { +// SoundObject sObj = (SoundObject) soundObjects.get(i); +// +// assertNotNull(sObj); +// +// if (sObj == null) { +// continue; +// } +// +// Object obj = ObjectUtilities.clone(sObj); +// assertNotNull(obj); +// } +// +// } +// +// public void testClone() { +// SoundObjectLibrary sObjLib = new SoundObjectLibrary(); +// +// for (int i = 0; i < soundObjects.size(); i++) { +// SoundObject sObj = (SoundObject) soundObjects.get(i); +// +// assertNotNull(sObj); +// +// if (sObj == null) { +// continue; +// } +// +// // Method[] methods = sObj.getClass().getDeclaredMethods(); +// // +// // for (int j = 0; j < methods.length; j++) { +// // Method method = methods[j]; +// // +// // method.get +// // } +// +// SoundObject clone = (SoundObject) sObj.clone(); +// +// boolean isEqual = EqualsBuilder.reflectionEquals(sObj, clone); +// +// if (!isEqual) { +// StringBuffer buffer = new StringBuffer(); +// buffer.append("Problem with class: ").append( +// sObj.getClass().getName()).append("\n"); +// buffer.append("Original Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(sObj)).append( +// "\n"); +// buffer.append("Cloned Object\n"); +// if (clone == null) { +// buffer.append("[null]\n"); +// } else { +// buffer.append(ToStringBuilder.reflectionToString(clone)) +// .append("\n"); +// } +// +// System.out.println(buffer.toString()); +// +// } +// +// assertTrue(isEqual); +// +// Element elem1 = sObj.saveAsXML(sObjLib); +// +// Element elem2 = (clone).saveAsXML(sObjLib); +// +// assertEquals(elem1.getTextString(), elem2.getTextString()); +// } +// +// } +// +// public void testCloneWithRepetition() { +// SoundObjectLibrary sObjLib = new SoundObjectLibrary(); +// +// for (int i = 0; i < soundObjects.size(); i++) { +// SoundObject sObj = (SoundObject) soundObjects.get(i); +// +// assertNotNull(sObj); +// +// if (sObj == null) { +// continue; +// } +// +// if (sObj.getTimeBehavior() != SoundObject.TIME_BEHAVIOR_NOT_SUPPORTED) { +// sObj.setTimeBehavior(SoundObject.TIME_BEHAVIOR_REPEAT); +// sObj.setRepeatPoint(2.0f); +// } else { +// continue; +// } +// +// SoundObject sObjClone = (SoundObject) sObj.clone(); +// +// Element elem1 = sObj.saveAsXML(sObjLib); +// Element elem2 = sObjClone.saveAsXML(sObjLib); +// +// assertEquals(elem1.getTextString(), elem2.getTextString()); +// assertTrue(sObj.getRepeatPoint() == sObjClone.getRepeatPoint()); +// } +// +// } +// +// public void testLoadSave() { +// for (int i = 0; i < soundObjects.size(); i++) { +// SoundObject sObj = (SoundObject) soundObjects.get(i); +// +// assertNotNull(sObj); +// +// if (sObj == null) { +// continue; +// } +// +// SoundObjectLibrary sObjLib = new SoundObjectLibrary(); +// +// Element elem1 = sObj.saveAsXML(sObjLib); +// +// Method m = null; +// try { +// m = sObj.getClass() +// .getMethod( +// "loadFromXML", +// new Class[] { Element.class, +// SoundObjectLibrary.class }); +// } catch (SecurityException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } catch (NoSuchMethodException e1) { +// // TODO Auto-generated catch block +// e1.printStackTrace(); +// } +// +// SoundObject sObj2 = null; +// +// assertNotNull(m); +// if (m == null) { +// continue; +// } +// +// try { +// sObj2 = (SoundObject) m.invoke(sObj, new Object[] { elem1, +// sObjLib }); +// } catch (IllegalArgumentException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } catch (IllegalAccessException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } catch (InvocationTargetException e2) { +// // TODO Auto-generated catch block +// e2.printStackTrace(); +// } +// +// boolean isEqual = EqualsBuilder.reflectionEquals(sObj, sObj2); +// +// if (!isEqual) { +// StringBuffer buffer = new StringBuffer(); +// buffer.append("Problem with class: ").append( +// sObj.getClass().getName()).append("\n"); +// buffer.append("Original Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(sObj)).append( +// "\n"); +// +// Element sObjXML = sObj.saveAsXML(new SoundObjectLibrary()); +// Element sObjXML2 = sObj2.saveAsXML(new SoundObjectLibrary()); +// +// buffer.append("Cloned Object\n"); +// buffer.append(ToStringBuilder.reflectionToString(sObj2)) +// .append("\n"); +// +// System.out.println(buffer.toString()); +// +// if (!sObjXML.toString().equals(sObjXML2.toString())) { +// System.out.println("XML String Unequal\n"); +// buffer.append(sObjXML); +// buffer.append(sObjXML2); +// } +// } +// +// assertTrue(isEqual); +// +// } +// +// } +// +//} \ No newline at end of file Modified: blue/trunk/blue-core/test/unit/src/blue/soundObject/SoundObjectTests.java =================================================================== --- blue/trunk/blue-core/test/unit/src/blue/soundObject/SoundObjectTests.java 2010-03-23 04:36:35 UTC (rev 4183) +++ blue/trunk/blue-core/test/unit/src/blue/soundObject/SoundObjectTests.java 2010-03-27 03:05:00 UTC (rev 4184) @@ -38,7 +38,7 @@ // $JUnit-BEGIN$ suite.addTestSuite(InstanceTest.class); suite.addTestSuite(GenericScoreTest.class); - suite.addTestSuite(CloneTest.class); +// suite.addTestSuite(CloneTest.class); suite.addTestSuite(PatternObjectTest.class); suite.addTestSuite(TrackerObjectTest.class); suite.addTestSuite(ColumnTest.class); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |