Skip to content

Commit

Permalink
Update docs about load shell cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
derselbst committed Feb 2, 2025
1 parent 457b8a9 commit 77e98b6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 5 additions & 3 deletions doc/fluidsynth.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.\" along with this program; see the file LICENSE. If not, write to
.\" the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
.\"
.TH FluidSynth 1 "Jan 1, 2025"
.TH FluidSynth 1 "Feb 2, 2025"
.\" Please update the above date whenever this man page is modified.
.\"
.\" Some roff macros, for reference:
Expand Down Expand Up @@ -155,8 +155,10 @@ Quit the synthesizer
.TP
.B SOUNDFONTS
.TP
.B load filename
Load a SoundFont
.B load filename [reset] [bankofs]
Load a SoundFont onto the SoundFont stack. If reset is 1 (which is the implicit default), all currently in-use SoundFont presets will be re-evaluated with the newly loaded SoundFont taken into account.
Optionally, you can specify a non-zero bank offset for the new SoundFont. For example the command
load soundfont.sf2 0 10 will load the soundfont.sf2 with a bank offset of 10 without re-evaluating the presets.
.TP
.B unload number
Unload a SoundFont. The number is the index of the SoundFont on the stack.
Expand Down
14 changes: 12 additions & 2 deletions src/bindings/fluid_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static const fluid_cmd_t fluid_commands[] =
},
{
"load", "general", fluid_handle_load,
"load file [reset] [bankofs] Loads SoundFont (reset=0|1, def 1; bankofs=n, def 0)"
"load file [reset] [bankofs] Loads SoundFont (reset=0|1, def=1; bankofs=n, n!=0)"
},
{
"unload", "general", fluid_handle_unload,
Expand Down Expand Up @@ -985,11 +985,21 @@ fluid_handle_load(void *data, int ac, char **av, fluid_ostream_t out)
if(ac == 2)
{
reset = atoi(av[1]);
if (reset != 0 && reset != 1)
{
fluid_ostream_printf(out, "load: invalid reset argument %d, only 1 or 0 are allowed\n", reset);
return FLUID_FAILED;
}
}

if(ac == 3)
{
offset = atoi(av[2]);
if (offset == 0)
{
fluid_ostream_printf(out, "load: only non-zero bank offsets are allowed, omit this parameter if zero was intended\n", offset);
return FLUID_FAILED;
}
}

/* Load the SoundFont without resetting the programs. The reset will
Expand All @@ -1003,7 +1013,7 @@ fluid_handle_load(void *data, int ac, char **av, fluid_ostream_t out)
}
else
{
fluid_ostream_printf(out, "loaded SoundFont has ID %d\n", id);
fluid_ostream_printf(out, "loaded SoundFont has ID %d and bankofs=%d\n", id, offset);
}

if(offset)
Expand Down
2 changes: 1 addition & 1 deletion test/manual

0 comments on commit 77e98b6

Please sign in to comment.