mbox

[bug#38941,0/5] Support fluidsynth and opus in sdl(2)-mixer, and other tweaks

Message ID 87v9pqdwb1.fsf@araneo.si
Headers show

Message

Timotej Lazar Jan. 5, 2020, 10:36 a.m. UTC
Hi,

these patches improve sdl- and sdl2-mixer: fix dependencies and
configure flags that changed between the two versions, and enable
support for fluidsynth and opus libraries. I tested several dependent
packages, and everything seems to work OK.

The MIDI backends need additional runtime configuration. Fluidsynth
requires a soundfont to be installed and specified when running a
program that uses sdl-mixer, e.g.:

    SDL_SOUNDFONTS=/gnu/store/…-fluid-3-2.1/share/soundfonts/FluidR3Mono_GM.sf3

If this is not set, the bundled timidity backend is used, which can use
the freepats samples. Configuration must be specified since only files
under /etc are checked by default, e.g.:

    TIMIDITY_CFG=/gnu/store/…-freepats-20060219/share/freepats/freepats.cfg

I’m not sure if and how default values for these vars can be specified
for all programs using sdl-mixer, and I would prefer to leave the choice
of backend to the user anyway. However, we should probably document them
somewhere. Would a comment be enough? Dependent packages can then wrap
binaries to set required paths if needed.

Alternatively we can add freepats and/or fluid as inputs to sdl(2)-mixer
and patch the source to look for them in the store.

Thanks!
Timotej

Timotej Lazar (5):
  gnu: sdl-mixer: Use correct inputs for MOD file support.
  gnu: sdl-mixer: Remove unused configure flag.
  gnu: sdl2-mixer: Fix configure flags.
  gnu: sdl-mixer: Enable fluidsynth MIDI backend.
  gnu: sdl2-mixer: Enable opus support.

 gnu/packages/sdl.scm | 49 +++++++++++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 16 deletions(-)

Comments

Timotej Lazar Jan. 6, 2020, 11:12 a.m. UTC | #1
Danny Milosavljevic <dannym@scratchpost.org> [2020-01-05 13:23:44+0100]:
> Let's put it in the description of the sdl-mixer package.
> After all, it would document the usage of an interface that sdl-mixer provides.

OK, I sent a patch describing runtime setup for MIDI playback.

> How often is it that a user switches MIDI soundfonts?
>
> Does a user expect a default soundfont?
>
> That would tell us whether we should provide such a default (and increase
> the closure size of sdl2-mixer considerably, maybe?).

The packages `freepats` and `fluid-3` are 31.9 and 13.9 MiB
respectively. I think that the best solution would be to include them as
inputs to packages that use sdl-mixer to actually play MIDI files. I did
so for CorsixTH (patch submitted), which was also the reason for the
sdl-mixer patches. :)

Thank you for the feedback!
Christopher Baines Dec. 13, 2020, 12:57 p.m. UTC | #2
Timotej Lazar <timotej.lazar@araneo.si> writes:

> Hi,
>
> these patches improve sdl- and sdl2-mixer: fix dependencies and
> configure flags that changed between the two versions, and enable
> support for fluidsynth and opus libraries. I tested several dependent
> packages, and everything seems to work OK.
>
> The MIDI backends need additional runtime configuration. Fluidsynth
> requires a soundfont to be installed and specified when running a
> program that uses sdl-mixer, e.g.:
>
>     SDL_SOUNDFONTS=/gnu/store/…-fluid-3-2.1/share/soundfonts/FluidR3Mono_GM.sf3
>
> If this is not set, the bundled timidity backend is used, which can use
> the freepats samples. Configuration must be specified since only files
> under /etc are checked by default, e.g.:
>
>     TIMIDITY_CFG=/gnu/store/…-freepats-20060219/share/freepats/freepats.cfg
>
> I’m not sure if and how default values for these vars can be specified
> for all programs using sdl-mixer, and I would prefer to leave the choice
> of backend to the user anyway. However, we should probably document them
> somewhere. Would a comment be enough? Dependent packages can then wrap
> binaries to set required paths if needed.
>
> Alternatively we can add freepats and/or fluid as inputs to sdl(2)-mixer
> and patch the source to look for them in the store.
>
> Thanks!
> Timotej
>
> Timotej Lazar (5):
>   gnu: sdl-mixer: Use correct inputs for MOD file support.
>   gnu: sdl-mixer: Remove unused configure flag.
>   gnu: sdl2-mixer: Fix configure flags.
>   gnu: sdl-mixer: Enable fluidsynth MIDI backend.
>   gnu: sdl2-mixer: Enable opus support.
>
>  gnu/packages/sdl.scm | 49 +++++++++++++++++++++++++++++---------------
>  1 file changed, 33 insertions(+), 16 deletions(-)

Hi,

I think these patches might have been merged, so I'm going to close this
issue. If this is incorrect, just let me know!

Thanks,

Chris