Fix crash when using ALSA MIDI with PulseAudio

(cherry picked from commit 958d79828b)
This commit is contained in:
Pedro J. Estébanez 2021-06-03 10:09:18 +02:00 committed by Rémi Verschelde
parent dfee7e71c7
commit 612986ab0a
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -35,6 +35,10 @@
#include "core/os/os.h"
#include "core/project_settings.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;