Skip to content

Commit bd8172d

Browse files
alex-rass-88icculus
authored andcommitted
Fix absolute/relative listener calculation
1 parent abbf12b commit bd8172d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mojoal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static ALfloat SDL_TARGETING("sse") magnitude_sse(const __m128 v)
883883
static void SDL_TARGETING("sse") calculate_distance_attenuation_and_angle_sse(const ALCcontext *ctx, const ALsource *src, ALfloat *_gain, ALfloat *_radians)
884884
{
885885
// (the math is explained in the scalar version.)
886-
const __m128 position_sse = src->source_relative ? _mm_sub_ps(_mm_load_ps(src->position), _mm_load_ps(ctx->listener.position)) : _mm_load_ps(src->position);
886+
const __m128 position_sse = !src->source_relative ? _mm_sub_ps(_mm_load_ps(src->position), _mm_load_ps(ctx->listener.position)) : _mm_load_ps(src->position);
887887
const __m128 at_sse = _mm_load_ps(&ctx->listener.orientation[0]);
888888
const __m128 up_sse = _mm_load_ps(&ctx->listener.orientation[4]);
889889
const ALfloat a = dotproduct_sse(position_sse, up_sse);
@@ -932,7 +932,7 @@ static ALfloat SDL_TARGETING("neon") magnitude_neon(const float32x4_t v)
932932
static void SDL_TARGETING("neon") calculate_distance_attenuation_and_angle_neon(const ALCcontext *ctx, const ALsource *src, ALfloat *_gain, ALfloat *_radians)
933933
{
934934
// (the math is explained in the scalar version.)
935-
const float32x4_t position_neon = src->source_relative ? vsubq_f32(vld1q_f32(src->position), vld1q_f32(ctx->listener.position)) : vld1q_f32(src->position);
935+
const float32x4_t position_neon = !src->source_relative ? vsubq_f32(vld1q_f32(src->position), vld1q_f32(ctx->listener.position)) : vld1q_f32(src->position);
936936
const float32x4_t at_neon = vld1q_f32(&ctx->listener.orientation[0]);
937937
const float32x4_t up_neon = vld1q_f32(&ctx->listener.orientation[4]);
938938
const ALfloat a = dotproduct_neon(position_neon, up_neon);

0 commit comments

Comments
 (0)