This appens to be a 'fallout' from sdl2_mixer 2.0.2, at least
accordingly to the AUR comment I found when I was searching.
See 0b100100 comment https://aur.archlinux.org/packages/xnp2

The diff is the one linked in the comments in AUR, it makes audio works
for me in Touhou 1 Highly Responsive To Prayers and 5 Mystical Square.

Upstream seems dead and I have wip a port for NP2Kai that works, but it
could still be worthwile to fix this in the meantime.


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/emulators/xnp2/Makefile,v
diff -u -p -r1.18 Makefile
--- Makefile    21 Sep 2023 13:10:27 -0000      1.18
+++ Makefile    21 Nov 2023 18:26:14 -0000
@@ -2,7 +2,7 @@ COMMENT =               PC-9801 emulator
 
 DISTNAME =             xnp2-0.86
 EPOCH =                        0
-REVISION =             5
+REVISION =             6
 CATEGORIES =           emulators
 
 HOMEPAGE =             https://www.nonakap.org/np2/
Index: patches/patch-x11_soundmng_c
===================================================================
RCS file: /home/cvs/ports/emulators/xnp2/patches/patch-x11_soundmng_c,v
diff -u -p -r1.3 patch-x11_soundmng_c
--- patches/patch-x11_soundmng_c        11 Mar 2022 18:59:43 -0000      1.3
+++ patches/patch-x11_soundmng_c        21 Nov 2023 18:24:59 -0000
@@ -1,7 +1,9 @@
-disable asm on i386, PIE uses registers used by asm code.
+- disable asm on i386, PIE uses registers used by asm code.
+- fix audio
 
---- x11/soundmng.c.orig        Wed Mar  9 02:25:50 2016
-+++ x11/soundmng.c     Sat Dec 31 06:21:29 2016
+Index: x11/soundmng.c
+--- x11/soundmng.c.orig
++++ x11/soundmng.c
 @@ -401,7 +401,7 @@ soundmng_setreverse(BOOL reverse)
        } else {
                fnmix = satuation_s16x;
@@ -20,3 +22,24 @@ disable asm on i386, PIE uses registers 
  void PARTSCALL
  _saturation_s16(SINT16 *dst, const SINT32 *src, UINT size)
  {
+@@ -1179,8 +1179,9 @@ sdlaudio_callback(void *userdata, unsigned char *strea
+               SNDBUF_FILLED_QUEUE_REMOVE_HEAD();
+               sndbuf_unlock();
+ 
+-              SDL_MixAudio(stream,
++              SDL_MixAudioFormat(stream,
+                   sndbuf->buf + (sndbuf->size - sndbuf->remain),
++                  AUDIO_S16SYS,
+                   sndbuf->remain, SDL_MIX_MAXVOLUME);
+               stream += sndbuf->remain;
+               len -= sndbuf->remain;
+@@ -1198,7 +1199,8 @@ sdlaudio_callback(void *userdata, unsigned char *strea
+               sndbuf_unlock();
+       }
+ 
+-      SDL_MixAudio(stream, sndbuf->buf + (sndbuf->size - sndbuf->remain),
++      SDL_MixAudioFormat(stream, sndbuf->buf + (sndbuf->size - 
sndbuf->remain),
++          AUDIO_S16SYS,
+           len, SDL_MIX_MAXVOLUME);
+       sndbuf->remain -= len;
+ 

Reply via email to