Fix T72920: Snap package fails to play audio and blocks audio in other apps

ALSA and OSS are not available for the snap packages, and trying to initialize
them seems to cause some problems for other applications. Instead configure
OpenAL and SDL to use PulseAudio, and set PULSE_SERVER environment variable to
make it work.
This commit is contained in:
Brecht Van Lommel 2020-05-12 19:35:21 +02:00
parent a5eee1f935
commit 829dce524d
Notes: blender-bot 2023-02-14 08:07:50 +01:00
Referenced by issue #72920, Blender installed via snap blocks sound
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,19 @@
# Disable ALSA and OSS as they are not available, and trying to initialize them
# breaks sound in other apps. Use PulseAudio instead.
export ALSOFT_DRIVERS=-oss,-alsa,
export SDL_AUDIODRIVER=pulseaudio
# Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR
# This is adapted from https://github.com/ubuntu/snapcraft-desktop-helpers,
# in common/desktop-exports.
mkdir -p $XDG_RUNTIME_DIR -m 700
if [ -n "$XDG_RUNTIME_DIR" ]; then
pulsenative="pulse/native"
pulseaudio_sockpath="$XDG_RUNTIME_DIR/../$pulsenative"
if [ -S "$pulseaudio_sockpath" ]; then
export PULSE_SERVER="unix:${pulseaudio_sockpath}"
fi
fi
# Run Blender
$SNAP/blender

View File

@ -24,7 +24,7 @@ confinement: classic
apps:
blender:
command: ./blender
command: ./blender-wrapper
desktop: ./blender.desktop
version: '@VERSION@'
@ -46,3 +46,8 @@ parts:
- libxfixes3
- libxrender1
- libxxf86vm1
wrapper:
plugin: copy
source: .
files:
blender-wrapper: blender-wrapper