From 958d79828b1997fc040ebd1a3e5b63650a54193b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Thu, 3 Jun 2021 10:09:18 +0200 Subject: [PATCH] Fix crash when using ALSA MIDI with PulseAudio --- drivers/pulseaudio/audio_driver_pulseaudio.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 0f8f2260f207..5e2431d44e30 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -35,6 +35,10 @@ #include "core/config/project_settings.h" #include "core/os/os.h" +#ifdef ALSAMIDI_ENABLED +#include "drivers/alsa/asound-so_wrap.h" +#endif + void AudioDriverPulseAudio::pa_state_cb(pa_context *c, void *userdata) { AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata; @@ -271,6 +275,10 @@ Error AudioDriverPulseAudio::init() { int dylibloader_verbose = 1; #else int dylibloader_verbose = 0; +#endif +#ifdef ALSAMIDI_ENABLED + // If using PulseAudio with ALSA MIDI, we need to initialize ALSA as well + initialize_asound(dylibloader_verbose); #endif if (initialize_pulse(dylibloader_verbose)) { return ERR_CANT_OPEN;