1- From 4edd86332c57377c74a3694129ba9efb91ad82d9 Mon Sep 17 00:00:00 2001
1+ From 192ef394e0806aaff18aa0d04eeb56b9a7df058d Mon Sep 17 00:00:00 2001
22From: Ghabry
33Date: Fri, 17 Mar 2023 14:00:45 +0100
44Subject: [PATCH 1/2] Shim glib
55
66---
77 CMakeLists.txt | 4 +-
8+ FluidSynthConfig.cmake.in | 2 +-
89 src/CMakeLists.txt | 3 +-
910 src/bindings/fluid_cmd.c | 3 +
1011 src/glib_shim.c | 12 ++++
@@ -18,12 +19,12 @@ Subject: [PATCH 1/2] Shim glib
1819 src/utils/fluid_sys.c | 9 ++-
1920 src/utils/fluid_sys.h | 8 +--
2021 src/utils/fluidsynth_priv.h | 2 +-
21- 14 files changed, 142 insertions(+), 35 deletions(-)
22+ 15 files changed, 143 insertions(+), 36 deletions(-)
2223 create mode 100644 src/glib_shim.c
2324 create mode 100644 src/glib_shim.h
2425
2526diff --git a/CMakeLists.txt b/CMakeLists.txt
26- index 849f8b3..d86b9bc 100644
27+ index 75b8862..8d48251 100644
2728--- a/CMakeLists.txt
2829+++ b/CMakeLists.txt
2930@@ -533,8 +533,8 @@ if ( CMAKE_VERSION VERSION_GREATER_EQUAL 3.15 AND VCPKG_TOOLCHAIN )
@@ -37,8 +38,21 @@ index 849f8b3..d86b9bc 100644
3738
3839 if ( GLib2_VERSION AND GLib2_VERSION VERSION_LESS "2.26.0" )
3940 message ( WARNING "Your version of glib is very old. This may cause problems with fluidsynth's sample cache on Windows. Consider updating to glib 2.26 or newer!" )
41+ diff --git a/FluidSynthConfig.cmake.in b/FluidSynthConfig.cmake.in
42+ index d2e0c5e..683d10c 100644
43+ --- a/FluidSynthConfig.cmake.in
44+ +++ b/FluidSynthConfig.cmake.in
45+ @@ -73,7 +73,7 @@ if(NOT FLUIDSYNTH_IS_SHARED)
46+ endif()
47+
48+ if(NOT TARGET GLib2::glib-2 OR NOT TARGET GLib2::gthread-2)
49+ - find_dependency(GLib2 @GLIB2_MINUMUM_VERSION@)
50+ + #find_dependency(GLib2 @GLIB2_MINUMUM_VERSION@)
51+ endif()
52+
53+ # Optional dependencies
4054diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
41- index a2f9e55..e2a1d75 100644
55+ index 0275227..65d8a1a 100644
4256--- a/src/CMakeLists.txt
4357+++ b/src/CMakeLists.txt
4458@@ -108,6 +108,7 @@ endif ( OBOE_SUPPORT )
@@ -49,7 +63,7 @@ index a2f9e55..e2a1d75 100644
4963 utils/fluid_conv.c
5064 utils/fluid_conv.h
5165 utils/fluid_hash.c
52- @@ -363 ,7 +364 ,7 @@ if ( TARGET OpenMP::OpenMP_C AND HAVE_OPENMP )
66+ @@ -352 ,7 +353 ,7 @@ if ( TARGET OpenMP::OpenMP_C AND HAVE_OPENMP )
5367 target_link_libraries ( libfluidsynth-OBJ PUBLIC OpenMP::OpenMP_C )
5468 endif()
5569
@@ -308,10 +322,10 @@ index 64e9e9e..4c504c0 100644
308322 }
309323
310324diff --git a/src/sfloader/fluid_sffile.c b/src/sfloader/fluid_sffile.c
311- index 8359424..2aae4db 100644
325+ index 21535c9..ee3aa0b 100644
312326--- a/src/sfloader/fluid_sffile.c
313327+++ b/src/sfloader/fluid_sffile.c
314- @@ -2252 ,10 +2252 ,14 @@ static int fluid_sffile_read_wav(SFData *sf, unsigned int start, unsigned int en
328+ @@ -2258 ,10 +2258 ,14 @@ static int fluid_sffile_read_wav(SFData *sf, unsigned int start, unsigned int en
315329 if(FLUID_IS_BIG_ENDIAN)
316330 {
317331 unsigned int i;
@@ -328,10 +342,10 @@ index 8359424..2aae4db 100644
328342 }
329343
330344diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c
331- index e356982..dbfe900 100644
345+ index 82cfac4..76fed3d 100644
332346--- a/src/synth/fluid_synth.c
333347+++ b/src/synth/fluid_synth.c
334- @@ -636 ,8 +636 ,9 @@ new_fluid_synth(fluid_settings_t *settings)
348+ @@ -637 ,8 +637 ,9 @@ new_fluid_synth(fluid_settings_t *settings)
335349 double sample_rate_min, sample_rate_max;
336350
337351 /* initialize all the conversion tables and other stuff */
@@ -342,7 +356,7 @@ index e356982..dbfe900 100644
342356 fluid_synth_init();
343357 }
344358
345- @@ -813 ,7 +814 ,7 @@ new_fluid_synth(fluid_settings_t *settings)
359+ @@ -817 ,7 +818 ,7 @@ new_fluid_synth(fluid_settings_t *settings)
346360
347361 fluid_atomic_int_set(&synth->ticks_since_start, 0);
348362 synth->tuning = NULL;
@@ -351,7 +365,7 @@ index e356982..dbfe900 100644
351365
352366 /* Initialize multi-core variables if multiple cores enabled */
353367 if(synth->cores > 1)
354- @@ -1199 ,7 +1200 ,7 @@ delete_fluid_synth(fluid_synth_t *synth)
368+ @@ -1203 ,7 +1204 ,7 @@ delete_fluid_synth(fluid_synth_t *synth)
355369 FLUID_FREE(synth->tuning);
356370 }
357371
@@ -360,7 +374,7 @@ index e356982..dbfe900 100644
360374
361375 #ifdef LADSPA
362376 /* Release the LADSPA effects unit */
363- @@ -7450 ,7 +7451 ,7 @@ fluid_synth_tuning_iteration_start(fluid_synth_t *synth)
377+ @@ -7451 ,7 +7452 ,7 @@ fluid_synth_tuning_iteration_start(fluid_synth_t *synth)
364378 {
365379 fluid_return_if_fail(synth != NULL);
366380 fluid_synth_api_enter(synth);
@@ -369,7 +383,7 @@ index e356982..dbfe900 100644
369383 fluid_synth_api_exit(synth);
370384 }
371385
372- @@ -7473 ,7 +7474 ,7 @@ fluid_synth_tuning_iteration_next(fluid_synth_t *synth, int *bank, int *prog)
386+ @@ -7474 ,7 +7475 ,7 @@ fluid_synth_tuning_iteration_next(fluid_synth_t *synth, int *bank, int *prog)
373387 fluid_synth_api_enter(synth);
374388
375389 /* Current tuning iteration stored as: bank << 8 | program */
@@ -378,7 +392,7 @@ index e356982..dbfe900 100644
378392 p = FLUID_POINTER_TO_INT(pval);
379393 b = (p >> 8) & 0xFF;
380394 p &= 0xFF;
381- @@ -7502 ,12 +7503 ,11 @@ fluid_synth_tuning_iteration_next(fluid_synth_t *synth, int *bank, int *prog)
395+ @@ -7503 ,12 +7504 ,11 @@ fluid_synth_tuning_iteration_next(fluid_synth_t *synth, int *bank, int *prog)
382396
383397 if(p < 127)
384398 {
@@ -394,10 +408,10 @@ index e356982..dbfe900 100644
394408
395409 FLUID_API_RETURN(1);
396410diff --git a/src/synth/fluid_synth.h b/src/synth/fluid_synth.h
397- index 7dbcdc5..97f5175 100644
411+ index bcd964f..56c7976 100644
398412--- a/src/synth/fluid_synth.h
399413+++ b/src/synth/fluid_synth.h
400- @@ -152 ,7 +152 ,7 @@ struct _fluid_synth_t
414+ @@ -158 ,7 +158 ,7 @@ struct _fluid_synth_t
401415 fluid_atomic_float_t cpu_load; /**< CPU load in percent (CPU time required / audio synthesized time * 100) */
402416
403417 fluid_tuning_t ***tuning; /**< 128 banks of 128 programs for the tunings */
@@ -462,7 +476,7 @@ index babb11f..e82094b 100644
462476 #if OLD_GLIB_THREAD_API
463477
464478diff --git a/src/utils/fluid_sys.h b/src/utils/fluid_sys.h
465- index a756fc0..73abd98 100644
479+ index f491254..1521c4c 100644
466480--- a/src/utils/fluid_sys.h
467481+++ b/src/utils/fluid_sys.h
468482@@ -175,7 +175,7 @@ typedef gintptr intptr_t;
@@ -472,9 +486,9 @@ index a756fc0..73abd98 100644
472486- #include <glib/gstdio.h>
473487+ #include "glib_shim.h"
474488
475- /**
476- * Macro used for safely accessing a message from a GError and using a default
477- @@ -183 ,7 +183 ,7 @@ typedef gintptr intptr_t;
489+ #ifdef __cplusplus
490+ extern "C" {
491+ @@ -187 ,7 +187 ,7 @@ extern "C" {
478492 * @param err Pointer to a GError to access the message field of.
479493 * @return Message string
480494 */
@@ -483,7 +497,7 @@ index a756fc0..73abd98 100644
483497
484498 #if defined(_WIN32) || defined(__CYGWIN__)
485499 char* fluid_get_windows_error(void);
486- @@ -336 ,13 +336 ,13 @@ delete_fluid_cond(fluid_cond_t *cond)
500+ @@ -340 ,13 +340 ,13 @@ delete_fluid_cond(fluid_cond_t *cond)
487501 }
488502
489503 /* Thread private data */
@@ -513,5 +527,5 @@ index 67e97ab..9dcfbb7 100644
513527 #if HAVE_STDLIB_H
514528 #include <stdlib.h> // malloc, free
515529- -
516- 2.47 .1
530+ 2.48 .1
517531
0 commit comments