What is the most portable way to play a wave file in Linux? I’d like this to succeed even if the user doesn’t have particularly nice sound libraries installed (assume libc is installed and the user has sound configured, but nothing else).
Preferably, the method I use to blocks until the sound finishes playing and also avoids the overhead of launching a whole separate utility.
The problem is, there’s not really a Linux sound API. There’s ALSA and OSSv4 for hardware access, but if you use either API directly, you will likely be fighting a mixing daemon, such as PulseAudio, for access to the sound device.
You may be best off using something like libao or PortAudio.