As kind of a for-fun project, I implemented native sound output for OpenMPT when running on Wine on Linux. The first version to have it is 1.27.00.34 r7701 as of 2017-02-26. It has only been tested on the following system setups so far:
- Debian 8, x86-64, wine 1.6.2 (wine, wine32-tools)
- Debian 8, x86-64, wine-development 1.7.29 (wine-development, wine64-development-tools)
- Ubuntu 14.04 x86-64, wine 1.6.2 (wine, wine-1.6-dev)
- Ubuntu 16.04 i686, wine-development 1.9.6 (wine-development, libwine-development-dev)
This means, that OpenMPT can now, as an EXPERIMENTAL feature, completely bypass the emulation of Windows sound drivers as implemented in Wine, and instead talk to the native Linux APIs directly.
In its current form, only support for PulseAudio and PortAudio is implemented.
Support for PulseAudio currently still uses the "Simple API" which is suboptimal for the features that OpenMPT wants to use. This will be improved to use the full API in a later OpenMPT version.
Support for PortAudio is probably final in its current form and is no high priority. PortAudio itself can, in particular, talk to ALSA devices directly. PortAudio can also talk to JACK, but this has not been tested at all in OpenMPT and very probably does not work correctly yet.
In addition to using native Linux sound APIs, OpenMPT can now also boost the thread priority, which was not possible at all when using the standard Windows APIs as emulated by Wine. OpenMPT can use both, Linux Realtime Scheduling priorities directly as well as setting system-defined priorities through RealtimeKit. The way OpenMPT chooses between these 2 ways is the way recommended by the Linux Audio Developers community.How?
Using Wine integration in OpenMPT has various requirements on the host system:
- OpenMPT bitness must be the same as host system bitness, i.e. use OpenMPT 32bit on i686 and OpenMPT 64bit on x86-64.
- On Debian or Ubuntu (and derivates), the following packages must be installed: coreutils dialog make pkg-config cpp gcc g++ binutils ccache xterm.
- Additionally, the Wine developments headers and tools must also be installed. These are called completely different but similarly looking names on various distributions. See the list of tested systems for hints on what package names to look out for.
- The following packages need optionally be installed: libpulse-dev (for PulseAudio), libjack-jackd2-dev and portaudio19-dev (for PortAudio), libdbus-1-dev (for RealtimeKit)
- Other distributions should also work, but you have to figure out the required packages yourself.
In order to enable Wine integration, go to the Wine
options tab (the tab is only shown if OpenMPT actually detected Wine), check the checkbox and restart OpenMPT. Additional settings are available under Advanced
settings in the WineSupport
section. For most of these settings, you need to restart OpenMPT for them to take effect.
If OpenMPT Wine integration is enabled, OpenMPT will compile the required library adapters for your system on startup itself. It will spawn a terminal window
and show a progress bar while doing so. Please do not be scared or surprised when you see the terminal window popping up. Starting native host applications from within a Windows application running on Wine is officially supported behaviour of Wine. If all works fine, native sound devices will be listed in the Sound Card
2 shared libraries are compiled by OpenMPT. The required source code is distributed with OpenMPT in the file openmpt-wine-support.zip
and must match the OpenMPT version exactly.openmpt_wine_support.dll
gets placed below AppData/
in the Wine environment. This is a Wine DLL, which will be loaded by OpenMPT and used as a proxy to call to the system native library libopenmpt_native_support.so
gets placed below $XDG_DATA_HOME/
on the host system. The shared library is a host-native library that implements the OpenMPT sound device API on top of the PulseAudio or PortAudio libraries provided by the host system.
OpenMPT will recompile these libraries as required and cache the result such that starting the exact same version of OpenMPT again does not require recompiling.