Frage

I'm getting the following error when running a simple OpenAL program:

AL lib: pulseaudio.c:612: Context did not connect: Access denied

Interestingly, if I try playing audio then it plays correctly, although it sounds slightly distorted.

Below is the code that produces the error. It also happens if I initialize with ALUT.

#include <AL/al.h>
#include <AL/alc.h>
#include <string.h>

int main() {
  ALCdevice* dev;
  ALCcontext* ctx;
  dev = alcOpenDevice(NULL);
  ctx = alcCreateContext(dev, NULL);
  alcMakeContextCurrent(ctx);
  // cleanup
  alcMakeContextCurrent(NULL);
  alcDestroyContext(ctx);
  alcCloseDevice(dev);
  return 0;
}

What does the error mean? Can I fix it?

War es hilfreich?

Lösung

I fixed it by changing /etc/openal/alsoft.conf (I'm using Arch Linux) to this:

drivers=alsa,pulse

The default checks Pulse first, which I didn't have installed.

Installing Pulse should fix it too.

Andere Tipps

If it still doesn't fix it (for PulseAudio's users), try

cp  /etc/machine-id /var/lib/dbus/machine-id
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top