Hey David,

Please have a look in the API docs:
https://www.fluidsynth.org/api/LoadingSoundfonts.html

Specifically, changing the instrument on a channel can be done with:
fluid_synth_program_select
https://www.fluidsynth.org/api/group__midi__messages.html#ga0c2f5db7b19f80f25c1e4263cf78b0d0

Your call to fluid_synth_program_select_by_sfont_name $7 0 "Celesta" 0
0) fails because "Celesta" is not the SoundFont name, but the name of
the Preset in the SoundFont FluidR3_GM.sf2.

Cheers
Marcus

Am Do., 16. Okt. 2025 um 02:17 Uhr schrieb mixandcc
<[email protected]>:
>
> 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

_______________________________________________
fluid-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to