fluidsynthshims.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #ifndef FLUIDSYNTHSHIMS_H
  25. #define FLUIDSYNTHSHIMS_H
  26. #include <fluidsynth.h>
  27. #if FLUIDSYNTH_VERSION_MAJOR < 2
  28. inline const char* fluid_preset_get_name(fluid_preset_t* preset)
  29. {
  30. return preset->get_name(preset);
  31. }
  32. inline int fluid_preset_get_banknum(fluid_preset_t* preset)
  33. {
  34. return preset->get_banknum(preset);
  35. }
  36. inline int fluid_preset_get_num(fluid_preset_t* preset)
  37. {
  38. return preset->get_num(preset);
  39. }
  40. inline fluid_sfont_t* fluid_preset_get_sfont(fluid_preset_t* preset)
  41. {
  42. return preset->sfont;
  43. }
  44. inline char* fluid_sfont_get_name(fluid_sfont_t* sfont)
  45. {
  46. return sfont->get_name(sfont);
  47. }
  48. inline void fluid_sfont_iteration_start(fluid_sfont_t* sfont)
  49. {
  50. sfont->iteration_start(sfont);
  51. }
  52. // Due to the API change, we can't simply shim the 'fluid_sfont_iteration_next' function
  53. inline fluid_preset_t* fluid_sfont_iteration_next_wrapper(fluid_sfont_t* sfont, fluid_preset_t* preset)
  54. {
  55. return sfont->iteration_next(sfont, preset) ? preset : nullptr;
  56. }
  57. #else // FLUIDSYNTH_VERSION_MAJOR < 2
  58. #define FLUID_REVERB_DEFAULT_ROOMSIZE 0.2f
  59. #define FLUID_REVERB_DEFAULT_DAMP 0.0f
  60. #define FLUID_REVERB_DEFAULT_WIDTH 0.5f
  61. #define FLUID_REVERB_DEFAULT_LEVEL 0.9f
  62. #define FLUID_CHORUS_DEFAULT_N 3
  63. #define FLUID_CHORUS_DEFAULT_LEVEL 2.0f
  64. #define FLUID_CHORUS_DEFAULT_SPEED 0.3f
  65. #define FLUID_CHORUS_DEFAULT_DEPTH 8.0f
  66. inline fluid_preset_t* fluid_sfont_iteration_next_wrapper(fluid_sfont_t* sfont, fluid_preset_t*)
  67. {
  68. return fluid_sfont_iteration_next(sfont);
  69. }
  70. #endif // FLUIDSYNTH_VERSION_MAJOR < 2
  71. #endif // FLUIDSYNTHSHIMS_H