summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2005-10-08 04:10:46 +0000
committerAnthony Green <green@redhat.com>2005-10-08 04:10:46 +0000
commita375fedafce2921f596389f61fbc865f405818a0 (patch)
treeea6da24e0b4b8f95a28d859e93fd7f23545f02d6 /gnu
parent0cce4917789b3ebd71789d43f875781e3767dc06 (diff)
downloadclasspath-a375fedafce2921f596389f61fbc865f405818a0.tar.gz
2005-10-07 Anthony Green <green@redhat.com>
* 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.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/javax/sound/midi/dssi/DSSISynthesizer.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/gnu/javax/sound/midi/dssi/DSSISynthesizer.java b/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
index 79abbfb08..ca09b3050 100644
--- a/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+++ b/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
@@ -239,6 +239,7 @@ public class DSSISynthesizer implements Synthesizer
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 (green@redhat.com)
@@ -575,13 +576,18 @@ public class DSSISynthesizer implements Synthesizer
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)