On Mon, 18 Sep 2023 17:49:45 +0100
Jon Turney wrote:
> On 17/09/2023 14:14, Takashi Yano via Cygwin-apps wrote:
> > I'd like adopt the fluidsynth package.
> > Thanks in advance.
> 
> Thanks.
> 
> I added this to your packages.
> 
> > 
> > fluidsynth.cygport
> > 
> > inherit cmake
> > 
> > NAME="fluidsynth"
> > VERSION=2.3.2
> > RELEASE=1
> > LICENSE="LGPL-2.1-or-later"
> > CATEGORY="Audio"
> > SUMMARY="SoundFont software synthesizer"
> > DESCRIPTION="FluidSynth is a real-time software synthesizer based on the
> > SoundFont 2 specifications."
> > HOMEPAGE="http://www.fluidsynth.org/";
> > SRC_URI="https://github.com/FluidSynth/fluidsynth/archive/v${VERSION}/fluidsynth-${VERSION}.tar.gz";
> > 
> > PKG_NAMES="${NAME} lib${NAME}3 lib${NAME}-devel"
> > fluidsynth_CONTENTS="usr/bin/*.exe usr/share/"
> > libfluidsynth3_CATEGORY="Libs"
> > libfluidsynth3_SUMMARY="${SUMMARY} library"
> > libfluidsynth3_CONTENTS="usr/bin/cygfluidsynth-3.dll"
> > libfluidsynth_devel_CATEGORY="Libs"
> > libfluidsynth_devel_SUMMARY="${SUMMARY} library"
> > libfluidsynth_devel_CONTENTS="
> >     usr/include/fluidsynth*
> >     usr/lib/libfluidsynth.dll.a
> >     usr/lib/pkgconfig/fluidsynth.pc
> > "
> > 
> > PKG_IGNORE="usr/lib/cmake/fluidsynth/*.cmake"
> 
> It would be normal to include these files in the libfluidsynth_devel 
> package, for use by cmake's find_package command.

Yeah, I have includes them in devel package.

> Is there some reason to exclude them? If so, a comment explaining why 
> would be a good idea.
> 
> > # dbus: only for RealtimeKit
> > # portaudio: playback is just static
> 
> Maybe the last line in this comment is no longer accurate?

I confirmed that fluidsynth works properly with latest portaudio package.
So, I enabled the support for portaudio. I forgot to delete this line.
Thanks.

I have revised the project files. Could you please recheck them?

-- 
Takashi Yano <takashi.y...@nifty.ne.jp>
inherit cmake

NAME="fluidsynth"
VERSION=2.3.2
RELEASE=1
LICENSE="LGPL-2.1-or-later"
CATEGORY="Audio"
SUMMARY="SoundFont software synthesizer"
DESCRIPTION="FluidSynth is a real-time software synthesizer based on the
SoundFont 2 specifications."
HOMEPAGE="http://www.fluidsynth.org/";
SRC_URI="https://github.com/FluidSynth/fluidsynth/archive/v${VERSION}/fluidsynth-${VERSION}.tar.gz";

PKG_NAMES="${NAME} lib${NAME}3 lib${NAME}-devel"
fluidsynth_CONTENTS="usr/bin/*.exe usr/share/"
libfluidsynth3_CATEGORY="Libs"
libfluidsynth3_SUMMARY="${SUMMARY} library"
libfluidsynth3_CONTENTS="usr/bin/cygfluidsynth-3.dll"
libfluidsynth_devel_CATEGORY="Libs"
libfluidsynth_devel_SUMMARY="${SUMMARY} library"
libfluidsynth_devel_CONTENTS="
        usr/include/fluidsynth*
        usr/lib/libfluidsynth.dll.a
        usr/lib/pkgconfig/fluidsynth.pc
        usr/lib/cmake/fluidsynth/*.cmake
"

# dbus: only for RealtimeKit
CYGCMAKE_ARGS="
        -Denable-dbus=OFF
        -Denable-midishare=OFF
        -Denable-portaudio=ON
"
--- origsrc/fluidsynth-2.3.2/src/drivers/fluid_dsound.c 2023-04-03 
00:54:17.000000000 +0900
+++ src/fluidsynth-2.3.2/src/drivers/fluid_dsound.c     2023-09-16 
00:02:53.038824600 +0900
@@ -28,6 +28,7 @@
 #if DSOUND_SUPPORT
 
 
+#include <windows.h>
 #include <mmsystem.h>
 #include <dsound.h>
 #include <mmreg.h>
--- origsrc/fluidsynth-2.3.2/src/drivers/fluid_oss.c    2023-04-03 
00:54:17.000000000 +0900
+++ src/fluidsynth-2.3.2/src/drivers/fluid_oss.c        2023-09-16 
12:35:49.965676900 +0900
@@ -109,6 +109,22 @@ fluid_oss_audio_driver_settings(fluid_se
     fluid_settings_register_str(settings, "audio.oss.device", "/dev/dsp", 0);
 }
 
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+static int get_cygwin_version(void);
+static int cygwin_version;
+static int get_cygwin_version(void)
+{
+    int cygwin_version = 3004006;
+    char *ver = (char *) (intptr_t) cygwin_internal(CW_GETVERSIONINFO);
+    int major, minor;
+    if (2 == sscanf(ver, "%*s\n%%%%%% Cygwin dll major: %d\n"
+                    "%%%%%% Cygwin dll minor: %d", &major, &minor))
+        cygwin_version = major * 1000 + minor;
+    return cygwin_version;
+}
+#endif
+
 /*
  * new_fluid_oss_audio_driver
  */
@@ -133,6 +149,10 @@ new_fluid_oss_audio_driver(fluid_setting
         return NULL;
     }
 
+#ifdef __CYGWIN__
+    cygwin_version = get_cygwin_version();
+#endif
+
     FLUID_MEMSET(dev, 0, sizeof(fluid_oss_audio_driver_t));
 
     fluid_settings_getint(settings, "audio.periods", &periods);
@@ -306,6 +326,10 @@ new_fluid_oss_audio_driver2(fluid_settin
         return NULL;
     }
 
+#ifdef __CYGWIN
+    cygwin_version = get_cygwin_version();
+#endif
+
     FLUID_MEMSET(dev, 0, sizeof(fluid_oss_audio_driver_t));
 
     fluid_settings_getint(settings, "audio.periods", &periods);
@@ -540,6 +572,19 @@ fluid_oss_audio_run(void *d)
     {
         dev->read(synth, len, buffer, 0, 2, buffer, 1, 2);
 
+#ifdef __CYGWIN__
+        for (;;)
+        {
+            audio_buf_info info;
+            ioctl(dev->dspfd, SNDCTL_DSP_GETOSPACE, &info);
+            /* Reduce latency in cygwin before 3.5.0. */
+            if (cygwin_version < 3005000)
+                info.bytes -= info.fragsize * (info.fragstotal - 4);
+            if (info.bytes >= dev->buffer_byte_size)
+                break;
+            usleep(100);
+        }
+#endif
         if(write(dev->dspfd, buffer, dev->buffer_byte_size) < 0)
         {
             FLUID_LOG(FLUID_ERR, "Error writing to OSS sound device: %s",
--- origsrc/fluidsynth-2.3.2/src/drivers/fluid_winmidi.c        2023-04-03 
00:54:17.000000000 +0900
+++ src/fluidsynth-2.3.2/src/drivers/fluid_winmidi.c    2023-09-16 
00:02:53.038824600 +0900
@@ -75,6 +75,8 @@
 #include "fluid_midi.h"
 #include "fluid_mdriver.h"
 #include "fluid_settings.h"
+#include <windows.h>
+#include <mmsystem.h>
 
 #define MIDI_SYSEX_MAX_SIZE     512
 #define MIDI_SYSEX_BUF_COUNT    16
--- origsrc/fluidsynth-2.3.2/src/fluidsynth.c   2023-04-03 00:54:17.000000000 
+0900
+++ src/fluidsynth-2.3.2/src/fluidsynth.c       2023-09-16 00:02:53.038824600 
+0900
@@ -39,6 +39,7 @@
 #endif
 
 #if SDL2_SUPPORT
+#define SDL_MAIN_HANDLED 1
 #include <SDL.h>
 #endif
 
--- origsrc/fluidsynth-2.3.2/src/utils/fluid_sys.h      2023-04-03 
00:54:17.000000000 +0900
+++ src/fluidsynth-2.3.2/src/utils/fluid_sys.h  2023-09-16 00:02:53.048837900 
+0900
@@ -137,6 +137,7 @@ typedef gintptr  intptr_t;
  */
 #if defined(__CYGWIN__) && HAVE_WINDOWS_H
 #include <windows.h>
+#undef __MINGW64_VERSION_MAJOR
 #include <wchar.h>
 #endif
 
--- origsrc/fluidsynth-2.3.2/src/utils/fluidsynth_priv.h        2023-04-03 
00:54:17.000000000 +0900
+++ src/fluidsynth-2.3.2/src/utils/fluidsynth_priv.h    2023-09-16 
00:02:53.048837900 +0900
@@ -45,6 +45,11 @@
 #include <string.h>
 #endif
 
+#ifdef __CYGWIN__
+#define DSOUND_SUPPORT 1
+#define WINMIDI_SUPPORT 1
+#endif
+
 
 #include "fluidsynth.h"
 

Reply via email to