mirror of https://github.com/bjornbytes/lovr.git
HRTF;
This commit is contained in:
parent
cd3da38478
commit
1c61fa88b3
|
@ -5,6 +5,8 @@
|
|||
|
||||
static AudioState state;
|
||||
|
||||
static LPALCRESETDEVICESOFT alcResetDeviceSOFT;
|
||||
|
||||
void lovrAudioInit() {
|
||||
ALCdevice* device = alcOpenDevice(NULL);
|
||||
if (!device) {
|
||||
|
@ -16,6 +18,13 @@ void lovrAudioInit() {
|
|||
error("Unable to create OpenAL context");
|
||||
}
|
||||
|
||||
alcResetDeviceSOFT = (LPALCRESETDEVICESOFT) alcGetProcAddress(device, "alcResetDeviceSOFT");
|
||||
|
||||
if (alcIsExtensionPresent(device, "ALC_SOFT_HRTF")) {
|
||||
ALCint attrs[3] = { ALC_HRTF_SOFT, ALC_TRUE, 0 };
|
||||
alcResetDeviceSOFT(device, attrs);
|
||||
}
|
||||
|
||||
state.device = device;
|
||||
state.context = context;
|
||||
vec_init(&state.sources);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "audio/source.h"
|
||||
#include "vendor/vec/vec.h"
|
||||
#include <OpenAL/al.h>
|
||||
#include <OpenAL/alc.h>
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alext.h>
|
||||
|
||||
#ifndef LOVR_AUDIO_TYPES
|
||||
#define LOVR_AUDIO_TYPES
|
||||
|
|
|
@ -105,7 +105,8 @@ void lovrSourcePlay(Source* source) {
|
|||
if (lovrSourceIsPlaying(source)) {
|
||||
return;
|
||||
} else if (lovrSourceIsPaused(source)) {
|
||||
return lovrSourceResume(source);
|
||||
lovrSourceResume(source);
|
||||
return;
|
||||
}
|
||||
|
||||
lovrSourceStream(source, source->buffers, SOURCE_BUFFERS);
|
||||
|
@ -199,7 +200,8 @@ void lovrSourceStream(Source* source, ALuint* buffers, int count) {
|
|||
|
||||
if (samples == 0 && source->isLooping && n < count) {
|
||||
lovrSourceDataRewind(sourceData);
|
||||
return lovrSourceStream(source, buffers + n, count - n);
|
||||
lovrSourceStream(source, buffers + n, count - n);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "util.h"
|
||||
#include <OpenAL/al.h>
|
||||
#include <OpenAL/alc.h>
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
|
||||
#ifndef LOVR_SOURCE_TYPES
|
||||
#define LOVR_SOURCE_TYPES
|
||||
|
|
Loading…
Reference in New Issue