mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-05 13:53:38 +00:00
lovr.audio.isSpatialized;
This commit is contained in:
parent
43ecf52dbc
commit
2a6afc4999
|
@ -22,8 +22,9 @@ void lovrAudioInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
alcResetDeviceSOFT = (LPALCRESETDEVICESOFT) alcGetProcAddress(device, "alcResetDeviceSOFT");
|
alcResetDeviceSOFT = (LPALCRESETDEVICESOFT) alcGetProcAddress(device, "alcResetDeviceSOFT");
|
||||||
|
state.isSpatialized = alcIsExtensionPresent(device, "ALC_SOFT_HRTF");
|
||||||
|
|
||||||
if (alcIsExtensionPresent(device, "ALC_SOFT_HRTF")) {
|
if (state.isSpatialized) {
|
||||||
ALCint attrs[3] = { ALC_HRTF_SOFT, ALC_TRUE, 0 };
|
ALCint attrs[3] = { ALC_HRTF_SOFT, ALC_TRUE, 0 };
|
||||||
alcResetDeviceSOFT(device, attrs);
|
alcResetDeviceSOFT(device, attrs);
|
||||||
}
|
}
|
||||||
|
@ -106,6 +107,10 @@ int lovrAudioHas(Source* source) {
|
||||||
return index >= 0;
|
return index >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lovrAudioIsSpatialized(Source* source) {
|
||||||
|
return state.isSpatialized;
|
||||||
|
}
|
||||||
|
|
||||||
void lovrAudioPause() {
|
void lovrAudioPause() {
|
||||||
int i; Source* source;
|
int i; Source* source;
|
||||||
vec_foreach(&state.sources, source, i) {
|
vec_foreach(&state.sources, source, i) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ typedef struct {
|
||||||
ALCdevice* device;
|
ALCdevice* device;
|
||||||
ALCcontext* context;
|
ALCcontext* context;
|
||||||
vec_void_t sources;
|
vec_void_t sources;
|
||||||
|
int isSpatialized;
|
||||||
float orientation[4];
|
float orientation[4];
|
||||||
float position[3];
|
float position[3];
|
||||||
float velocity[4];
|
float velocity[4];
|
||||||
|
@ -25,6 +26,7 @@ void lovrAudioGetPosition(float* x, float* y, float* z);
|
||||||
void lovrAudioGetVelocity(float* x, float* y, float* z);
|
void lovrAudioGetVelocity(float* x, float* y, float* z);
|
||||||
float lovrAudioGetVolume();
|
float lovrAudioGetVolume();
|
||||||
int lovrAudioHas(Source* source);
|
int lovrAudioHas(Source* source);
|
||||||
|
int lovrAudioIsSpatialized();
|
||||||
void lovrAudioPause();
|
void lovrAudioPause();
|
||||||
void lovrAudioResume();
|
void lovrAudioResume();
|
||||||
void lovrAudioRewind();
|
void lovrAudioRewind();
|
||||||
|
|
|
@ -12,6 +12,7 @@ const luaL_Reg lovrAudio[] = {
|
||||||
{ "getPosition", l_lovrAudioGetPosition },
|
{ "getPosition", l_lovrAudioGetPosition },
|
||||||
{ "getVelocity", l_lovrAudioGetVelocity },
|
{ "getVelocity", l_lovrAudioGetVelocity },
|
||||||
{ "getVolume", l_lovrAudioGetVolume },
|
{ "getVolume", l_lovrAudioGetVolume },
|
||||||
|
{ "isSpatialized", l_lovrAudioIsSpatialized },
|
||||||
{ "newSource", l_lovrAudioNewSource },
|
{ "newSource", l_lovrAudioNewSource },
|
||||||
{ "pause", l_lovrAudioPause },
|
{ "pause", l_lovrAudioPause },
|
||||||
{ "resume", l_lovrAudioResume },
|
{ "resume", l_lovrAudioResume },
|
||||||
|
@ -84,6 +85,11 @@ int l_lovrAudioGetVolume(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int l_lovrAudioIsSpatialized(lua_State* L) {
|
||||||
|
lua_pushnumber(L, lovrAudioIsSpatialized());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int l_lovrAudioNewSource(lua_State* L) {
|
int l_lovrAudioNewSource(lua_State* L) {
|
||||||
const char* filename = luaL_checkstring(L, 1);
|
const char* filename = luaL_checkstring(L, 1);
|
||||||
if (!strstr(filename, ".ogg")) {
|
if (!strstr(filename, ".ogg")) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ int l_lovrAudioGetOrientation(lua_State* L);
|
||||||
int l_lovrAudioGetPosition(lua_State* L);
|
int l_lovrAudioGetPosition(lua_State* L);
|
||||||
int l_lovrAudioGetVelocity(lua_State* L);
|
int l_lovrAudioGetVelocity(lua_State* L);
|
||||||
int l_lovrAudioGetVolume(lua_State* L);
|
int l_lovrAudioGetVolume(lua_State* L);
|
||||||
|
int l_lovrAudioIsSpatialized(lua_State* L);
|
||||||
int l_lovrAudioNewSource(lua_State* L);
|
int l_lovrAudioNewSource(lua_State* L);
|
||||||
int l_lovrAudioPause(lua_State* L);
|
int l_lovrAudioPause(lua_State* L);
|
||||||
int l_lovrAudioResume(lua_State* L);
|
int l_lovrAudioResume(lua_State* L);
|
||||||
|
|
Loading…
Reference in a new issue