1 From 6e352b874ddffc6185e499cda12c1731d14a3708 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
3 Date: Wed, 17 Oct 2018 23:17:31 +0200
4 Subject: [PATCH] fluidsynth: Follow API change introduced in fluidsynth 2.0.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
11 muse3/synti/fluidsynth/fluidsynti.cpp | 44 ++++++++++++++++++++++++++-
12 1 file changed, 43 insertions(+), 1 deletion(-)
14 diff --git a/muse3/synti/fluidsynth/fluidsynti.cpp b/muse3/synti/fluidsynth/fluidsynti.cpp
15 index 11f51e57..75322d7e 100644
16 --- a/muse3/synti/fluidsynth/fluidsynti.cpp
17 +++ b/muse3/synti/fluidsynth/fluidsynti.cpp
18 @@ -155,16 +155,22 @@ FluidSynth::~FluidSynth()
19 std::cerr << DEBUG_ARGS << "Error unloading soundfont!" << fluid_synth_error(fluidsynth) << std::endl;
22 +#if FLUIDSYNTH_VERSION_MAJOR < 2
23 int err = delete_fluid_synth (fluidsynth);
25 + delete_fluid_synth (fluidsynth);
32 +#if FLUIDSYNTH_VERSION_MAJOR < 2
34 std::cerr << DEBUG_ARGS << "error while destroying synth: " << fluid_synth_error(fluidsynth) << std::endl;
41 bool FluidSynth::init(const char* name)
42 @@ -1368,7 +1374,11 @@ const char* FluidSynth::getPatchName(int i, int, bool /*drum*/) const
44 fluid_preset_t *preset = fluid_synth_get_channel_preset(fluidsynth, i);
45 if (!preset) return "<unknown>";
46 +#if FLUIDSYNTH_VERSION_MAJOR < 2
47 return preset->get_name(preset);
49 + return fluid_preset_get_name(preset);
53 //---------------------------------------------------------
54 @@ -1414,12 +1424,20 @@ const MidiPatch* FluidSynth::getFirstPatch (int channel) const
55 if (!channels[channel].drumchannel) {
56 for (unsigned bank = 0; bank < 128; ++bank) {
57 for (unsigned patch = 0; patch < 128; ++patch) {
58 +#if FLUIDSYNTH_VERSION_MAJOR < 2
59 preset = sfont->get_preset (sfont, bank, patch);
61 + preset = fluid_sfont_get_preset (sfont, bank, patch);
64 midiPatch.hbank = bank;
65 midiPatch.lbank = 0xff; // Off
66 midiPatch.prog = patch;
67 +#if FLUIDSYNTH_VERSION_MAJOR < 2
68 midiPatch.name = preset->get_name (preset);
70 + midiPatch.name = fluid_preset_get_name (preset);
75 @@ -1429,12 +1447,20 @@ const MidiPatch* FluidSynth::getFirstPatch (int channel) const
76 else { //This is a drumchannel
78 for (unsigned patch = 0; patch < 128; ++patch) {
79 +#if FLUIDSYNTH_VERSION_MAJOR < 2
80 preset = sfont->get_preset (sfont, bank, patch);
82 + preset = fluid_sfont_get_preset (sfont, bank, patch);
85 midiPatch.hbank = 0xff; // Off
86 midiPatch.lbank = 0xff; // Off
87 midiPatch.prog = patch;
88 +#if FLUIDSYNTH_VERSION_MAJOR < 2
89 midiPatch.name = preset->get_name(preset);
91 + midiPatch.name = fluid_preset_get_name (preset);
96 @@ -1466,13 +1492,21 @@ const MidiPatch* FluidSynth::getNextPatch (int channel, const MidiPatch* patch)
98 for (unsigned bank = patch->hbank; bank < 128; ++bank) {
99 for ( ; prog < 128; ++prog) {
100 +#if FLUIDSYNTH_VERSION_MAJOR < 2
101 preset = sfont->get_preset (sfont, bank, prog);
103 + preset = fluid_sfont_get_preset (sfont, bank, prog);
106 //printf("Preset info: bank: %d prog: %d name: %s\n", bank, prog, preset->get_name(preset));
107 midiPatch.hbank = bank;
108 midiPatch.lbank = 0xff; // Off
109 midiPatch.prog = prog;
110 +#if FLUIDSYNTH_VERSION_MAJOR < 2
111 midiPatch.name = preset->get_name (preset);
113 + midiPatch.name = fluid_preset_get_name (preset);
118 @@ -1483,13 +1517,21 @@ const MidiPatch* FluidSynth::getNextPatch (int channel, const MidiPatch* patch)
120 unsigned prog = patch->prog;
121 for (prog = patch->prog + 1; prog < 128; ++prog) {
122 +#if FLUIDSYNTH_VERSION_MAJOR < 2
123 preset = sfont->get_preset (sfont, bank, prog);
125 + preset = fluid_sfont_get_preset (sfont, bank, prog);
128 //printf("Preset info: bank: %d prog: %d name: %s\n",bank, prog, preset->get_name(preset));
129 midiPatch.hbank = 0xff; // Off
130 midiPatch.lbank = 0xff; // Off
131 midiPatch.prog = prog;
132 +#if FLUIDSYNTH_VERSION_MAJOR < 2
133 midiPatch.name = preset->get_name (preset);
135 + midiPatch.name = fluid_preset_get_name (preset);