7 static ALCcontext *ctx;
11 if(!(dev = alcOpenDevice(0))) {
12 fprintf(stderr, "failed to open OpenAL device\n");
16 if(!(ctx = alcCreateContext(dev, 0))) {
17 fprintf(stderr, "failed to create context\n");
22 alcMakeContextCurrent(ctx);
30 printf("shutting down audio system\n");
31 alcMakeContextCurrent(0);
34 alcDestroyContext(ctx);
44 void set_audio_listener(const Mat4 &xform)
46 float pos[3], orient[6];
52 orient[0] = xform[2][0];
53 orient[1] = xform[2][1];
54 orient[2] = -xform[2][2];
56 orient[3] = xform[1][0];
57 orient[4] = xform[1][1];
58 orient[5] = xform[1][2];
60 alListenerfv(AL_POSITION, pos);
61 alListenerfv(AL_ORIENTATION, orient);