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

  • Done
  • quality assurance status badge
Details
3 participants
  • Danny Milosavljevic
  • Christopher Baines
  • Timotej Lazar
Owner
unassigned
Submitted by
Timotej Lazar
Severity
normal
T
T
Timotej Lazar wrote on 5 Jan 2020 11:36
(address . guix-patches@gnu.org)
87v9pqdwb1.fsf@araneo.si
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(-)

--
2.24.1
T
T
Timotej Lazar wrote on 5 Jan 2020 11:45
[PATCH 1/5] gnu: sdl-mixer: Use correct inputs for MOD file support.
(address . 38941@debbugs.gnu.org)(name . Timotej Lazar)(address . timotej.lazar@araneo.si)
20200105104551.16961-1-timotej.lazar@araneo.si
Only one MOD backend is compiled, so specify (only) the correct inputs:
libmikmod for sdl-mixer and libmodplug for sdl2-mixer.

* gnu/packages/sdl.scm (sdl-mixer)[inputs]: Remove libmodplug.
* gnu/packages/sdl.scm (sdl2-mixer)[inputs]: Add libmodplug.
---
gnu/packages/sdl.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index f7a34003d1..beeec1b8ca 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -11,6 +11,7 @@
;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -274,8 +275,7 @@ WEBP, XCF, XPM, and XV.")
(inputs `(("libvorbis" ,libvorbis)
("libflac" ,flac)
("libmad" ,libmad)
- ("libmikmod" ,libmikmod)
- ("libmodplug" ,libmodplug)))
+ ("libmikmod" ,libmikmod)))
;; FIXME: Add libfluidsynth
(propagated-inputs `(("sdl" ,sdl)))
(synopsis "SDL multi-channel audio mixer library")
@@ -416,6 +416,10 @@ directory.")
#t))
(sha256
(base32 "0694vsz5bjkcdgfdra6x9fq8vpzrl8m6q96gh58df7065hw5mkxl"))))
+ (inputs
+ ;; The default MOD library changed in SDL2 mixer.
+ `(("libmodplug" ,libmodplug)
+ ,@(alist-delete "libmikmod" (package-inputs sdl-mixer))))
(propagated-inputs
(propagated-inputs-with-sdl2 sdl-mixer))))
--
2.24.1
T
T
Timotej Lazar wrote on 5 Jan 2020 11:45
[PATCH 2/5] gnu: sdl-mixer: Remove unused configure flag.
(address . 38941@debbugs.gnu.org)(name . Timotej Lazar)(address . timotej.lazar@araneo.si)
20200105104551.16961-2-timotej.lazar@araneo.si
The flag --disable-music-mp3-shared is only used when building with smpeg
instead of libmad, which is linked at build time by default.

* gnu/packages/sdl.scm (sdl-mixer)[arguments]: Remove unused configure flag.
---
gnu/packages/sdl.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

Toggle diff (16 lines)
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index beeec1b8ca..92d8f9a922 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -270,8 +270,7 @@ WEBP, XCF, XPM, and XV.")
"--disable-music-mod-shared"
"--disable-music-fluidsynth-shared"
"--disable-music-ogg-shared"
- "--disable-music-flac-shared"
- "--disable-music-mp3-shared")))
+ "--disable-music-flac-shared")))
(inputs `(("libvorbis" ,libvorbis)
("libflac" ,flac)
("libmad" ,libmad)
--
2.24.1
T
T
Timotej Lazar wrote on 5 Jan 2020 11:45
[PATCH 3/5] gnu: sdl2-mixer: Fix configure flags.
(address . 38941@debbugs.gnu.org)(name . Timotej Lazar)(address . timotej.lazar@araneo.si)
20200105104551.16961-3-timotej.lazar@araneo.si
Some configure options were renamed between SDL / SDL2 mixer; add new variants
to the derived package.

* gnu/packages/sdl.scm (sdl2-mixer)[arguments]: Fix flags to disable dynamic
library loading.
---
gnu/packages/sdl.scm | 9 +++++++++
1 file changed, 9 insertions(+)

Toggle diff (22 lines)
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 92d8f9a922..d441040cd6 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -415,6 +415,15 @@ directory.")
#t))
(sha256
(base32 "0694vsz5bjkcdgfdra6x9fq8vpzrl8m6q96gh58df7065hw5mkxl"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments sdl-mixer)
+ ((#:configure-flags flags)
+ `(cons*
+ ;; These options were renamed in SDL2 mixer. Keeping the inherited
+ ;; variants produces a harmless warning.
+ "--disable-music-mod-modplug-shared"
+ "--disable-music-midi-fluidsynth-shared"
+ ,flags))))
(inputs
;; The default MOD library changed in SDL2 mixer.
`(("libmodplug" ,libmodplug)
--
2.24.1
T
T
Timotej Lazar wrote on 5 Jan 2020 11:45
[PATCH 4/5] gnu: sdl-mixer: Enable fluidsynth MIDI backend.
(address . 38941@debbugs.gnu.org)(name . Timotej Lazar)(address . timotej.lazar@araneo.si)
20200105104551.16961-4-timotej.lazar@araneo.si
* gnu/packages/sdl.scm (sdl-mixer)[inputs]: Add fluidsynth and alphabetize.
[arguments]: Reformat.
---
gnu/packages/sdl.scm | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)

Toggle diff (42 lines)
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index d441040cd6..80f3da9327 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -262,20 +262,21 @@ WEBP, XCF, XPM, and XV.")
"0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"))))
(build-system gnu-build-system)
(outputs '("out" "debug"))
- ;; no check target
- ;; use libmad instead of smpeg
- ;; explicitly link against shared libraries instead of dlopening them
- (arguments `(#:tests? #f
- #:configure-flags '("--enable-music-mp3-mad-gpl"
- "--disable-music-mod-shared"
- "--disable-music-fluidsynth-shared"
- "--disable-music-ogg-shared"
- "--disable-music-flac-shared")))
- (inputs `(("libvorbis" ,libvorbis)
- ("libflac" ,flac)
- ("libmad" ,libmad)
- ("libmikmod" ,libmikmod)))
- ;; FIXME: Add libfluidsynth
+ (arguments
+ `(#:tests? #f ; No check target.
+ #:configure-flags
+ '("--enable-music-mp3-mad-gpl" ; Use libmad instead of smpeg.
+ ;; Explicitly link against shared libraries instead of dlopening them.
+ "--disable-music-flac-shared"
+ "--disable-music-fluidsynth-shared"
+ "--disable-music-mod-shared"
+ "--disable-music-ogg-shared")))
+ (inputs
+ `(("fluidsynth" ,fluidsynth)
+ ("libflac" ,flac)
+ ("libmad" ,libmad)
+ ("libmikmod" ,libmikmod)
+ ("libvorbis" ,libvorbis)))
(propagated-inputs `(("sdl" ,sdl)))
(synopsis "SDL multi-channel audio mixer library")
(description "SDL_mixer is a multi-channel audio mixer library for SDL.
--
2.24.1
T
T
Timotej Lazar wrote on 5 Jan 2020 11:45
[PATCH 5/5] gnu: sdl2-mixer: Enable opus support.
(address . 38941@debbugs.gnu.org)(name . Timotej Lazar)(address . timotej.lazar@araneo.si)
20200105104551.16961-5-timotej.lazar@araneo.si
* gnu/packages/sdl.scm (sdl2-mixer)[inputs]: Add opusfile.
[native-inputs]: Add pkg-config.
[arguments]: Link opusfile at build time.
---
gnu/packages/sdl.scm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 80f3da9327..80725561fb 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -420,15 +420,19 @@ directory.")
(substitute-keyword-arguments (package-arguments sdl-mixer)
((#:configure-flags flags)
`(cons*
+ "--disable-music-opus-shared"
;; These options were renamed in SDL2 mixer. Keeping the inherited
;; variants produces a harmless warning.
"--disable-music-mod-modplug-shared"
"--disable-music-midi-fluidsynth-shared"
,flags))))
(inputs
- ;; The default MOD library changed in SDL2 mixer.
- `(("libmodplug" ,libmodplug)
+ `(("opusfile" ,opusfile)
+ ;; The default MOD library changed in SDL2 mixer.
+ ("libmodplug" ,libmodplug)
,@(alist-delete "libmikmod" (package-inputs sdl-mixer))))
+ (native-inputs
+ `(("pkgconfig" ,pkg-config))) ; Needed to find the opus library.
(propagated-inputs
(propagated-inputs-with-sdl2 sdl-mixer))))
--
2.24.1
D
D
Danny Milosavljevic wrote on 5 Jan 2020 13:23
Re: [bug#38941] [PATCH 0/5] Support fluidsynth and opus in sdl(2)-mixer, and other tweaks
(name . Timotej Lazar)(address . timotej.lazar@araneo.si)
20200105132306.32d6f294@scratchpost.org
Hi,

thanks for the patches!

On Sun, 05 Jan 2020 11:36:34 +0100
Timotej Lazar <timotej.lazar@araneo.si> wrote:

Toggle quote (18 lines)
> 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?

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.

Toggle quote (6 lines)
> 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.

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?).

There's also a procedure "sdl-union" which already does sdl magic. We could
also add some stuff for MIDI there, maybe.

In the mean time, I've applied your patchset to master since it only adds
functionality and only has few dependents.

Could you provide an update to the description or similar as a patch?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl4R1VAACgkQ5xo1VCww
uqUkzQf6Ayxl8b9l7o05e21UyDRzs++8WVScRrm4NMqO2EAwVpeu9QiWP+ySywVk
3IM4U/4b0RWu2CqwHIkiRBix8+HJpdL9aJrxIkNY20hE9WSegGY2loifvjmwBMy9
RRsmNrEq/xoXRSZxnO/+YUO+sF0imGEOq1OnHQgABiQWR+vQ2A5N3aS6hUGqJ+0/
/GUseXNzbtOald5y/leUWjbvVZ2k7E0xwxDN7hUpE5qZN/GyDodEmQ3hIZvIAMoJ
ddQdhnjCkez0jqFSZXDTryD0LRYUmlFC5YEkTTgxT437qE9RUvPs9J03qXfbGt+5
DsjVY3tcwyJVdqWAHxLgUKe1krs/yA==
=ZgLJ
-----END PGP SIGNATURE-----


T
T
Timotej Lazar wrote on 6 Jan 2020 12:12
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
874kx84z4r.fsf@araneo.si
Danny Milosavljevic <dannym@scratchpost.org> [2020-01-05 13:23:44+0100]:
Toggle quote (3 lines)
> 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.

Toggle quote (7 lines)
> 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!
C
C
Christopher Baines wrote on 13 Dec 2020 13:57
(name . Timotej Lazar)(address . timotej.lazar@araneo.si)(address . 38941@debbugs.gnu.org)
87h7op50e0.fsf@cbaines.net
Timotej Lazar <timotej.lazar@araneo.si> writes:

Toggle quote (41 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl/WD8dfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xcwpg//RB3bk7ssAUQPmVmqVU87ozOVgXIKYY7Y
gxoBJRq46Y1xcfIPu8coEsnRcpDyAs0W0IRfVKJrYhIumZsuUvB6tRmgphy4aZc2
jbR1xsAHdlpS8IPZLHXC9InGCuiazPQb+qhNEor/ct+PZpqoe1Qua/uT4tyCsj/V
woembxCqIYinzqOjDW4YH2HbHUw3UlV32AAleAUUfE00ZdmcA4WHysuYbYvowW+o
9GwM+O9FW/ZlBYy4faiJ94FDd4E0QsRVDNOINxpmX1PKCyOBB12t3B698Tw8n3b0
55KMWlVTQbepXuwLGv3a6y19OHB8GtPWMfdQ+ipD1O2dOvl7fYR6SPRnoj8lmVcg
I+ujz5ivQuYnKlmR/HrBcjgPsrPFr6yopqQWoB74isF+P15RAVY8BC1mf9I/G7vW
ZYjj9k8rg6lQ80283kptgUTsj+D2obqUn/zJubru7sGOzxwFHG17njuAOVC3dLrb
4WrXK2GZ0Spc5ZxQNhf6LRZ3UQCjIe6P0ueWn02NfQ+zEPIC+FWHhsLDxUgly/Be
pVARBS/d8kCyWMkIHws9yFVze8GOgm7NEL9O1QtZgrwEw/+JoFxRvKw8zqV2I6t8
I/IXi2ctibiQS7PS+wm78xF5IAn4/rkmYe9djslExLz5HWca6Y3qEgecDaYqiXxR
LGEcFpwSZpM=
=On2g
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 13 Dec 2020 14:01
(address . 38941-done@debbugs.gnu.org)
87eejt507y.fsf@cbaines.net

Closed
?