Merge pull request #48350 from RandomShaper/fix_alsamidi_crash

Fix crash when using ALSA MIDI with PulseAudio
This commit is contained in:
Rémi Verschelde 2021-06-03 10:59:29 +02:00 committed by GitHub
commit 8c23236e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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;