Re: [cp-patches] Patch: FYI: fix SetOfIntegerSyntax
Tom Tromey wrote: Wolfgang == Wolfgang Baer [EMAIL PROTECTED] writes: Wolfgang So if you intend to work more on the javax.print package Wolfgang please contact me so we do not duplicate work. Nope, I'm not. I only did this since I ran across it while looking at japi. I'm sorry if I stepped on your toes here; I didn't know anybody was working in this area. You didn't stepped on my toes. I hadn't done anything in this class yet. But it showed me that its time to mention my intention to work on the javax.print packages. BTW, you can write mauve tests without assignment papers. Hint, hint :-) Yes, I know and I will do :-) Wolfgang ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] [RFC] XML - fix for XMLParser's URL problem
Robert Schuster wrote: here is probably a fix for PR classpath/24249 [0]. 2005-10-07 Robert Schuster [EMAIL PROTECTED] * gnu/xml/aelfred2/SAXDriver.java: (absolutize): Replaced URL.toString() with explicit calls to build a new URL. * gnu/xml/dom/ls/DomLSParser.java: (getInputSource): dito. Please have a deep long thought about this and tell me whether this is a valid fix. For me this solves the problem I formerly had, of course. cu Robert [0] - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24249 Index: gnu/xml/aelfred2/SAXDriver.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/aelfred2/SAXDriver.java,v retrieving revision 1.7 diff -u -r1.7 SAXDriver.java --- gnu/xml/aelfred2/SAXDriver.java 2 Jul 2005 20:32:15 - 1.7 +++ gnu/xml/aelfred2/SAXDriver.java 7 Oct 2005 02:39:21 - @@ -751,7 +751,14 @@ } else { -return new URL(new URL(baseURI), systemId).toString(); +URL url = new URL(new URL(baseURI), systemId); + +// Note: The following line contains a workaround for a specific behavior +// of the URL class where +// new URL(new URL(file:foo/baz.xml).toString()).getHost().equals(foo) +// would be true although it is technically wrong +// (foo is a part of the filename). +return url.getProtocol() + :// + url.getHost() + url.getFile(); } } catch (MalformedURLException e) Index: gnu/xml/dom/ls/DomLSParser.java === RCS file: /cvsroot/classpath/classpath/gnu/xml/dom/ls/DomLSParser.java,v retrieving revision 1.3 diff -u -r1.3 DomLSParser.java --- gnu/xml/dom/ls/DomLSParser.java 2 Jul 2005 20:32:16 - 1.3 +++ gnu/xml/dom/ls/DomLSParser.java 7 Oct 2005 02:39:21 - @@ -397,7 +397,13 @@ new File(baseFile, systemId).toURL(); } in = url.openStream(); -systemId = url.toString(); +// Note: The following line contains a workaround for a specific behavior +// of the URL class where +// new URL(new URL(file:foo/baz.xml).toString()).getHost().equals(foo) +// would be true although it is technically wrong +// (foo is a part of the filename). +systemId = url.getProtocol() + :// + url.getHost() + url.getFile(); + source = new InputSource(in); source.setSystemId(systemId); } -1 I think URL should be fixed to return the String it was constructed with in toString. Apart from anything else, where you say URL is correctly implemented, this is not the case. The formal syntax for file: URLs is file:// + host + / + path, possibly with a drive letter colon replaced by a pipe symbol and where host may be , e.g. file:///var/spool/mail/gubbins file://localhost/home/gubbins file:///C:/Program%20Files/Microsoft%20Internet%20Explorer file:///C|/Windows/system32 file://BILBO/C$/Windows/system32 corresponding to these system-specific filenames: /var/spool/mail/gubbins /home/gubbins C:\Program Files\Microsoft Internet Explorer C:\Windows\system32 \\BILBO\C$\Windows\system32 See RFC 1738, section 3.10 for the specification. In the case of bug #24249, the input string was file:foo/baz which should have caused a MalformedURLException according to RFC 1738, as is not a valid directory name. -- Chris Burdess ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: BorderFactory fixlet
The method createLineBorder(Color) used to return null. I fixed this by forwarding it to createLineBorder(Color, int) with a thickness of 1. 2005-10-07 Roman Kennke [EMAIL PROTECTED] * javax/swing/BorderFactory.java (createLineBorder(Color)): Forward call to createLineBorder(Color, int) with thickness of 1. /Roman Index: javax/swing/BorderFactory.java === RCS file: /cvsroot/classpath/classpath/javax/swing/BorderFactory.java,v retrieving revision 1.12 diff -u -r1.12 BorderFactory.java --- javax/swing/BorderFactory.java 26 Jul 2005 15:30:54 - 1.12 +++ javax/swing/BorderFactory.java 7 Oct 2005 10:25:29 - @@ -71,7 +71,7 @@ */ public static Border createLineBorder(Color color) { -return null; +return createLineBorder(color, 1); } /**___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: JComponent fixes
Hi, I fixed some things in JComponent. Most importantly I added some support for AncestorEvents. 2005-10-07 Roman Kennke [EMAIL PROTECTED] * javax/swing/JComponent.java (paint): Call paintBorder before paintChildren. (reshape): Fire AncestorEvent if position has changed. (fireAncestorMoved): New method. Fires AncestorEvents to this component and all of it's children. /Roman Index: javax/swing/JComponent.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v retrieving revision 1.64 diff -u -r1.64 JComponent.java --- javax/swing/JComponent.java 27 Sep 2005 14:03:25 - 1.64 +++ javax/swing/JComponent.java 7 Oct 2005 11:20:49 - @@ -1473,8 +1473,8 @@ if (g.getClip() == null) g.setClip(0, 0, getWidth(), getHeight()); paintComponent(g); -paintChildren(g); paintBorder(g); +paintChildren(g); } } @@ -2869,6 +2869,53 @@ */ public void reshape(int x, int y, int w, int h) { +int oldX = getX(); +int oldY = getY(); super.reshape(x, y, w, h); +// Notify AncestorListeners. +if (oldX != getX() || oldY != getY()) + fireAncestorEvent(this, AncestorEvent.ANCESTOR_MOVED); + } + + /** + * Fires an AncestorEvent to this component's and all of its child + * component's AncestorListeners. + * + * @param ancestor the component that triggered the event + * @param id the kind of ancestor event that should be fired + */ + void fireAncestorEvent(JComponent ancestor, int id) + { +// Fire event for registered ancestor listeners of this component. +AncestorListener[] listeners = getAncestorListeners(); +if (listeners.length 0) + { +AncestorEvent ev = new AncestorEvent(this, id, + ancestor, ancestor.getParent()); +for (int i = 0; i listeners.length; i++) + { +switch (id) + { + case AncestorEvent.ANCESTOR_MOVED: +listeners[i].ancestorMoved(ev); +break; + case AncestorEvent.ANCESTOR_ADDED: +listeners[i].ancestorAdded(ev); +break; + case AncestorEvent.ANCESTOR_REMOVED: +listeners[i].ancestorRemoved(ev); +break; + } + } + } +// Dispatch event to all children. +Component[] children = getComponents(); +for (int i = 0; i children.length; i++) + { +if (!(children[i] instanceof JComponent)) + continue; +JComponent jc = (JComponent) children[i]; +jc.fireAncestorEvent(ancestor, id); + } } }___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] RFC: setting of TreeCellRenderer
This patch moves the setting of the TreeCellRenderer from JTree to its BasicTreeUI. This helps to set custom renderers in custom TreeUIs. Sun's JDKs seem to have the same behavior. I tested this with jamvm and gnu.classpath.examples.swing.Demo and it seems to work but there may be some side effects in applications which inherit from JTree and/or BasicTreeUI. 2005-10-07 Jan Roehrich [EMAIL PROTECTED] * javax/swing/JTree.java: (JTree): * javax/swing/plaf/basic/BasicTreeUI.java: (updateRenderer): moved setting of TreeCellRenderer from JTree to BasicTreeUI. Index: ChangeLog === RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.5143 diff -u -r1.5143 ChangeLog --- ChangeLog 6 Oct 2005 20:52:33 - 1.5143 +++ ChangeLog 6 Oct 2005 22:16:55 - @@ -1,3 +1,9 @@ +2005-10-07 Jan Roehrich [EMAIL PROTECTED] + + * javax/swing/JTree.java: (JTree): + * javax/swing/plaf/basic/BasicTreeUI.java: (updateRenderer): + moved setting of TreeCellRenderer from JTree to BasicTreeUI. + 2005-10-06 Anthony Balkissoon [EMAIL PROTECTED] * javax/swing/text/PlainView.java: Index: javax/swing/JTree.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JTree.java,v retrieving revision 1.44 diff -u -r1.44 JTree.java --- javax/swing/JTree.java 6 Oct 2005 19:26:30 - 1.44 +++ javax/swing/JTree.java 6 Oct 2005 22:17:15 - @@ -1479,9 +1479,8 @@ { updateUI(); setRootVisible(true); -setSelectionModel(EmptySelectionModel.sharedInstance()); -setCellRenderer(new DefaultTreeCellRenderer()); setModel(model); +setSelectionModel(EmptySelectionModel.sharedInstance()); } /** Index: javax/swing/plaf/basic/BasicTreeUI.java === RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v retrieving revision 1.88 diff -u -r1.88 BasicTreeUI.java --- javax/swing/plaf/basic/BasicTreeUI.java 6 Oct 2005 19:26:30 - 1.88 +++ javax/swing/plaf/basic/BasicTreeUI.java 6 Oct 2005 22:17:23 - @@ -1126,7 +1126,14 @@ protected void updateRenderer() { if (tree != null) - tree.setCellRenderer(currentCellRenderer); + { +if(tree.getCellRenderer() == null) + { +if(currentCellRenderer == null) + currentCellRenderer = createDefaultCellRenderer(); +tree.setCellRenderer(currentCellRenderer); + } + } } /** signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: IndexedPropertyDescriptor reformatted
In preparation of my additions to java.beans.IndexedPropertyDescriptor, I reformatted this awfully formatted class. 2005-10-07 Roman Kennke [EMAIL PROTECTED] * java/beans/IndexedPropertyDescriptor.java: Reformatted. /Roman Index: java/beans/IndexedPropertyDescriptor.java === RCS file: /cvsroot/classpath/classpath/java/beans/IndexedPropertyDescriptor.java,v retrieving revision 1.10 diff -u -r1.10 IndexedPropertyDescriptor.java --- java/beans/IndexedPropertyDescriptor.java 2 Jul 2005 20:32:37 - 1.10 +++ java/beans/IndexedPropertyDescriptor.java 7 Oct 2005 12:35:13 - @@ -1,4 +1,4 @@ -/* java.beans.IndexedPropertyDescriptor +/* IndexedPropertyDescriptor.java -- Copyright (C) 1998, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,266 +42,360 @@ import java.lang.reflect.Method; /** - ** IndexedPropertyDescriptor describes information about a JavaBean - ** indexed property, by which we mean an array-like property that - ** has been exposed via a pair of get and set methods and another - ** pair that allows you to get to the property by an index.P - ** - ** An example property would have four methods like this:P - ** CODEFooBar[] getFoo()/CODEBR - ** CODEvoid setFoo(FooBar[])/CODEBR - ** CODEFooBar getFoo(int)/CODEBR - ** CODEvoid setFoo(int,FooBar)/CODEP - ** - ** The constraints put on get and set methods are:P - ** OL - ** LIThere must be at least a get(int) or a set(int,...) method. - ** Nothing else is required. BSpec note:/BOne nice restriction - ** would be that if there is a get() there must be a get(int), same - ** with set, but that is not in the spec and is fairly harmless.)/LI - ** LIA get array method must have signature - ** CODElt;propertyTypegt;[] lt;getMethodNamegt;()/CODE/LI - ** LIA set array method must have signature - ** CODEvoid lt;setMethodNamegt;(lt;propertyTypegt;[])/CODE/LI - ** LIA get index method must have signature - ** CODElt;propertyTypegt; lt;getMethodNamegt;(int)/CODE/LI - ** LIA set index method must have signature - ** CODEvoid lt;setMethodNamegt;(int,lt;propertyTypegt;)/CODE/LI - ** LIAll these methods may throw any exception./LI - ** LIAll these methods must be public./LI - ** /OL - ** - ** @author John Keiser - ** @since JDK1.1 - ** @version 1.1.0, 26 Jul 1998 - **/ - -public class IndexedPropertyDescriptor extends PropertyDescriptor { - private Class indexedPropertyType; - private Method setIndex; - private Method getIndex; - - /** Create a new IndexedPropertyDescriptor by introspection. - ** This form of constructor creates the PropertyDescriptor by - ** looking for getter methods named CODEgetlt;namegt;()/CODE - ** and setter methods named - ** CODEsetlt;namegt;()/CODE in class - ** CODElt;beanClassgt;/CODE, where lt;namegt; has its - ** first letter capitalized by the constructor.P - ** - ** BImplementation note:/B If there is a get(int) method, - ** then the return type of that method is used to find the - ** remaining methods. If there is no get method, then the - ** set(int) method is searched for exhaustively and that type - ** is used to find the others.P - ** - ** BSpec note:/B - ** If there is no get(int) method and multiple set(int) methods with - ** the same name and the correct parameters (different type of course), - ** then an IntrospectionException is thrown. While Sun's spec - ** does not state this, it can make Bean behavior different on - ** different systems (since method order is not guaranteed) and as - ** such, can be treated as a bug in the spec. I am not aware of - ** whether Sun's implementation catches this. - ** - ** @param name the programmatic name of the property, usually - ** starting with a lowercase letter (e.g. fooManChu - ** instead of FooManChu). - ** @param beanClass the class the get and set methods live in. - ** @exception IntrospectionException if the methods are not found or invalid. - **/ - public IndexedPropertyDescriptor(String name, Class beanClass) throws IntrospectionException { - super(name); - String capitalized; - try { - capitalized = Character.toUpperCase(name.charAt(0)) + name.substring(1); - } catch(StringIndexOutOfBoundsException e) { - capitalized = ; - } - findMethods(beanClass, get + capitalized, set + capitalized, get + capitalized, set + capitalized); - } - - /** Create a new IndexedPropertyDescriptor by introspection. - ** This form of constructor allows you to specify the - ** names of the get and set methods to search for.P - ** - ** BImplementation note:/B If there is a get(int) method, - ** then the return type of that method is used to find the - ** remaining methods. If there is no get method, then the - ** set(int) method is searched for exhaustively and that type - ** is used to find the others.P - ** - ** BSpec note:/B - ** If there is no get(int) method and multiple set(int) methods
[cp-patches] FYI: IndexedPropertyDescriptor additions
I added two missing methods to java.beans.IndexedPropertyDescriptor: 2005-10-07 Roman Kennke [EMAIL PROTECTED] * java/beans/IndexedPropertyDescriptor.java (setIndexedReadMethod): New method. (setIndexedWriteMethod): New method. /Roman Index: java/beans/IndexedPropertyDescriptor.java === RCS file: /cvsroot/classpath/classpath/java/beans/IndexedPropertyDescriptor.java,v retrieving revision 1.11 diff -u -r1.11 IndexedPropertyDescriptor.java --- java/beans/IndexedPropertyDescriptor.java 7 Oct 2005 12:39:42 - 1.11 +++ java/beans/IndexedPropertyDescriptor.java 7 Oct 2005 12:47:01 - @@ -240,7 +240,7 @@ (getIndex.getDeclaringClass())) { throw new IntrospectionException(get and set index methods are - not in the same class.); + + not in the same class.); } } @@ -258,7 +258,7 @@ .getClass().equals(getMethod.getReturnType())) { throw new IntrospectionException(array methods do not match index - methods.); + + methods.); } this.getMethod = getMethod; @@ -282,9 +282,29 @@ return getIndex; } + /** + * Sets the method that is used to read an indexed property. + * + * @param m the method to set + */ + public void setIndexedReadMethod(Method m) + { +getIndex = m; + } + public Method getIndexedWriteMethod() { return setIndex; + } + + /** + * Sets the method that is used to write an indexed property. + * + * @param m the method to set + */ + public void setIndexedWriteMethod(Method m) + { +setIndex = m; } private void findMethods(Class beanClass, String getMethodName,___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: DSSI Soundbank support
This patch adds the start of Soundbank support to the DSSI provider, so you can query the list of Instruments provided by the soft-synth using the standard interfaces. I'm checking it in. AG 2005-10-07 Anthony Green [EMAIL PROTECTED] * gnu/javax/sound/midi/dssi/DSSISynthesizer.java Doc cleanups. (DSSISynthesizer.DSSISoundbank): New class. (DSSISynthesizer.DSSIInstrument): New class. (soundbanks, defaultSoundbank): New fields. (getDefaultSoundbank): Implemented. (getAvailableInstruments): Implemented. (getProgramName_, getProgramBank_, getProgramProgram_): New native methods. (DSSISynthesizer): Create default soundbank. * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1, Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1, Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1): New functions. * include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h: Rebuilt. Index: gnu/javax/sound/midi/dssi/DSSISynthesizer.java === RCS file: /cvsroot/classpath/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java,v retrieving revision 1.2 diff -u -r1.2 DSSISynthesizer.java --- gnu/javax/sound/midi/dssi/DSSISynthesizer.java 7 Oct 2005 03:21:06 - 1.2 +++ gnu/javax/sound/midi/dssi/DSSISynthesizer.java 7 Oct 2005 15:42:34 - @@ -38,6 +38,10 @@ package gnu.javax.sound.midi.dssi; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import javax.sound.midi.Instrument; import javax.sound.midi.MidiChannel; import javax.sound.midi.MidiMessage; @@ -46,6 +50,7 @@ import javax.sound.midi.Receiver; import javax.sound.midi.ShortMessage; import javax.sound.midi.Soundbank; +import javax.sound.midi.SoundbankResource; import javax.sound.midi.Synthesizer; import javax.sound.midi.Transmitter; import javax.sound.midi.VoiceStatus; @@ -54,13 +59,131 @@ import javax.sound.midi.MidiDevice.Info; /** - * @author green + * DSSI soft-synth support. + * + * All DSSI soft-synths are expected to be installed in /usr/lib/dssi. + * + * @author Anthony Green ([EMAIL PROTECTED]) * */ public class DSSISynthesizer implements Synthesizer { /** - * @author green + * The DSSI Instrument class. + * + * @author Anthony Green ([EMAIL PROTECTED]) + * + */ + class DSSIInstrument extends Instrument + { +DSSIInstrument (Soundbank soundbank, Patch patch, String name) +{ + super (soundbank, patch, name, null); +} + +/* @see javax.sound.midi.SoundbankResource#getData() + */ +public Object getData() +{ + return null; +} + + } + +/** + * DSSISoundbank holds all instruments. + * + * @author Anthony Green ([EMAIL PROTECTED]) + * + */ + class DSSISoundbank implements Soundbank + { +private String name; +private String description; +private List instruments = new ArrayList(); +private List resources = new ArrayList(); +private String vendor; +private String version; + +public DSSISoundbank(String name, String description, String vendor, String version) +{ + this.name = name; + this.description = description; + this.vendor = vendor; + this.version = version; +} + +void add(Instrument instrument) +{ + instruments.add(instrument); +} + +/* @see javax.sound.midi.Soundbank#getName() + */ +public String getName() +{ + return name; +} + +/* @see javax.sound.midi.Soundbank#getVersion() + */ +public String getVersion() +{ + return version; +} + +/* @see javax.sound.midi.Soundbank#getVendor() + */ +public String getVendor() +{ + return vendor; +} + +/* @see javax.sound.midi.Soundbank#getDescription() + */ +public String getDescription() +{ + return description; +} + +/* @see javax.sound.midi.Soundbank#getResources() + */ +public SoundbankResource[] getResources() +{ + return (SoundbankResource[]) +resources.toArray(new SoundbankResource[resources.size()]); +} + +/* @see javax.sound.midi.Soundbank#getInstruments() + */ +public Instrument[] getInstruments() +{ + return (Instrument[]) +instruments.toArray(new Instrument[instruments.size()]); +} + +/* @see javax.sound.midi.Soundbank#getInstrument(javax.sound.midi.Patch) + */ +public Instrument getInstrument(Patch patch) +{ + Iterator itr = instruments.iterator(); + + while (itr.hasNext()) + { +Instrument i = (Instrument) itr.next(); +if (i.getPatch().equals(patch)) + return i; + } + + return null; +} + } + +/** + * The Receiver class receives all MIDI
[cp-patches] FYI: fix deadlock in GtkChoicePeer
Hi, Anthony's MIDI demo exposed a deadlock in the GTK peers. This patch fixes it by making sure that the selection callback doesn't call back into the peers again. Tom 2005-10-07 Thomas Fitzsimmons [EMAIL PROTECTED] * gnu/java/awt/peer/gtk/GtkChoicePeer.java (postChoiceItemEvent): Don't call select on the AWT Choice component. * java/awt/Choice.java (processItemEvent): Set the selected index without calling into the peers. Index: gnu/java/awt/peer/gtk/GtkChoicePeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java,v retrieving revision 1.24 diff -u -r1.24 GtkChoicePeer.java --- gnu/java/awt/peer/gtk/GtkChoicePeer.java 25 Aug 2005 02:26:48 - 1.24 +++ gnu/java/awt/peer/gtk/GtkChoicePeer.java 7 Oct 2005 23:46:05 - @@ -131,9 +131,6 @@ protected void postChoiceItemEvent (String label, int stateChange) { -// Must set our state before notifying listeners -if (stateChange == ItemEvent.SELECTED) - ((Choice) awtComponent).select (label); postItemEvent (label, stateChange); } } Index: java/awt/Choice.java === RCS file: /cvsroot/classpath/classpath/java/awt/Choice.java,v retrieving revision 1.22 diff -u -r1.22 Choice.java --- java/awt/Choice.java 2 Jul 2005 20:32:23 - 1.22 +++ java/awt/Choice.java 7 Oct 2005 23:46:05 - @@ -565,6 +565,10 @@ protected void processItemEvent(ItemEvent event) { + int index = pItems.indexOf((String) event.getItem()); + // Don't call back into the peers when selecting index here + if (event.getStateChange() == ItemEvent.SELECTED) +this.selectedIndex = index; if (item_listeners != null) item_listeners.itemStateChanged(event); } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: DSSISynthesizer.loadInstrument implementation
My last patch let us query the list of Instruments supported by a DSSISynthesizer. This patch implements the Synthesizer's loadInstrument method, so we can select non-default soft-synth patches. I'm checking it in. Here are some more random sounds made after loading an alternate Instrument into Xsynth. http://spindazzle.org/green/pics/second.ogg AG 2005-10-07 Anthony Green [EMAIL PROTECTED] * gnu/javax/sound/midi/dssi/DSSISynthesizer.java (loadInstrument): Implement. (selectProgram_): New native method. * include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h: Rebuilt. * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c (selectProgram_): New function. Index: gnu/javax/sound/midi/dssi/DSSISynthesizer.java === RCS file: /cvsroot/classpath/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java,v retrieving revision 1.3 diff -u -r1.3 DSSISynthesizer.java --- gnu/javax/sound/midi/dssi/DSSISynthesizer.java 7 Oct 2005 15:49:03 - 1.3 +++ gnu/javax/sound/midi/dssi/DSSISynthesizer.java 8 Oct 2005 03:49:22 - @@ -239,6 +239,7 @@ static native String getProgramName_(long handle, int index); static native int getProgramBank_(long handle, int index); static native int getProgramProgram_(long handle, int index); + static native void selectProgram_(long handle, int bank, int program); /** * @author Anthony Green ([EMAIL PROTECTED]) @@ -575,13 +576,18 @@ return false; } - /* (non-Javadoc) - * @see javax.sound.midi.Synthesizer#loadInstrument(javax.sound.midi.Instrument) + /* @see javax.sound.midi.Synthesizer#loadInstrument(javax.sound.midi.Instrument) */ public boolean loadInstrument(Instrument instrument) { -// TODO Auto-generated method stub -return false; +// FIXME: perhaps this isn't quite right. It can probably +// be in any soundbank. +if (instrument.getSoundbank() != defaultSoundbank) + throw new IllegalArgumentException (Synthesizer doesn't support this instrument's soundbank); + +Patch patch = instrument.getPatch(); +selectProgram_(sohandle, patch.getBank(), patch.getProgram()); +return true; } /* (non-Javadoc) Index: include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h === RCS file: /cvsroot/classpath/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h,v retrieving revision 1.3 diff -u -r1.3 gnu_javax_sound_midi_dssi_DSSISynthesizer.h --- include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h 7 Oct 2005 15:49:02 - 1.3 +++ include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h 8 Oct 2005 03:49:27 - @@ -20,6 +20,7 @@ JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1 (JNIEnv *env, jclass, jlong, jint); JNIEXPORT jint JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1 (JNIEnv *env, jclass, jlong, jint); JNIEXPORT jint JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1 (JNIEnv *env, jclass, jlong, jint); +JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_selectProgram_1 (JNIEnv *env, jclass, jlong, jint, jint); #ifdef __cplusplus } Index: native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c === RCS file: /cvsroot/classpath/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c,v retrieving revision 1.5 diff -u -r1.5 gnu_javax_sound_midi_dssi_DSSISynthesizer.c --- native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c7 Oct 2005 15:49:02 - 1.5 +++ native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c8 Oct 2005 03:49:37 - @@ -103,7 +103,7 @@ memcpy (buffer, data-left_buffer, nframes * sizeof(LADSPA_Data)); buffer = jack_port_get_buffer(data-jack_right_output_port, nframes); memcpy (buffer, data-left_buffer, nframes * sizeof(LADSPA_Data)); - + return 0; } @@ -533,3 +533,13 @@ } +JNIEXPORT void JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_selectProgram_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle, jint bank, jint program) +{ + dssi_data *data = JLONG_TO_PTR(dssi_data, handle); + + (data-desc-select_program)(data-plugin_handle, + (unsigned) bank, (unsigned) program); +} ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches