From: "Sebastian Reitenbach" Subject: Re: fluidsynth update 2.3.4 To: "Thomas Frohwein" Cc: "Rafael Sadowski" , Solène Rapenne , ports@openbsd.org Date: Sun, 21 Jan 2024 17:06:47 +0100 On Sunday, January 21, 2024 14:56 CET, Thomas Frohwein wrote: > On Sun, Jan 21, 2024 at 01:13:16PM +0100, Sebastian Reitenbach wrote: > > Hi, > > > > On Sunday, January 21, 2024 00:07 CET, Thomas Frohwein 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 > > Thanks, new diff with your cmake-related changes that doesn't need the CFLAGS+= > anymore. with that patch, I can at least run: fluidsynth -a sndio -m sndio -p midithru/0 /usr/local/share/generaluser-gs/GeneralUser_GS.sf2 and connect the midi controller via midish, and it works. qsynth is updated, still has some odd troubles (bad humming noise) but at least I can manually get fluidsynth to work until I find time to look into qsynth. OK sebastia@ > > ok? > > 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 21 Jan 2024 13:53:23 -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 > > 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 21 Jan 2024 13:53:23 -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 21 Jan 2024 13:53:23 -0000 > @@ -0,0 +1,28 @@ > +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@) > +@@ -13,6 +14,7 @@ set(FLUIDSYNTH_SUPPORT_PIPEWIRE @PIPEWIRE_SUPPORT@) > + set(FLUIDSYNTH_SUPPORT_PORTAUDIO @PORTAUDIO_SUPPORT@) > + set(FLUIDSYNTH_SUPPORT_PULSE @PULSE_SUPPORT@) > + set(FLUIDSYNTH_SUPPORT_SDL2 @SDL2_SUPPORT@) > ++set(FLUIDSYNTH_SUPPORT_SNDIO @SNDIO_SUPPORT@) > + set(FLUIDSYNTH_SUPPORT_WASAPI @WASAPI_SUPPORT@) > + set(FLUIDSYNTH_SUPPORT_WAVEOUT @WAVEOUT_SUPPORT@) > + set(FLUIDSYNTH_SUPPORT_WINMIDI @WINMIDI_SUPPORT@) > +@@ -134,6 +136,10 @@ if(NOT FLUIDSYNTH_IS_SHARED) > + > + if(FLUIDSYNTH_SUPPORT_SDL2 AND NOT TARGET SDL2::SDL2) > + find_dependency(SDL2) > ++ endif() > ++ > ++ if(FLUIDSYNTH_SUPPORT_SNDIO AND NOT TARGET SNDIO::SNDIO) > ++ find_dependency(SNDIO) > + endif() > + > + if(FLUIDSYNTH_SUPPORT_SYSTEMD AND NOT Systemd::libsystemd) > 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 21 Jan 2024 13:53:23 -0000 > @@ -0,0 +1,16 @@ > +Index: cmake_admin/report.cmake > +--- cmake_admin/report.cmake.orig > ++++ cmake_admin/report.cmake > +@@ -85,6 +85,12 @@ else ( SDL2_SUPPORT ) > + set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT} SDL2: no\n" ) > + endif ( SDL2_SUPPORT ) > + > ++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 ( WASAPI_SUPPORT ) > + set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT} WASAPI: yes\n" ) > + else ( WASAPI_SUPPORT ) > Index: patches/patch-src_CMakeLists_txt > =================================================================== > RCS file: /cvs/ports/audio/fluidsynth/patches/patch-src_CMakeLists_txt,v > retrieving revision 1.1 > diff -u -p -r1.1 patch-src_CMakeLists_txt > --- patches/patch-src_CMakeLists_txt 20 Jan 2024 20:01:56 -0000 1.1 > +++ patches/patch-src_CMakeLists_txt 21 Jan 2024 13:53:23 -0000 > @@ -6,13 +6,21 @@ Index: src/CMakeLists.txt > # ************ library ************ > > +if ( SNDIO_SUPPORT ) > -+ set ( fluid_pulse_SOURCES drivers/fluid_sndio.c ) > ++ set ( fluid_sndio_SOURCES drivers/fluid_sndio.c ) > +endif ( SNDIO_SUPPORT ) > + > if ( PULSE_SUPPORT ) > set ( fluid_pulse_SOURCES drivers/fluid_pulse.c ) > endif ( PULSE_SUPPORT ) > -@@ -366,6 +370,11 @@ target_link_libraries ( libfluidsynth-OBJ PUBLIC GLib2 > +@@ -249,6 +253,7 @@ add_library ( libfluidsynth-OBJ OBJECT > + ${fluid_waveout_SOURCES} > + ${fluid_winmidi_SOURCES} > + ${fluid_sdl2_SOURCES} > ++ ${fluid_sndio_SOURCES} > + ${fluid_libinstpatch_SOURCES} > + ${libfluidsynth_SOURCES} > + ${public_HEADERS} > +@@ -366,6 +371,11 @@ target_link_libraries ( libfluidsynth-OBJ PUBLIC GLib2 > > if ( TARGET SndFile::sndfile AND LIBSNDFILE_SUPPORT ) > target_link_libraries ( libfluidsynth-OBJ PUBLIC SndFile::sndfile ) > Index: patches/patch-src_config_cmake > =================================================================== > RCS file: patches/patch-src_config_cmake > diff -N patches/patch-src_config_cmake > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_config_cmake 21 Jan 2024 13:53:23 -0000 > @@ -0,0 +1,13 @@ > +Index: src/config.cmake > +--- src/config.cmake.orig > ++++ src/config.cmake > +@@ -208,6 +208,9 @@ > + /* Define to enable SDL2 audio driver */ > + #cmakedefine SDL2_SUPPORT @SDL2_SUPPORT@ > + > ++/* Define to enable sndio audio driver */ > ++#cmakedefine SNDIO_SUPPORT @SNDIO_SUPPORT@ > ++ > + /* Define to 1 if you have the ANSI C header files. */ > + #cmakedefine STDC_HEADERS @STDC_HEADERS@ > + > 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 21 Jan 2024 13:53:23 -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 21 Jan 2024 13:53:23 -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 21 Jan 2024 13:53:23 -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 21 Jan 2024 13:53:23 -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,