Hi,

On Sunday, January 21, 2024 00:07 CET, Thomas Frohwein <tfrohw...@fastmail.com> 
wrote:

> Here is a version that restores sndio support again. I'm not sure how
> best to test that what audio I'm hearing is from sndio and not sdl2,
> but with this, sndio shows up again with fluidsynth -h as audio and
> midi driver and a quick test with shockolate and simutrans still gives
> me working audio.
> 
> Please test and provide comments! I admit the CFLAGS+=-DSNDIO_SUPPORT
> is a hack, but was the quickest way to a solution to the build system
> pending a more thorough look where cmake needs to set this.

it's not perfect yet, but makes it better. QSynth starts, takes input from my 
midi controller,
but it also produces a humming noise. tested with a qsynth-0.9.12 (based on 
@rsadowsi's 
version he sent August last year)

regarding CFLAGS, we should merge in some additional patches I sent off-list, I 
got it 
to propagate properly.

Sebastian


> 
> On Sat, Jan 20, 2024 at 09:22:15PM +0100, Sebastian Reitenbach wrote:
> > On Saturday, January 20, 2024 20:51 CET, "Sebastian Reitenbach" 
> > <sebas...@l00-bugdead-prods.de> wrote:
> > 
> > > Hi,
> > > 
> > > qsynth doesn't seem to be happy. I tried @rsadowskis version from August 
> > > last year, but also updated to 0.9.12.
> > > 
> > > 20:40:55.637 Qsynth1: Synthesizer engine terminated.
> > > 20:40:58.001 Qsynth1: Creating synthesizer engine...
> > > 20:40:58.004 Qsynth1: Loading soundfont: 
> > > "/usr/local/share/generaluser-gs/GeneralUser_GS.sf2" (bank offset 0)...
> > > 20:40:58.193 Qsynth1: Loading soundfont: 
> > > "/home/sebastia/mucke/downloads/_MIDI/arachno/Arachno SoundFont - Version 
> > > 1.0.sf2" (bank offset 1)...
> > > 20:40:58.794 Qsynth1: Creating audio driver (file)...
> > > 20:40:58.795 Qsynth1: Failed to create the audio driver (file). Cannot 
> > > continue without it.
> > > fluidsynth: error: Unknown string setting 'midi.sndio.device'
> > > fluidsynth: error: Unknown string setting 'audio.jack.id'
> > > fluidsynth: error: Unknown integer parameter 'audio.jack.autoconnect'
> > > fluidsynth: error: Unknown integer parameter 'audio.jack.multi'
> > > 
> > > 
> > > also, in the past, the audio driver was "sndio", now fluidsynth only has 
> > > "file" and "sdl2" available.
> > > 
> > 
> > 
> > FluidSynth -h output of old version:
> > 
> >  -a, --audio-driver=[label]
> >     The name of the audio driver to use.
> >     Valid values: file, sndio
> > ...
> >  -m, --midi-driver=[label]
> >     The name of the midi driver to use.
> >     Valid values: sndio
> > ...
> > 
> > New FluidSynth version:
> >  -a, --audio-driver=[label]
> >     The name of the audio driver to use.
> >     Valid values: file, sdl2
> > ...
> >  -m, --midi-driver=[label]
> >     The name of the midi driver to use.
> >     Valid values:
> > ...
> > 
> > Sebastian
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/audio/fluidsynth/Makefile,v
> retrieving revision 1.35
> diff -u -p -r1.35 Makefile
> --- Makefile  20 Jan 2024 20:01:56 -0000      1.35
> +++ Makefile  20 Jan 2024 23:03:10 -0000
> @@ -3,6 +3,7 @@ COMMENT =             SoundFont2 software synthesiz
>  GH_ACCOUNT =         FluidSynth
>  GH_PROJECT =         fluidsynth
>  GH_TAGNAME =         v2.3.4
> +REVISION =           0
>  
>  SHARED_LIBS +=       fluidsynth           3.0      # 6.0
>  
> @@ -36,6 +37,8 @@ CONFIGURE_ARGS =    -DCMAKE_DISABLE_FIND_PA
>                       -Denable-oss=OFF \
>                       -Denable-pipewire=OFF \
>                       -Denable-pulseaudio=OFF
> +
> +CFLAGS +=            -DSNDIO_SUPPORT
>  
>  post-patch:
>       cp ${FILESDIR}/fluid_sndio.c ${WRKSRC}/src/drivers/
> Index: files/fluid_sndio.c
> ===================================================================
> RCS file: /cvs/ports/audio/fluidsynth/files/fluid_sndio.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 fluid_sndio.c
> --- files/fluid_sndio.c       29 Mar 2013 12:37:43 -0000      1.4
> +++ files/fluid_sndio.c       20 Jan 2024 23:03:10 -0000
> @@ -66,8 +66,6 @@ typedef struct {
>    fluid_midi_parser_t *parser;
>  } fluid_sndio_midi_driver_t;
>  
> -int delete_fluid_sndio_audio_driver(fluid_audio_driver_t* p);
> -
>  /* local utilities */
>  static void* fluid_sndio_audio_run(void* d);
>  static void* fluid_sndio_audio_run2(void* d);
> @@ -76,7 +74,7 @@ static void* fluid_sndio_audio_run2(void
>  void
>  fluid_sndio_audio_driver_settings(fluid_settings_t* settings)
>  {
> -  fluid_settings_register_str(settings, "audio.sndio.device", "default", 0, 
> NULL, NULL);
> +  fluid_settings_register_str(settings, "audio.sndio.device", "default", 0);
>  }
>  
>  /*
> @@ -109,7 +107,7 @@ new_fluid_sndio_audio_driver(fluid_setti
>    dev->data = NULL;
>    dev->cont = 1;
>  
> -  if (!fluid_settings_getstr(settings, "audio.sndio.device", &devname)) {
> +  if (!fluid_settings_getstr_default(settings, "audio.sndio.device", 
> &devname)) {
>      devname = NULL;
>    }
>  
> @@ -210,7 +208,7 @@ new_fluid_sndio_audio_driver2(fluid_sett
>    dev->data = data;
>    dev->cont = 1;
>  
> -  if (!fluid_settings_getstr(settings, "audio.sndio.device", &devname)) {
> +  if (!fluid_settings_getstr_default(settings, "audio.sndio.device", 
> &devname)) {
>      devname = NULL;
>    }
>  
> @@ -286,19 +284,19 @@ error_recovery:
>  /*
>   * delete_fluid_sndio_audio_driver
>   */
> -int
> +void
>  delete_fluid_sndio_audio_driver(fluid_audio_driver_t* p)
>  {
>    fluid_sndio_audio_driver_t* dev = (fluid_sndio_audio_driver_t*) p;
>  
>    if (dev == NULL) {
> -    return FLUID_OK;
> +    return;
>    }
>    dev->cont = 0;
>    if (dev->thread) {
>      if (pthread_join(dev->thread, NULL)) {
>        FLUID_LOG(FLUID_ERR, "Failed to join the audio thread");
> -      return FLUID_FAILED;
> +      return;
>      }
>    }
>    if (dev->hdl) {
> @@ -308,7 +306,7 @@ delete_fluid_sndio_audio_driver(fluid_au
>      FLUID_FREE(dev->buffer);
>    }
>    FLUID_FREE(dev);
> -  return FLUID_OK;
> +  return;
>  }
>  
>  /*
> @@ -372,17 +370,17 @@ fluid_sndio_audio_run2(void* d)
>  
>  void fluid_sndio_midi_driver_settings(fluid_settings_t* settings)
>  {
> -  fluid_settings_register_str(settings, "midi.sndio.device", "default", 0, 
> NULL, NULL);
> +  fluid_settings_register_str(settings, "midi.sndio.device", "default", 0);
>  }
>  
> -int
> +void
>  delete_fluid_sndio_midi_driver(fluid_midi_driver_t *addr)
>  {
>    int err;
>    fluid_sndio_midi_driver_t *dev = (fluid_sndio_midi_driver_t *)addr;
>  
>    if (dev == NULL) {
> -    return FLUID_OK;
> +    return;
>    }
>    dev->status = FLUID_MIDI_DONE;
>  
> @@ -391,11 +389,11 @@ delete_fluid_sndio_midi_driver(fluid_mid
>      err = pthread_cancel(dev->thread);
>      if (err) {
>        FLUID_LOG(FLUID_ERR, "Failed to cancel the midi thread");
> -      return FLUID_FAILED;
> +      return;
>      }
>      if (pthread_join(dev->thread, NULL)) {
>        FLUID_LOG(FLUID_ERR, "Failed to join the midi thread");
> -      return FLUID_FAILED;
> +      return;
>      }
>    }
>    if (dev->hdl != NULL) {
> @@ -405,7 +403,7 @@ delete_fluid_sndio_midi_driver(fluid_mid
>      delete_fluid_midi_parser(dev->parser);
>    }
>    FLUID_FREE(dev);
> -  return FLUID_OK;
> +  return;
>  }
>  
>  void *
> @@ -493,7 +491,7 @@ new_fluid_sndio_midi_driver(fluid_settin
>    }
>  
>    /* get the device name. if none is specified, use the default device. */
> -  if (!fluid_settings_getstr(settings, "midi.sndio.device", &device)) {
> +  if (!fluid_settings_getstr_default(settings, "midi.sndio.device", 
> &device)) {
>       device = NULL;
>    }
>  
> Index: patches/patch-FluidSynthConfig_cmake_in
> ===================================================================
> RCS file: patches/patch-FluidSynthConfig_cmake_in
> diff -N patches/patch-FluidSynthConfig_cmake_in
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-FluidSynthConfig_cmake_in   20 Jan 2024 23:03:10 -0000
> @@ -0,0 +1,9 @@
> +Index: FluidSynthConfig.cmake.in
> +--- FluidSynthConfig.cmake.in.orig
> ++++ FluidSynthConfig.cmake.in
> +@@ -1,4 +1,5 @@
> + # Audio / MIDI driver support
> ++set(FLUIDSYNTH_SUPPORT_SNDIO @SNDIO_SUPPORT@)
> + set(FLUIDSYNTH_SUPPORT_ALSA @ALSA_SUPPORT@)
> + set(FLUIDSYNTH_SUPPORT_COREAUDIO @COREAUDIO_SUPPORT@)
> + set(FLUIDSYNTH_SUPPORT_COREMIDI @COREMIDI_SUPPORT@)
> Index: patches/patch-cmake_admin_report_cmake
> ===================================================================
> RCS file: patches/patch-cmake_admin_report_cmake
> diff -N patches/patch-cmake_admin_report_cmake
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-cmake_admin_report_cmake    20 Jan 2024 23:03:10 -0000
> @@ -0,0 +1,16 @@
> +Index: cmake_admin/report.cmake
> +--- cmake_admin/report.cmake.orig
> ++++ cmake_admin/report.cmake
> +@@ -1,6 +1,12 @@
> + 
> + set ( AUDIO_MIDI_REPORT "\n" )
> + 
> ++if ( SNDIO_SUPPORT )
> ++    set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT}  sndio                  
> yes\n" )
> ++else ( SNDIO_SUPPORT )
> ++    set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT}  sndio                  
> no\n" )
> ++endif ( SNDIO_SUPPORT )
> ++
> + if ( ALSA_SUPPORT )
> +     set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT}  ALSA:                  
> yes\n" )
> + else ( ALSA_SUPPORT ) 
> Index: patches/patch-src_drivers_fluid_adriver_c
> ===================================================================
> RCS file: patches/patch-src_drivers_fluid_adriver_c
> diff -N patches/patch-src_drivers_fluid_adriver_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_drivers_fluid_adriver_c 20 Jan 2024 23:03:10 -0000
> @@ -0,0 +1,20 @@
> +Index: src/drivers/fluid_adriver.c
> +--- src/drivers/fluid_adriver.c.orig
> ++++ src/drivers/fluid_adriver.c
> +@@ -40,6 +40,16 @@ struct _fluid_audriver_definition_t
> + /* Available audio drivers, listed in order of preference */
> + static const fluid_audriver_definition_t fluid_audio_drivers[] =
> + {
> ++#if SNDIO_SUPPORT
> ++    {
> ++        "sndio",
> ++        new_fluid_sndio_audio_driver,
> ++        new_fluid_sndio_audio_driver2,
> ++        delete_fluid_sndio_audio_driver,
> ++        fluid_sndio_audio_driver_settings
> ++    },
> ++#endif
> ++
> + #if ALSA_SUPPORT
> +     {
> +         "alsa",
> Index: patches/patch-src_drivers_fluid_adriver_h
> ===================================================================
> RCS file: patches/patch-src_drivers_fluid_adriver_h
> diff -N patches/patch-src_drivers_fluid_adriver_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_drivers_fluid_adriver_h 20 Jan 2024 23:03:10 -0000
> @@ -0,0 +1,19 @@
> +Index: src/drivers/fluid_adriver.h
> +--- src/drivers/fluid_adriver.h.orig
> ++++ src/drivers/fluid_adriver.h
> +@@ -43,6 +43,15 @@ void fluid_audio_driver_settings(fluid_settings_t *set
> + /* Defined in fluid_filerenderer.c */
> + void fluid_file_renderer_settings(fluid_settings_t *settings);
> + 
> ++#if SNDIO_SUPPORT
> ++fluid_audio_driver_t *new_fluid_sndio_audio_driver(fluid_settings_t 
> *settings,
> ++        fluid_synth_t *synth);
> ++fluid_audio_driver_t *new_fluid_sndio_audio_driver2(fluid_settings_t 
> *settings,
> ++        fluid_audio_func_t func, void *data);
> ++void delete_fluid_sndio_audio_driver(fluid_audio_driver_t *p);
> ++void fluid_sndio_audio_driver_settings(fluid_settings_t *settings);
> ++#endif
> ++
> + #if PULSE_SUPPORT
> + fluid_audio_driver_t *new_fluid_pulse_audio_driver(fluid_settings_t 
> *settings,
> +         fluid_synth_t *synth);
> Index: patches/patch-src_drivers_fluid_mdriver_c
> ===================================================================
> RCS file: patches/patch-src_drivers_fluid_mdriver_c
> diff -N patches/patch-src_drivers_fluid_mdriver_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_drivers_fluid_mdriver_c 20 Jan 2024 23:03:10 -0000
> @@ -0,0 +1,18 @@
> +Index: src/drivers/fluid_mdriver.c
> +--- src/drivers/fluid_mdriver.c.orig
> ++++ src/drivers/fluid_mdriver.c
> +@@ -38,6 +38,14 @@ struct _fluid_mdriver_definition_t
> + 
> + static const fluid_mdriver_definition_t fluid_midi_drivers[] =
> + {
> ++#if SNDIO_SUPPORT
> ++    {
> ++        "sndio",
> ++        new_fluid_sndio_midi_driver,
> ++        delete_fluid_sndio_midi_driver,
> ++        fluid_sndio_midi_driver_settings
> ++    },
> ++#endif
> + #if ALSA_SUPPORT
> +     {
> +         "alsa_seq",
> Index: patches/patch-src_drivers_fluid_mdriver_h
> ===================================================================
> RCS file: patches/patch-src_drivers_fluid_mdriver_h
> diff -N patches/patch-src_drivers_fluid_mdriver_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_drivers_fluid_mdriver_h 20 Jan 2024 23:03:10 -0000
> @@ -0,0 +1,19 @@
> +Index: src/drivers/fluid_mdriver.h
> +--- src/drivers/fluid_mdriver.h.orig
> ++++ src/drivers/fluid_mdriver.h
> +@@ -38,6 +38,15 @@ struct _fluid_midi_driver_t
> + 
> + void fluid_midi_driver_settings(fluid_settings_t *settings);
> + 
> ++/* sndio */
> ++#if SNDIO_SUPPORT
> ++fluid_midi_driver_t *new_fluid_sndio_midi_driver(fluid_settings_t *settings,
> ++        handle_midi_event_func_t handler,
> ++        void *event_handler_data);
> ++void delete_fluid_sndio_midi_driver(fluid_midi_driver_t *p);
> ++void fluid_sndio_midi_driver_settings(fluid_settings_t *settings);
> ++#endif
> ++
> + /* ALSA */
> + #if ALSA_SUPPORT
> + fluid_midi_driver_t *new_fluid_alsa_rawmidi_driver(fluid_settings_t 
> *settings,

Reply via email to