On 08/20 05:53, Bryan Linton wrote:
> Sound doesn't work though.
> 
>       Initializing sound...
>       Using "OpenBSD(/dev/audio*)" audio driver with SexyAL's default
>       device selection.OpenBSD Audio Error: fd = open(id ? id :
>       "/dev/audio", O_WRONLY) No such file or directory
>       Error opening a sound device.
> 
>       [...]
> 
>       % ls -la /dev/audio
>       ls: /dev/audio: No such file or directory

I did some more work on this and found out the reason it worked for me
was not related to this change, but because I use the sdl sound driver.
I think sdl should be the default, because it works with sndiod, while
the openbsd driver does not.

Here's a patch that does that.  It also updates the default device from
from /dev/audio to /dev/audio0.

You can modify the mednafen sound driver and sound device using
the appropriate settings in the mednafen configuration file.

OKs?

Thanks,
Jeremy

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/mednafen/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- Makefile    21 Nov 2017 00:13:00 -0000      1.24
+++ Makefile    25 Aug 2018 17:32:28 -0000
@@ -3,8 +3,7 @@
 BROKEN-hppa =  ../../include/mednafen/state.h:21:7: error: 'exception_ptr' in 
namespace 'std' does not name a type
 COMMENT =      emulates numerous game consoles
 
-DISTNAME =     mednafen-0.9.48
-REVISION =     0
+DISTNAME =     mednafen-1.21.3
 
 CATEGORIES =   emulators games
 HOMEPAGE =     https://mednafen.github.io
@@ -17,27 +16,26 @@ PERMIT_PACKAGE_CDROM =      Yes
 MASTER_SITES = ${HOMEPAGE}/releases/files/
 EXTRACT_SUFX = .tar.xz
 
-WANTLIB += SDL c iconv intl m pthread sndfile sndio usbhid z
-WANTLIB += FLAC ogg vorbis vorbisenc ${COMPILER_LIBCXX}
+WANTLIB += SDL2 c iconv intl m pthread sndfile sndio usbhid z
+WANTLIB += FLAC ogg samplerate vorbis vorbisenc ${COMPILER_LIBCXX}
 
 USE_GMAKE =    Yes
 COMPILER =     base-clang ports-gcc
 
 LIB_DEPENDS =  audio/libsndfile \
                devel/gettext \
-               devel/sdl
+               devel/sdl2
                
 WRKDIST =      ${WRKDIR}/mednafen
 
 USE_WXNEEDED = Yes
 
 CONFIGURE_STYLE =      gnu
-CONFIGURE_ENV =                CFLAGS="-I${LOCALBASE}/include 
-I${LOCALBASE}/include/SDL" \
+CONFIGURE_ENV =                CFLAGS="-I${LOCALBASE}/include 
-I${LOCALBASE}/include/SDL2" \
                        LDFLAGS="-L${LOCALBASE}/lib -pthread -nopie"
 CONFIGURE_ARGS =       --disable-alsa \
                        --disable-rpath \
                        --disable-jack \
-                       --with-x \
                        --with-gnu-ld
 
 # this intrinsic is not supported with our old gcc
Index: distinfo
===================================================================
RCS file: /cvs/ports/emulators/mednafen/distinfo,v
retrieving revision 1.10
diff -u -p -r1.10 distinfo
--- distinfo    14 Nov 2017 06:46:20 -0000      1.10
+++ distinfo    17 Aug 2018 17:02:11 -0000
@@ -1,2 +1,2 @@
-SHA256 (mednafen-0.9.48.tar.xz) = 08wMg49JZRGUbW6hj9pZZdK3FXfGEKzIEYNcyH0VIQI=
-SIZE (mednafen-0.9.48.tar.xz) = 3203080
+SHA256 (mednafen-1.21.3.tar.xz) = LnYeiDSwmLfxqzXcyqbSvnFe6RBs9Ar0kZ9spLme48Y=
+SIZE (mednafen-1.21.3.tar.xz) = 3208956
Index: patches/patch-src_sexyal_drivers_openbsd_cpp
===================================================================
RCS file: patches/patch-src_sexyal_drivers_openbsd_cpp
diff -N patches/patch-src_sexyal_drivers_openbsd_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_sexyal_drivers_openbsd_cpp        25 Aug 2018 18:09:12 
-0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+Adjust for removal of /dev/audio.  Can override default using sound.device
+setting in mednafen configuration file.
+
+This is only used when the openbsd driver is forced in the configuration
+file, instead of the default sdl driver.
+
+Index: src/sexyal/drivers/openbsd.cpp
+--- src/sexyal/drivers/openbsd.cpp.orig
++++ src/sexyal/drivers/openbsd.cpp
+@@ -165,7 +165,7 @@ SexyAL_device* SexyALI_OpenBSD_Open(const char* id, Se
+ 
+  AUDIO_INITPAR(&par);
+ 
+- OBSD_TRY(fd = open(id ? id : "/dev/audio", O_WRONLY));
++ OBSD_TRY(fd = open(id ? id : "/dev/audio0", O_WRONLY));
+ 
+  par.bits = SAMPFORMAT_BITS(format->sampformat);
+  par.bps = SAMPFORMAT_BYTES(format->sampformat);
Index: patches/patch-src_sexyal_sexyal_cpp
===================================================================
RCS file: patches/patch-src_sexyal_sexyal_cpp
diff -N patches/patch-src_sexyal_sexyal_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_sexyal_sexyal_cpp 25 Aug 2018 18:08:11 -0000
@@ -0,0 +1,35 @@
+$OpenBSD$
+
+Give sdl driver higher priority than openbsd driver, since sdl driver
+works with sndiod, and openbsd driver requires exclusive access to the
+audio device.  You can still use the openbsd driver by setting
+"sound.driver openbsd" in the mednafen configuration file.
+
+Index: src/sexyal/sexyal.cpp
+--- src/sexyal/sexyal.cpp.orig
++++ src/sexyal/sexyal.cpp
+@@ -150,6 +150,10 @@ static SexyAL_driver drivers[] = 
+         { SEXYAL_TYPE_ALSA, "ALSA", "alsa", SexyALI_ALSA_Open, 
SexyALI_ALSA_EnumerateDevices },
+         #endif
+ 
++        #if HAVE_SDL
++        { SEXYAL_TYPE_SDL, "SDL", "sdl", SexyALI_SDL_Open, NULL },
++        #endif
++
+       #if HAVE_OPENBSD_AUDIO
+       { SEXYAL_TYPE_OPENBSD, "OpenBSD(/dev/audio*)", "openbsd", 
SexyALI_OpenBSD_Open, SexyALI_OpenBSD_EnumerateDevices },
+       #endif
+@@ -182,13 +186,6 @@ static SexyAL_driver drivers[] = 
+       { SEXYAL_TYPE_DOS_ES1371, "Ensoniq ES1371", "es1371", 
SexyALI_DOS_ES1371_Open,  NULL, SexyALI_DOS_ES1371_Avail },
+       { SEXYAL_TYPE_DOS_CMI8738, "CMI8738", "cmi8738", 
SexyALI_DOS_CMI8738_Open,      NULL, SexyALI_DOS_CMI8738_Avail },
+       #endif
+-
+-      //
+-      // Keep SDL higher priority than JACK.
+-      //
+-        #if HAVE_SDL
+-        { SEXYAL_TYPE_SDL, "SDL", "sdl", SexyALI_SDL_Open, NULL },
+-        #endif
+ 
+         #if HAVE_JACK
+         { SEXYAL_TYPE_JACK, "JACK", "jack", SexyALI_JACK_Open, NULL },

Reply via email to