diff options
author | Anthony Green <green@redhat.com> | 2005-10-07 15:49:01 +0000 |
---|---|---|
committer | Anthony Green <green@redhat.com> | 2005-10-07 15:49:01 +0000 |
commit | e8c38d628f8fbb3f2f891d48898758ef719561de (patch) | |
tree | cf54f5d3a4d23e172d07f8e18fdbe9514416820a /native | |
parent | eea34184f3446b5b69e2e54d14d8379d333625ad (diff) | |
download | classpath-e8c38d628f8fbb3f2f891d48898758ef719561de.tar.gz |
2005-10-07 Anthony Green <green@redhat.com>
* 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.
Diffstat (limited to 'native')
-rw-r--r-- | native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c b/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c index 70e071956..35670d31c 100644 --- a/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c +++ b/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c @@ -468,3 +468,68 @@ Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_close_1 { } +/* FIXME: These next three functions are really inefficient because + we're instantiating and cleaning up plugin instances just to query + values. */ + +JNIEXPORT jstring JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1 + (JNIEnv *env, jclass clazz __attribute__((unused)), + jlong handle, jint index) +{ + LADSPA_Handle lhandle; + jstring name = (jstring) NULL; + dssi_data *data = JLONG_TO_PTR(dssi_data, handle); + if (data->desc->get_program == NULL) + return NULL; + lhandle = + (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, + 48000); + const DSSI_Program_Descriptor *program = + (data->desc->get_program)(lhandle, (unsigned long) index); + if (program) + name = (*env)->NewStringUTF (env, program->Name); + (data->desc->LADSPA_Plugin->cleanup)(lhandle); + + return name; +} + +JNIEXPORT jint JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle, jint index) +{ + LADSPA_Handle lhandle; + jint result = -1; + dssi_data *data = JLONG_TO_PTR(dssi_data, handle); + lhandle = + (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, + 48000); + const DSSI_Program_Descriptor *program = + (data->desc->get_program)(lhandle, (unsigned long) index); + if (program) + result = (jint) program->Bank; + (data->desc->LADSPA_Plugin->cleanup)(lhandle); + return result; +} + +JNIEXPORT jint JNICALL +Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1 + (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), + jlong handle, jint index) +{ + LADSPA_Handle lhandle; + jint result = -1; + dssi_data *data = JLONG_TO_PTR(dssi_data, handle); + lhandle = + (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, + 48000); + const DSSI_Program_Descriptor *program = + (data->desc->get_program)(lhandle, (unsigned long) index); + if (program) + result = (jint) program->Program; + (data->desc->LADSPA_Plugin->cleanup)(lhandle); + return result; +} + + |