WinePulse – PulseAudio for Wine
What is It?
It’s a PulseAudio backend for WINE, an opensource implementation of the Windows API on X/Unix. PulseAudio is a modern sound system for Linux. Currently WINE applications cannot fully cooperate with pulseaudio, creating an either-or situation which is messy. WinePulse means that on a PulseAudio setup audio will always work in WINE for you. Doesn’t matter what kind of device the audio is coming out of or captured from, things will work. It also means that you get all the benefits of PulseAudio (moving streams between devices on-the-fly, network transparency… )
Why?
Firstly, while it’s true that WINE currently has many audio backends, some of which can be made to work indirrectly with pulseaudio, no solution works well enough in my opinion. Secondly, a native interface to pulseaudio can be written as “a PCM output abstraction layer is already available in [WINE] and it thus makes sense to add an additional backend to it for PulseAudio to keep the stack of audio layers minimal.” (Lennart Poettering, http://0pointer.de/blog/projects/guide-to-sound-apis.html). Thirdly, writing such a backend seemed like a good spare time project.
Getting WinePulse
For Ubuntu try Neil Wilson’s PPA: https://launchpad.net/~neil-aldur/+archive/ppa or Eric Astor’s PPA: https://launchpad.net/~eric-astor/+archive/epastor.
For Fedora, you don’t have to do anything, they are already included!
For Gentoo, enable the pulseaudio USE flag when compiling wine. The ebuild in portage will fetch and apply the patches automatically! The Quarks Overlay (more info) for wine also includes the patches.
From Git source, read on. WinePulse exists in the form of patches to the main wine git repository.
Latest Patchs
- winepulse-0.38.patch
- winepulse-0.38-configure.ac.patch
- winepulse-0.38-winecfg.patch (thanks to Sardemff7)
- Update 28/06/10: Use winepulse-0.37-winecfg.patch for wine ≤ 1.2-rc2
- Update 06/05/10: Use winepulse-0.34-winecfg.patch for wine versions ≤ 1.1.43
How to Build / Use Wine with PulseAudio Support
You don’t need to do this if your distro is listed in the previous section.
Clone the wine git repository and apply the winepulse patches:
git clone git://source.winehq.org/git/wine.git wine-git cd wine-git patch -p1 < path/to/patches/winepulse-0.38.patch patch -p1 < path/to/patches/winepulse-0.38-configure.ac.patch patch -p1 < path/to/patches/winepulse-0.38-winecfg.patch
The patch contains changes to configure.ac to add checks for pulesaudio, thus you must rebuild the configure script with autoreconf before building as else only a stub driver will be built.
autoreconf ./configure <optionally your configure arguments here>
After running configure if pulseaudio was not found or found to be too old configure will print a warning. If you see nothing you can double-check by running
grep HAVE_PULSEAUDIO include/config.h
from the root of the wine source. #define HAVE_PULSEAUDIO 1 should be output if pulseaudio was found. After you can build wine as normal.
make
If all goes well there should be the file dlls/winepulse.drv/winepulse.drv.so in the wine tree. If you used the winecfg patch you should be able to run winecfg and see the pulesaudio driver. To debug winepulse, compile wine with –enable-maintainer-mode and use the debug channel wave. For example;
WINEDEBUG=+wave wine <your program>
Update (20/03/10): If you get weird makefile related build failures with 1.1.41, delete dlls/winepulse.drv/Makefile and then run make clean from the wine project root, not from inside dlls or dlls/winepulse.drv. Wine changed the makefile structure and generation to compile time rather than configure time and the presence of old stale makefiles can cause errors.
Requirements
Requires pulseaudio >= 0.9.15 and a recent version of wine. Can compile and mostly work against versions 0.9.11 and up, but pulseaudio bugs (which may have been patched by your distro) could cause failures.
On 64-bit systems beware of old 32-bit libraries.
Some distributions ship old version of libpulse for the 32-bit compatibility (on gentoo be aware that your native libraries are continually updated while emul-linux packages get update less frequently). Wine compiles against the system pulse headers but links against the 32-bit libraries. If these libraries are old, there can be issues with the shared memory transport or hangs on playback/record. The trace messages (compiled with –enable-maintainer-mode and environment variable WINEDEBUG=trace+wave)
trace:wave:PULSE_WaveInit libpulse protocol version: x. API Version y trace:wave:PULSE_WaveInit Connected to server ------ with protocol version: x.
should help to debug the problem. On a local instance both x’s should be the same version number.
Features
Support exists for the WaveIn, WaveOut APIs. DirectSound support is through internal wine emulation.
Tested with Alice (Quake 3 engine), Audacity, Civ 4, Foobar2000, Guild Wars, Max Payne 1/2, ModPlugTracker, Portal (Half Life engine), Ventrilo*, VirtualDub, WinAmp 2/5.
*Reports on Ventrilo support are not up to date.
MIDI support is not available. As PulseAudio has nothing to do with MIDI so such support is out of scope. Because of a design limitation of wine’s winmm.dll only one multi-media backend can be loaded at once meaning that you cannot use winepulse.drv for audio and winealsa.drv for MIDI at the same time.
Changelog
Version 0.38 (07/07/10)
- Updates to configure.ac checks (Thanks Sean McNamara!)
- Use PA_STREAM_ADJUST_LATENCY for record streams (Thanks Nick)
- Update translations to winecfg patch, again (Thanks Aaron & Oldřich)
- Try setting buffer_attr on playback streams at connection again (please report if playback breaks.)
Version 0.36 (winecfg patch changed only) (28/06/10)
- More changes to make the winecfg patch apply correctly.
Version 0.36 (configure.ac patch changed only) (06/03/2010)
- Two line change to Makefile.in so it works with Wine 1.1.41
Version 0.35 (05/02/2010)
- Device name UTF-8 fix from Oldřich Jedlička (Thanks!)
- Update the checks in configure.ac to complain about old libraries.
Version 0.34 (26/01/2010)
- Fixed/cleaned up capture support (finally).
- Updated configure.ac patch to work against newer versions of wine. edit: only applied to git head.
- Updated winecfg patch to work against newer version of wine.
Version 0.33 (23/11/2009)
- Improvements to calculation of buffer_attr.
Version 0.32 (12/10/2009)
- Update configure.ac patch because of changes to winehq git head.
- Go against MSDN and use linear volume because it seems more correct.
- Fix stalling problems
Version 0.31 (16/09/2009)
- Update to configure.ac only to add a warning for when libpulse is not found. Aids debugging of patch application.
Version 0.30 (10/08/2009)
- Decreased version dependency to 0.9.14.
- Fixed a playback stall situation.
- Fixed winecfg patch to work with latest git.
Version 0.29 (18/07/2009)
- PulseAudio version requirement bump to 0.9.15
- Change the way dwUser is cast to a WINE_WAVEINST.
- Fix the winecfg patch to apply again (Thanks Neil Wilson), sort winepulse into the library list of library.c.
- Improve latency a little, little bit in wodPlayer_CheckReleasing().
- Remove work arounds and warnings for old PulseAudio versions.
Version 0.28 (19/06/2009)
- Whitespace cleanup (finally).
- Fix underrun recovery so it doesn’t cause incorrect buffer_attr request which then will cause stalls.
- All winmm tests passed – wave: 15234 tests executed (0 marked as todo, 0 failures), 0 skipped. capture: 7513 tests executed (0 marked as todo, 0 failures), 0 skipped.
- Removal of unnecessary or not 64-bit safe includes and dependencies.
- Share GetPosition MMTime code between waveout and wavein.
- Fix smtpe MMTime format.
- Make sure WINE_WAVEINST pointers are 64-bit safe.
Version 0.27 (15/06/2009)
- Large simplification to waveOut support.
- Removal of specific dsound support as while it was low-latency, it was broken.
- Removal of broken 24-bit support.
- Small crash fix for waveIn.
- Change in the way pa_timing_info data is used.
Todo
- Daemon reconnection / Deal with daemon connection dying over application’s lifetime.
- Better handling of directsound streams failing.
Relation With the Wine Project
This patch will not be accepted as a new audio backend into the offical Wine GIT repository. A development branch of Wine aims to implement the new mmdevapi from Vista using OpenAL, which has native pulseaudio support on linux already. Once this is complete winmm and directsound will be implemented on top of mmdevapi. WinePulse will be made redundant by these changes. Thus, this patch shall be maintained only as a stopgap until the new audio system is available. For historical aspects, social commentary and flames see http://bugs.winehq.org/show_bug.cgi?id=10495 .
Please note that if you use WinePulse, be it specifically compiled or provided by your distro, do not file bug reports at bugs.winehq.org. You will be either redirect here or to your distro’s bugzilla.
Contact
- theycallhimart < at > gmail dot com.