FludSynth: fix build for secondary arch

This commit is contained in:
Gerasim Troeglazov
2019-04-14 17:32:29 +10:00
parent 56e5629537
commit 42e46403ac
4 changed files with 41 additions and 92 deletions

View File

@@ -1,11 +1,11 @@
From 413c2e913b7ce390490497bce402baa60beb0ed0 Mon Sep 17 00:00:00 2001
From 1de2ce8007aa2c20613162d8b21896a9aaeadf73 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 14 Apr 2019 13:31:52 +1000
Date: Sun, 14 Apr 2019 17:26:24 +1000
Subject: Add Haiku MediaKit support
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b13d958..6d6b2c4 100644
index b13d958..90d9876 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,8 @@
@@ -82,20 +82,6 @@ index b13d958..6d6b2c4 100644
endif(NOT enable-pkgconfig)
unset ( AUFILE_SUPPORT CACHE )
@@ -482,8 +500,13 @@ else ()
endif ()
configure_file ( fluidsynth.pc.in
${CMAKE_BINARY_DIR}/fluidsynth.pc IMMEDIATE @ONLY )
+if ( HAIKU )
+install ( FILES ${CMAKE_BINARY_DIR}/fluidsynth.pc
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}${LIB_SUFFIX}/pkgconfig )
+else ( HAIKU )
install ( FILES ${CMAKE_BINARY_DIR}/fluidsynth.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
+endif ( HAIKU )
# Extra targets for Unix build environments
if ( UNIX )
diff --git a/cmake_admin/report.cmake b/cmake_admin/report.cmake
index 1a7fcca..05449fe 100644
--- a/cmake_admin/report.cmake
@@ -206,10 +192,10 @@ index da77e1f..cd2a861 100644
#endif
diff --git a/src/drivers/fluid_haiku.cpp b/src/drivers/fluid_haiku.cpp
new file mode 100644
index 0000000..0c4243d
index 0000000..26b6c34
--- /dev/null
+++ b/src/drivers/fluid_haiku.cpp
@@ -0,0 +1,149 @@
@@ -0,0 +1,151 @@
+/* Haiku MediaKit Driver for FluidSynth
+ *
+ * Copyright (C) 2019 Gerasim Troeglazov
@@ -234,6 +220,8 @@ index 0000000..0c4243d
+#include <SupportKit.h>
+
+extern "C" {
+//Hack for uint32 conflict
+#define uint32 XXX
+#include "fluid_synth.h"
+#include "fluid_adriver.h"
+#include "fluid_settings.h"
@@ -372,21 +360,23 @@ index 7b5ece4..76d1e50 100644
settings = new_fluid_settings();
diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c
index 6b5c951..0498e82 100644
index 6b5c951..09ea964 100644
--- a/src/synth/fluid_synth.c
+++ b/src/synth/fluid_synth.c
@@ -29,6 +29,10 @@
#include "fluid_hash.h"
#include "fluid_defsfont.h"
@@ -20,6 +20,12 @@
#include <math.h>
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+//Hack for uint32 conflict
+#define uint32 XXX
+#endif
+
#ifdef TRAP_ON_FPE
#define _GNU_SOURCE
#include <fenv.h>
@@ -186,8 +190,25 @@ void fluid_synth_settings(fluid_settings_t* settings)
#include "fluid_synth.h"
#include "fluid_sys.h"
#include "fluid_chan.h"
@@ -186,8 +192,25 @@ void fluid_synth_settings(fluid_settings_t* settings)
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_str(settings, "midi.portname", "", 0, NULL, NULL);

View File

@@ -1,11 +1,11 @@
From 6c276fc426e1482c9f62155c6f3090353396192a Mon Sep 17 00:00:00 2001
From a1e84fb39c3b2fbbd4e5cd9c84250467d01ec9d7 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 14 Apr 2019 11:09:51 +1000
Subject: Add MediaKit support
Date: Sun, 14 Apr 2019 17:27:45 +1000
Subject: Add Haiku MediaKit support
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b759259..0e37e9f 100644
index b759259..9622a62 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,8 @@
@@ -82,20 +82,6 @@ index b759259..0e37e9f 100644
endif(NOT enable-pkgconfig)
unset ( AUFILE_SUPPORT CACHE )
@@ -637,8 +655,13 @@ else ()
endif ()
configure_file ( fluidsynth.pc.in
${CMAKE_BINARY_DIR}/fluidsynth.pc IMMEDIATE @ONLY )
+if ( HAIKU )
+install ( FILES ${CMAKE_BINARY_DIR}/fluidsynth.pc
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}${LIB_SUFFIX}/pkgconfig )
+else ( HAIKU )
install ( FILES ${CMAKE_BINARY_DIR}/fluidsynth.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
+endif ( HAIKU)
# Extra targets for Unix build environments
if ( UNIX )
diff --git a/cmake_admin/report.cmake b/cmake_admin/report.cmake
index e25a989..be77acc 100644
--- a/cmake_admin/report.cmake
@@ -191,10 +177,10 @@ index 5cfc688..ace6353 100644
fluid_synth_t *synth);
diff --git a/src/drivers/fluid_haiku.cpp b/src/drivers/fluid_haiku.cpp
new file mode 100644
index 0000000..31bfdea
index 0000000..2871948
--- /dev/null
+++ b/src/drivers/fluid_haiku.cpp
@@ -0,0 +1,139 @@
@@ -0,0 +1,140 @@
+/* Haiku MediaKit Driver for FluidSynth
+ *
+ * Copyright (C) 2019 Gerasim Troeglazov
@@ -326,12 +312,13 @@ index 0000000..31bfdea
+void delete_fluid_haiku_audio_driver(fluid_audio_driver_t *d)
+{
+ fluid_haiku_audio_driver_t *dev = (fluid_haiku_audio_driver_t *) d;
+ if (dev->m_player) {
+ if (dev->m_player != NULL) {
+ dev->m_player->SetHasData(false);
+ dev->m_player->Stop();
+ delete dev->m_player;
+ dev->m_player = NULL;
+ }
+ FLUID_FREE(dev);
+}
+
diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c
@@ -391,31 +378,3 @@ index 9f2d6f6..f3d1464 100644
--
2.21.0
From 3a61c410708d121233477c684494ef3f8f5d731d Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 14 Apr 2019 13:37:19 +1000
Subject: Fix memory leaks
diff --git a/src/drivers/fluid_haiku.cpp b/src/drivers/fluid_haiku.cpp
index 31bfdea..2871948 100644
--- a/src/drivers/fluid_haiku.cpp
+++ b/src/drivers/fluid_haiku.cpp
@@ -129,11 +129,12 @@ new_fluid_haiku_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
void delete_fluid_haiku_audio_driver(fluid_audio_driver_t *d)
{
fluid_haiku_audio_driver_t *dev = (fluid_haiku_audio_driver_t *) d;
- if (dev->m_player) {
+ if (dev->m_player != NULL) {
dev->m_player->SetHasData(false);
dev->m_player->Stop();
delete dev->m_player;
dev->m_player = NULL;
}
+ FLUID_FREE(dev);
}
--
2.21.0