LMMS
Loading...
Searching...
No Matches
fluidsynthshims.h
Go to the documentation of this file.
1/*
2 * fluidsynthshims.h - a shim header for FluidSynth 2.0 API changes
3 *
4 * Copyright (c) 2018 Hyunjin Song <tteu.ingog@gmail.com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25
26#ifndef FLUIDSYNTHSHIMS_H
27#define FLUIDSYNTHSHIMS_H
28
29#include <fluidsynth.h>
30
31
32#if FLUIDSYNTH_VERSION_MAJOR < 2
33
34inline const char* fluid_preset_get_name(fluid_preset_t* preset)
35{
36 return preset->get_name(preset);
37}
38
39inline int fluid_preset_get_banknum(fluid_preset_t* preset)
40{
41 return preset->get_banknum(preset);
42}
43
44inline int fluid_preset_get_num(fluid_preset_t* preset)
45{
46 return preset->get_num(preset);
47}
48
49inline fluid_sfont_t* fluid_preset_get_sfont(fluid_preset_t* preset)
50{
51 return preset->sfont;
52}
53
54inline char* fluid_sfont_get_name(fluid_sfont_t* sfont)
55{
56 return sfont->get_name(sfont);
57}
58
59inline void fluid_sfont_iteration_start(fluid_sfont_t* sfont)
60{
61 sfont->iteration_start(sfont);
62}
63
64// Due to the API change, we can't simply shim the 'fluid_sfont_iteration_next' function
65inline fluid_preset_t* fluid_sfont_iteration_next_wrapper(fluid_sfont_t* sfont, fluid_preset_t* preset)
66{
67 return sfont->iteration_next(sfont, preset) ? preset : nullptr;
68}
69
70#else // FLUIDSYNTH_VERSION_MAJOR < 2
71
72#define FLUID_REVERB_DEFAULT_ROOMSIZE 0.2f
73#define FLUID_REVERB_DEFAULT_DAMP 0.0f
74#define FLUID_REVERB_DEFAULT_WIDTH 0.5f
75#define FLUID_REVERB_DEFAULT_LEVEL 0.9f
76
77#define FLUID_CHORUS_DEFAULT_N 3
78#define FLUID_CHORUS_DEFAULT_LEVEL 2.0f
79#define FLUID_CHORUS_DEFAULT_SPEED 0.3f
80#define FLUID_CHORUS_DEFAULT_DEPTH 8.0f
81
82inline fluid_preset_t* fluid_sfont_iteration_next_wrapper(fluid_sfont_t* sfont, fluid_preset_t*)
83{
84 return fluid_sfont_iteration_next(sfont);
85}
86
87#endif // FLUIDSYNTH_VERSION_MAJOR < 2
88
89#endif // FLUIDSYNTHSHIMS_H
fluid_sfont_t * fluid_preset_get_sfont(fluid_preset_t *preset)
Definition fluidsynthshims.h:49
fluid_preset_t * fluid_sfont_iteration_next_wrapper(fluid_sfont_t *sfont, fluid_preset_t *preset)
Definition fluidsynthshims.h:65
void fluid_sfont_iteration_start(fluid_sfont_t *sfont)
Definition fluidsynthshims.h:59
const char * fluid_preset_get_name(fluid_preset_t *preset)
Definition fluidsynthshims.h:34
int fluid_preset_get_banknum(fluid_preset_t *preset)
Definition fluidsynthshims.h:39
char * fluid_sfont_get_name(fluid_sfont_t *sfont)
Definition fluidsynthshims.h:54
int fluid_preset_get_num(fluid_preset_t *preset)
Definition fluidsynthshims.h:44