468 |
{ |
{ |
469 |
} |
} |
470 |
|
|
471 |
|
/* FIXME: These next three functions are really inefficient because |
472 |
|
we're instantiating and cleaning up plugin instances just to query |
473 |
|
values. */ |
474 |
|
|
475 |
|
JNIEXPORT jstring JNICALL |
476 |
|
Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1 |
477 |
|
(JNIEnv *env, jclass clazz __attribute__((unused)), |
478 |
|
jlong handle, jint index) |
479 |
|
{ |
480 |
|
LADSPA_Handle lhandle; |
481 |
|
jstring name = (jstring) NULL; |
482 |
|
dssi_data *data = JLONG_TO_PTR(dssi_data, handle); |
483 |
|
if (data->desc->get_program == NULL) |
484 |
|
return NULL; |
485 |
|
lhandle = |
486 |
|
(data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, |
487 |
|
48000); |
488 |
|
const DSSI_Program_Descriptor *program = |
489 |
|
(data->desc->get_program)(lhandle, (unsigned long) index); |
490 |
|
if (program) |
491 |
|
name = (*env)->NewStringUTF (env, program->Name); |
492 |
|
(data->desc->LADSPA_Plugin->cleanup)(lhandle); |
493 |
|
|
494 |
|
return name; |
495 |
|
} |
496 |
|
|
497 |
|
JNIEXPORT jint JNICALL |
498 |
|
Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1 |
499 |
|
(JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), |
500 |
|
jlong handle, jint index) |
501 |
|
{ |
502 |
|
LADSPA_Handle lhandle; |
503 |
|
jint result = -1; |
504 |
|
dssi_data *data = JLONG_TO_PTR(dssi_data, handle); |
505 |
|
lhandle = |
506 |
|
(data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, |
507 |
|
48000); |
508 |
|
const DSSI_Program_Descriptor *program = |
509 |
|
(data->desc->get_program)(lhandle, (unsigned long) index); |
510 |
|
if (program) |
511 |
|
result = (jint) program->Bank; |
512 |
|
(data->desc->LADSPA_Plugin->cleanup)(lhandle); |
513 |
|
return result; |
514 |
|
} |
515 |
|
|
516 |
|
JNIEXPORT jint JNICALL |
517 |
|
Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1 |
518 |
|
(JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)), |
519 |
|
jlong handle, jint index) |
520 |
|
{ |
521 |
|
LADSPA_Handle lhandle; |
522 |
|
jint result = -1; |
523 |
|
dssi_data *data = JLONG_TO_PTR(dssi_data, handle); |
524 |
|
lhandle = |
525 |
|
(data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin, |
526 |
|
48000); |
527 |
|
const DSSI_Program_Descriptor *program = |
528 |
|
(data->desc->get_program)(lhandle, (unsigned long) index); |
529 |
|
if (program) |
530 |
|
result = (jint) program->Program; |
531 |
|
(data->desc->LADSPA_Plugin->cleanup)(lhandle); |
532 |
|
return result; |
533 |
|
} |
534 |
|
|
535 |
|
|