Fix crash when using ALSA MIDI with PulseAudio

This commit is contained in:
Pedro J. Estébanez 2021-06-03 10:09:18 +02:00
parent f164c00a94
commit 958d79828b

View File

@ -35,6 +35,10 @@
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
#include "core/os/os.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) { void AudioDriverPulseAudio::pa_state_cb(pa_context *c, void *userdata) {
AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata; AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)userdata;
@ -271,6 +275,10 @@ Error AudioDriverPulseAudio::init() {
int dylibloader_verbose = 1; int dylibloader_verbose = 1;
#else #else
int dylibloader_verbose = 0; 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 #endif
if (initialize_pulse(dylibloader_verbose)) { if (initialize_pulse(dylibloader_verbose)) {
return ERR_CANT_OPEN; return ERR_CANT_OPEN;