hello,
Im using this code to do .
fluid_synth_program_change(handle->synth, ch, data1);
and enumerate is following code.
jstring JNICALL jfluid_list_program(JNIEnv *env, jobject obj, int id) {
fluid_handle_t *handle = getFluid(id);
if (handle == nullptr) {
return env->NewStringUTF("");
}
fluid_sfont_t *font = fluid_synth_get_sfont_by_id(handle->synth,
handle->soundfont_id);
int offset = fluid_synth_get_bank_offset(handle->synth,
handle->soundfont_id);
fluid_sfont_iteration_start(font);
std::stringstream result;
result << "list program " << id << " addresss " << ((unsigned long)
(font)) << "\n";
char buff[101 + 27];
while (true) {
fluid_preset_t *preset = fluid_sfont_iteration_next(font);
if (preset == nullptr) {
preset = fluid_sfont_iteration_next(font);
if (preset == nullptr) {
preset = fluid_sfont_iteration_next(font);
if (preset == nullptr) {
break;
}
}
}
int banknum = fluid_preset_get_banknum(preset) + offset;
int program = fluid_preset_get_num(preset);
const char *name = fluid_preset_get_name(preset);
for (int i = 0; i < 100; ++ i) {
char c = name[i];
if ((c & 0x80) != 0) {
c = '_';
}
buff[i] = c;
if (c == 0) {
break;
}
}
buff[100] = 0;
result << program;
result << ",";
result << banknum;
result << ",";
result << "-1";
result << ",";
result << buff;
result << "\n";
}
std::string str(result.str());
char *buf = (char *)str.c_str();
return env->NewStringUTF(buf);
}
Im willing to It helps you~.
_______________________________________________
fluid-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fluid-dev