Skip to contentSkip to conversation

sdl_mixer: add FluidSynth support

PATCH New Paul Cercueil 2 participants 6 messages Jul 2, 2020 – Jul 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sdl_mixer: add FluidSynth support

Add support for MIDI playback using FluidSynth.

---
 package/sdl_mixer/sdl_mixer.mk | 11 +++++++++++
 1 file changed, 11 insertions(+)
package/sdl_mixer/sdl_mixer.mk +11 -0
index 73eb821ff3..a35b184a23 100644
@@ -23,10 +23,21 @@ SDL_MIXER_CONF_OPTS = \
 	--without-x \
 	--with-sdl-prefix=$(STAGING_DIR)/usr \
 	--disable-music-midi \
+	--disable-music-native-midi \
+	--disable-music-timidity-midi \
 	--disable-music-mod \
 	--disable-music-mp3 \
 	--disable-music-flac # configure script fails when cross compiling
 
+ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y)
+SDL_MIXER_DEPENDENCIES += fluidsynth
+SDL_MIXER_CONF_OPTS += \
+	--enable-music-midi \
+	--enable-music-fluidsynth-midi
+else
+SDL_MIXER_CONF_OPTS += --disable-music-fluidsynth-midi
+endif
+
 ifeq ($(BR2_PACKAGE_LIBMAD),y)
 SDL_MIXER_CONF_OPTS += --enable-music-mp3-mad-gpl
 SDL_MIXER_DEPENDENCIES += libmad
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 sdl_mixer: add MIDI support using Timidity

Add MIDI playback support using SDL_mixer' built-in Timidity synth.

---
 package/sdl_mixer/Config.in    | 10 ++++++++++
 package/sdl_mixer/sdl_mixer.mk |  9 ++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
package/sdl_mixer/Config.in +10 -0
index 42dfe63c0a..a886b7c1ac 100644
@@ -9,3 +9,13 @@ config BR2_PACKAGE_SDL_MIXER
 	  SMPEG MP3 libraries.
 
 	  http://www.libsdl.org/projects/SDL_mixer/
+
+if BR2_PACKAGE_SDL_MIXER
+
+config BR2_PACKAGE_SDL_MIXER_MIDI_TIMIDITY
+	bool "MIDI support with built-in Timidity synth"
+	help
+	  Support MIDI audio using the built-in synth based on Timidity.
+	  You will need MIDI instruments installed in the filesystem.
+
+endif
package/sdl_mixer/sdl_mixer.mk +8 -1
index a35b184a23..c415f837b1 100644
@@ -24,11 +24,18 @@ SDL_MIXER_CONF_OPTS = \
 	--with-sdl-prefix=$(STAGING_DIR)/usr \
 	--disable-music-midi \
 	--disable-music-native-midi \
-	--disable-music-timidity-midi \
 	--disable-music-mod \
 	--disable-music-mp3 \
 	--disable-music-flac # configure script fails when cross compiling
 
+ifeq ($(BR2_PACKAGE_SDL_MIXER_MIDI_TIMIDITY),y)
+SDL_MIXER_CONF_OPTS += \
+	--enable-music-midi \
+	--enable-music-timidity-midi
+else
+SDL_MIXER_CONF_OPTS += --disable-music-timidity-midi
+endif
+
 ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y)
 SDL_MIXER_DEPENDENCIES += fluidsynth
 SDL_MIXER_CONF_OPTS += \
Signature · 1 line
2.27.0
#2 lore raw

PATCH 1/2 sdl_mixer: add FluidSynth support

In reply to Paul Cercueil
Quoted 6 lines · On Thu, 2 Jul 2020 17:25:46 +0200 Paul Cercueil <[email protected]> wrote:

Add support for MIDI playback using FluidSynth.

---
 package/sdl_mixer/sdl_mixer.mk | 11 +++++++++++
 1 file changed, 11 insertions(+)

I've applied both patches, but I've changed a bit how the .mk file handles the option. After both patches, it looks like this:

ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y)
SDL_MIXER_DEPENDENCIES += fluidsynth

SDL_MIXER_CONF_OPTS += \
	--enable-music-midi \
	--enable-music-fluidsynth-midi

SDL_MIXER_HAS_MIDI = YES
endif

ifeq ($(BR2_PACKAGE_SDL_MIXER_MIDI_TIMIDITY),y)

SDL_MIXER_CONF_OPTS += \
	--enable-music-midi \
	--enable-music-timidity-midi

SDL_MIXER_HAS_MIDI = YES
endif

ifneq ($(SDL_MIXER_HAS_MIDI),YES)
SDL_MIXER_CONF_OPTS += --disable-music-midi
endif

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/2 sdl_mixer: add FluidSynth support

Hi Thomas,

Le dim. 12 juil. 2020 ? 15:56, Thomas Petazzoni
<[email protected]> a ?crit :

Quoted 25 lines
Quoted 6 lines · On Thu, 2 Jul 2020 17:25:46 +0200 Paul Cercueil <[email protected]> wrote:

Add support for MIDI playback using FluidSynth.

---

  package/sdl_mixer/sdl_mixer.mk | 11 +++++++++++
  1 file changed, 11 insertions(+)

I've applied both patches, but I've changed a bit how the .mk file handles the option. After both patches, it looks like this:

ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y)
SDL_MIXER_DEPENDENCIES += fluidsynth

SDL_MIXER_CONF_OPTS += \
	--enable-music-midi \
	--enable-music-fluidsynth-midi

SDL_MIXER_HAS_MIDI = YES
endif

ifeq ($(BR2_PACKAGE_SDL_MIXER_MIDI_TIMIDITY),y)

SDL_MIXER_CONF_OPTS += \
	--enable-music-midi \
	--enable-music-timidity-midi
Quoted 6 lines

SDL_MIXER_HAS_MIDI = YES
endif

ifneq ($(SDL_MIXER_HAS_MIDI),YES)
SDL_MIXER_CONF_OPTS += --disable-music-midi
endif

It won't work then. --enable-music-midi automatically enables --enable-music-{native,fluidsynth,timidity}-midi, so these need to be manually disabled. Otherwise when you enable e.g. Fluidsynth, it will also enable Timidity even though the SDL_MIXER_MIDI_TIMIDITY option is OFF.

Cheers,
-Paul

Quoted 7 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#4 lore raw

PATCH 1/2 sdl_mixer: add FluidSynth support

Quoted 22 lines · On Sun, 12 Jul 2020 19:39:36 +0200 Paul Cercueil <[email protected]> wrote:
Quoted 15 lines

I've applied both patches, but I've changed a bit how the .mk file handles the option. After both patches, it looks like this:

ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y)
SDL_MIXER_DEPENDENCIES += fluidsynth

SDL_MIXER_CONF_OPTS += \
	--enable-music-midi \
	--enable-music-fluidsynth-midi

SDL_MIXER_HAS_MIDI = YES
endif

ifeq ($(BR2_PACKAGE_SDL_MIXER_MIDI_TIMIDITY),y)

SDL_MIXER_CONF_OPTS += \
	--enable-music-midi \
	--enable-music-timidity-midi
Quoted 6 lines

SDL_MIXER_HAS_MIDI = YES
endif

ifneq ($(SDL_MIXER_HAS_MIDI),YES)
SDL_MIXER_CONF_OPTS += --disable-music-midi
endif

Quoted 5 lines

It won't work then. --enable-music-midi automatically enables --enable-music-{native,fluidsynth,timidity}-midi, so these need to be manually disabled. Otherwise when you enable e.g. Fluidsynth, it will also enable Timidity even though the SDL_MIXER_MIDI_TIMIDITY option is OFF.

So, I guess we need this instead:

ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y) SDL_MIXER_DEPENDENCIES += fluidsynth SDL_MIXER_CONF_OPTS += --enable-music-fluidsynth-midi SDL_MIXER_HAS_MIDI = YES
else
SDL_MIXER_CONF_OPTS += --disable-music-fluidsynth-midi endif

ifeq ($(BR2_PACKAGE_SDL_MIXER_MIDI_TIMIDITY),y) SDL_MIXER_CONF_OPTS += --enable-music-timidity-midi SDL_MIXER_HAS_MIDI = YES
else
SDL_MIXER_CONF_OPTS += --disable-music-timidity-midi endif

ifeq ($(SDL_MIXER_HAS_MIDI),YES)
SDL_MIXER_CONF_OPTS += --disable-music-midi
else
SDL_MIXER_CONF_OPTS += --disable-music-midi
endif

what do you think ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH 1/2 sdl_mixer: add FluidSynth support

Le dim. 12 juil. 2020 ? 21:06, Thomas Petazzoni
<[email protected]> a ?crit :

Quoted 51 lines
Quoted 22 lines · On Sun, 12 Jul 2020 19:39:36 +0200 Paul Cercueil <[email protected]> wrote:
Quoted 15 lines

I've applied both patches, but I've changed a bit how the .mk file handles the option. After both patches, it looks like this:

ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y)
SDL_MIXER_DEPENDENCIES += fluidsynth

SDL_MIXER_CONF_OPTS += \
	--enable-music-midi \
	--enable-music-fluidsynth-midi

SDL_MIXER_HAS_MIDI = YES
endif

ifeq ($(BR2_PACKAGE_SDL_MIXER_MIDI_TIMIDITY),y)

SDL_MIXER_CONF_OPTS += \
	--enable-music-midi \
	--enable-music-timidity-midi
Quoted 6 lines

SDL_MIXER_HAS_MIDI = YES
endif

ifneq ($(SDL_MIXER_HAS_MIDI),YES)
SDL_MIXER_CONF_OPTS += --disable-music-midi
endif

Quoted 8 lines

It won't work then. --enable-music-midi automatically enables --enable-music-{native,fluidsynth,timidity}-midi, so these need to
be
manually disabled. Otherwise when you enable e.g. Fluidsynth, it
will
also enable Timidity even though the SDL_MIXER_MIDI_TIMIDITY option
is
OFF.

So, I guess we need this instead:

ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y) SDL_MIXER_DEPENDENCIES += fluidsynth SDL_MIXER_CONF_OPTS += --enable-music-fluidsynth-midi SDL_MIXER_HAS_MIDI = YES
else
SDL_MIXER_CONF_OPTS += --disable-music-fluidsynth-midi endif

ifeq ($(BR2_PACKAGE_SDL_MIXER_MIDI_TIMIDITY),y) SDL_MIXER_CONF_OPTS += --enable-music-timidity-midi SDL_MIXER_HAS_MIDI = YES
else
SDL_MIXER_CONF_OPTS += --disable-music-timidity-midi endif

Quoted 7 lines

ifeq ($(SDL_MIXER_HAS_MIDI),YES)
SDL_MIXER_CONF_OPTS += --disable-music-midi
else
SDL_MIXER_CONF_OPTS += --disable-music-midi
endif

what do you think ?

That would work.

-Paul

Quoted 5 lines

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com