Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-engines/scummvm/, games-engines/scummvm/files/
Date: Thu, 15 Apr 2021 20:44:52
Message-Id: 1618519458.08f671f9dce9ac08533038bca37c4a8563560710.mgorny@gentoo
1 commit: 08f671f9dce9ac08533038bca37c4a8563560710
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 15 19:57:47 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 15 20:44:18 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08f671f9
7
8 games-engines/scummvm: Backport fluidsynth-2.2 fix
9
10 Closes: https://bugs.gentoo.org/782805
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 .../files/scummvm-2.2.0-fluidsynth-2.2.patch | 150 +++++++++++++++++++++
14 ...cummvm-2.2.0.ebuild => scummvm-2.2.0-r1.ebuild} | 5 +-
15 2 files changed, 153 insertions(+), 2 deletions(-)
16
17 diff --git a/games-engines/scummvm/files/scummvm-2.2.0-fluidsynth-2.2.patch b/games-engines/scummvm/files/scummvm-2.2.0-fluidsynth-2.2.patch
18 new file mode 100644
19 index 00000000000..8bb94ec6ab6
20 --- /dev/null
21 +++ b/games-engines/scummvm/files/scummvm-2.2.0-fluidsynth-2.2.patch
22 @@ -0,0 +1,150 @@
23 +diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp
24 +index e0d7c4e3df..d8e82c24f5 100644
25 +--- a/audio/softsynth/fluidsynth.cpp
26 ++++ b/audio/softsynth/fluidsynth.cpp
27 +@@ -46,6 +46,14 @@
28 + #include "backends/platform/ios7/ios7_common.h"
29 + #endif
30 +
31 ++// We assume here Fluidsynth minor will never be above 255 and
32 ++// that micro versions won't break API compatibility
33 ++#if defined(FLUIDSYNTH_VERSION_MAJOR) && defined(FLUIDSYNTH_VERSION_MINOR)
34 ++#define FS_API_VERSION ((FLUIDSYNTH_VERSION_MAJOR << 8) | FLUIDSYNTH_VERSION_MINOR)
35 ++#else
36 ++#define FS_API_VERSION 0
37 ++#endif
38 ++
39 + class MidiDriver_FluidSynth : public MidiDriver_Emulated {
40 + private:
41 + MidiChannel_MPU401 _midiChannels[16];
42 +@@ -75,7 +83,7 @@ public:
43 +
44 + void setEngineSoundFont(Common::SeekableReadStream *soundFontData) override;
45 + bool acceptsSoundFontData() override {
46 +-#if defined(FLUIDSYNTH_VERSION_MAJOR) && FLUIDSYNTH_VERSION_MAJOR > 1
47 ++#if FS_API_VERSION >= 0x0200
48 + return true;
49 + #else
50 + return false;
51 +@@ -134,7 +142,7 @@ void MidiDriver_FluidSynth::setStr(const char *name, const char *val) {
52 +
53 + // Soundfont memory loader callback functions.
54 +
55 +-#if defined(FLUIDSYNTH_VERSION_MAJOR) && FLUIDSYNTH_VERSION_MAJOR > 1
56 ++#if FS_API_VERSION >= 0x0200
57 + static void *SoundFontMemLoader_open(const char *filename) {
58 + void *p;
59 + if (filename[0] != '&') {
60 +@@ -144,11 +152,19 @@ static void *SoundFontMemLoader_open(const char *filename) {
61 + return p;
62 + }
63 +
64 ++#if FS_API_VERSION >= 0x0202
65 ++static int SoundFontMemLoader_read(void *buf, fluid_long_long_t count, void *handle) {
66 ++#else
67 + static int SoundFontMemLoader_read(void *buf, int count, void *handle) {
68 ++#endif
69 + return ((Common::SeekableReadStream *) handle)->read(buf, count) == (uint32)count ? FLUID_OK : FLUID_FAILED;
70 + }
71 +
72 ++#if FS_API_VERSION >= 0x0202
73 ++static int SoundFontMemLoader_seek(void *handle, fluid_long_long_t offset, int origin) {
74 ++#else
75 + static int SoundFontMemLoader_seek(void *handle, long offset, int origin) {
76 ++#endif
77 + return ((Common::SeekableReadStream *) handle)->seek(offset, origin) ? FLUID_OK : FLUID_FAILED;
78 + }
79 +
80 +@@ -157,7 +173,11 @@ static int SoundFontMemLoader_close(void *handle) {
81 + return FLUID_OK;
82 + }
83 +
84 ++#if FS_API_VERSION >= 0x0202
85 ++static fluid_long_long_t SoundFontMemLoader_tell(void *handle) {
86 ++#else
87 + static long SoundFontMemLoader_tell(void *handle) {
88 ++#endif
89 + return ((Common::SeekableReadStream *) handle)->pos();
90 + }
91 + #endif
92 +@@ -166,7 +186,8 @@ int MidiDriver_FluidSynth::open() {
93 + if (_isOpen)
94 + return MERR_ALREADY_OPEN;
95 +
96 +-#if defined(FLUIDSYNTH_VERSION_MAJOR) && FLUIDSYNTH_VERSION_MAJOR > 1
97 ++
98 ++#if FS_API_VERSION >= 0x0200
99 + // When provided with in-memory SoundFont data, only use the configured
100 + // SoundFont instead if it's explicitly configured on the current game.
101 + bool isUsingInMemorySoundFontData = _engineSoundFontData && !ConfMan.getActiveDomain()->contains("soundfont");
102 +@@ -195,7 +216,11 @@ int MidiDriver_FluidSynth::open() {
103 + _synth = new_fluid_synth(_settings);
104 +
105 + if (ConfMan.getBool("fluidsynth_chorus_activate")) {
106 ++#if FS_API_VERSION >= 0x0202
107 ++ fluid_synth_chorus_on(_synth, -1, 1);
108 ++#else
109 + fluid_synth_set_chorus_on(_synth, 1);
110 ++#endif
111 +
112 + int chorusNr = ConfMan.getInt("fluidsynth_chorus_nr");
113 + double chorusLevel = (double)ConfMan.getInt("fluidsynth_chorus_level") / 100.0;
114 +@@ -210,22 +235,49 @@ int MidiDriver_FluidSynth::open() {
115 + chorusType = FLUID_CHORUS_MOD_TRIANGLE;
116 + }
117 +
118 ++#if FS_API_VERSION >= 0x0202
119 ++ fluid_synth_set_chorus_group_nr(_synth, -1, chorusNr);
120 ++ fluid_synth_set_chorus_group_level(_synth, -1, chorusLevel);
121 ++ fluid_synth_set_chorus_group_speed(_synth, -1, chorusSpeed);
122 ++ fluid_synth_set_chorus_group_depth(_synth, -1, chorusDepthMs);
123 ++ fluid_synth_set_chorus_group_type(_synth, -1, chorusType);
124 ++#else
125 + fluid_synth_set_chorus(_synth, chorusNr, chorusLevel, chorusSpeed, chorusDepthMs, chorusType);
126 ++#endif
127 + } else {
128 ++#if FS_API_VERSION >= 0x0202
129 ++ fluid_synth_chorus_on(_synth, -1, 0);
130 ++#else
131 + fluid_synth_set_chorus_on(_synth, 0);
132 ++#endif
133 + }
134 +
135 + if (ConfMan.getBool("fluidsynth_reverb_activate")) {
136 ++#if FS_API_VERSION >= 0x0202
137 ++ fluid_synth_reverb_on(_synth, -1, 1);
138 ++#else
139 + fluid_synth_set_reverb_on(_synth, 1);
140 ++#endif
141 +
142 + double reverbRoomSize = (double)ConfMan.getInt("fluidsynth_reverb_roomsize") / 100.0;
143 + double reverbDamping = (double)ConfMan.getInt("fluidsynth_reverb_damping") / 100.0;
144 + int reverbWidth = ConfMan.getInt("fluidsynth_reverb_width");
145 + double reverbLevel = (double)ConfMan.getInt("fluidsynth_reverb_level") / 100.0;
146 +
147 ++#if FS_API_VERSION >= 0x0202
148 ++ fluid_synth_set_reverb_group_roomsize(_synth, -1, reverbRoomSize);
149 ++ fluid_synth_set_reverb_group_damp(_synth, -1, reverbDamping);
150 ++ fluid_synth_set_reverb_group_width(_synth, -1, reverbWidth);
151 ++ fluid_synth_set_reverb_group_level(_synth, -1, reverbLevel);
152 ++#else
153 + fluid_synth_set_reverb(_synth, reverbRoomSize, reverbDamping, reverbWidth, reverbLevel);
154 ++#endif
155 + } else {
156 ++#if FS_API_VERSION >= 0x0202
157 ++ fluid_synth_reverb_on(_synth, -1, 0);
158 ++#else
159 + fluid_synth_set_reverb_on(_synth, 0);
160 ++#endif
161 + }
162 +
163 + Common::String interpolation = ConfMan.get("fluidsynth_misc_interpolation");
164 +@@ -246,7 +298,7 @@ int MidiDriver_FluidSynth::open() {
165 + const char *soundfont = !isUsingInMemorySoundFontData ?
166 + ConfMan.get("soundfont").c_str() : Common::String::format("&%p", (void *)_engineSoundFontData).c_str();
167 +
168 +-#if defined(FLUIDSYNTH_VERSION_MAJOR) && FLUIDSYNTH_VERSION_MAJOR > 1
169 ++#if FS_API_VERSION >= 0x0200
170 + if (isUsingInMemorySoundFontData) {
171 + fluid_sfloader_t *soundFontMemoryLoader = new_fluid_defsfloader(_settings);
172 + fluid_sfloader_set_callbacks(soundFontMemoryLoader,
173
174 diff --git a/games-engines/scummvm/scummvm-2.2.0.ebuild b/games-engines/scummvm/scummvm-2.2.0-r1.ebuild
175 similarity index 96%
176 rename from games-engines/scummvm/scummvm-2.2.0.ebuild
177 rename to games-engines/scummvm/scummvm-2.2.0-r1.ebuild
178 index 93e50eddec4..f4ab2f0515e 100644
179 --- a/games-engines/scummvm/scummvm-2.2.0.ebuild
180 +++ b/games-engines/scummvm/scummvm-2.2.0-r1.ebuild
181 @@ -1,4 +1,4 @@
182 -# Copyright 1999-2020 Gentoo Authors
183 +# Copyright 1999-2021 Gentoo Authors
184 # Distributed under the terms of the GNU General Public License v2
185
186 EAPI=7
187 @@ -20,7 +20,7 @@ RDEPEND="
188 aac? ( media-libs/faad2 )
189 alsa? ( media-libs/alsa-lib )
190 flac? ( media-libs/flac )
191 - fluidsynth? ( media-sound/fluidsynth )
192 + fluidsynth? ( media-sound/fluidsynth:= )
193 fribidi? ( dev-libs/fribidi )
194 gtk? (
195 dev-libs/glib:2
196 @@ -56,6 +56,7 @@ S="${WORKDIR}/${P/_/}"
197
198 PATCHES=(
199 "${FILESDIR}/${P}-ultima_engine_lua_dep.patch"
200 + "${FILESDIR}/${P}-fluidsynth-2.2.patch"
201 )
202
203 src_prepare() {