On Wed, 4 Nov 2026 18:20:00 +0100 Antoine Jacoutot <[email protected]> wrote:
> > > This is a fairly small and simple midi program you can use to > > > test by just putting in a few notes: > > > > > > https://timm-schmidt.com/software/simplemidi/#download > > > > > > Extracted with unzip(1), Then ran: > > > > > > $ cd simpleMidi-windows-x86_64 > > > $ pipewire & > > > $ wine simpleMidi.exe > > > > > > Putting in a few notes, the distorted, crackling sound can be > > > heard. Not sure about simpler reproducers; can't find something > > > built into wine to test audio playback. > > > > > > I don't use pipewire or pulseaudio otherwise. If other consumers > > > of pulseaudio don't have this problem, like it sounds from your > > > email, then we will have to look at the wine pulseaudio > > > backend... > > > > Use this workaround for now. > > I will fix pipewire config later on. > > > > PULSE_LATENCY_MSEC=60 wine simpleMidi.exe > > This works for me: This fixes it indeed. I went ahead and committed it. As a bonus, I would like to point out that with this new setup, the previously observed noticeable audio lag in wine seems to be resolved. What's the recommended way for users to ensure a running pipewire service? `pipewire &` in .xsession? (asking because I'm anticipating "no audio" reports about wine and possibly other ports without some hints...) > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/emulators/wine/Makefile,v > diff -u -p -r1.52 Makefile > --- Makefile 26 Oct 2026 12:18:40 -0000 1.52 > +++ Makefile 4 Nov 2026 17:18:45 -0000 > @@ -6,7 +6,7 @@ USE_WXNEEDED = Yes > COMMENT = compatibility layer to run Windows > applications > DISTNAME = wine-11.20 > -REVISION = 1 > +REVISION = 2 > > CATEGORIES = emulators > > Index: patches/patch-dlls_winepulse_drv_pulse_c > =================================================================== > RCS file: > /cvs/ports/emulators/wine/patches/patch-dlls_winepulse_drv_pulse_c,v > diff -u -p -r1.1.1.1 patch-dlls_winepulse_drv_pulse_c --- > patches/patch-dlls_winepulse_drv_pulse_c 19 Oct 2026 02:14:57 > -0000 1.1.1.1 +++ > patches/patch-dlls_winepulse_drv_pulse_c 4 Nov 2026 17:18:45 > -0000 @@ -23,20 +23,28 @@ Index: dlls/winepulse.drv/pulse.c if > (pthread_mutex_init(&pulse_mutex, &attr) != 0) > pthread_mutex_init(&pulse_mutex, NULL); -@@ -1081,7 +1086,12 @@ > static HRESULT pulse_stream_connect(struct pulse_strea > - /* PulseAudio will fill in correct values */ > - attr.minreq = attr.fragsize = period_bytes; > - attr.tlength = period_bytes * 3; > +@@ -1078,11 +1083,20 @@ static HRESULT pulse_stream_connect(struct > pulse_strea > + pa_stream_set_buffer_attr_callback(stream->stream, > pulse_attr_update, stream); > + pa_stream_set_moved_callback(stream->stream, pulse_attr_update, > stream); > + > +#ifdef __OpenBSD__ > + /* Let PulseAudio sndio queue more than the app buffer. This is > because OpenBSD's sndio pulls data in large bursts.*/ > + attr.maxlength = -1; > ++ /* 100Hz clock: buffer before playback to prevent crackle */ > ++ attr.minreq = -1; > ++ attr.tlength = period_bytes * 6; > ++ attr.prebuf = -1; > +#else > + /* PulseAudio will fill in correct values */ > + attr.minreq = attr.fragsize = period_bytes; > + attr.tlength = period_bytes * 3; > attr.maxlength = stream->bufsize_frames * > pa_frame_size(&stream->ss); -+#endif > attr.prebuf = pa_frame_size(&stream->ss); > ++#endif > dump_attr(&attr); > > -@@ -1630,11 +1640,22 @@ static void pulse_timer_loop(void *args) > + /* If specific device was requested, use it exactly */ > +@@ -1630,11 +1644,22 @@ static void pulse_timer_loop(void *args) > INT32 adjust = last_time + > stream->mmdev_period_usec - now; > adv_usec = now - last_time; > @@ -60,7 +68,7 @@ Index: dlls/winepulse.drv/pulse.c > > delay.QuadPart = -(stream->mmdev_period_usec + > adjust) * 10; > -@@ -1658,7 +1679,13 @@ static void pulse_timer_loop(void *args) > +@@ -1658,7 +1683,13 @@ static void pulse_timer_loop(void *args) > } > else > { > >
