diff options
author | Chris Robinson <[email protected]> | 2016-03-25 14:40:44 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-03-25 14:40:44 -0700 |
commit | 31489861847dcb15a2f21ffb70d98f9da6051c8f (patch) | |
tree | 4888cee30f9c7d107ce326e4dd9e8bdc912a8baa /OpenAL32/alSource.c | |
parent | 19b130c45d0760f44b453cec6be33ae5cef48851 (diff) |
Implement AL_EXT_STEREO_ANGLES support
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 250c9d1e..d7b68185 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -104,6 +104,9 @@ typedef enum SourceProp { srcSampleOffsetLatencySOFT = AL_SAMPLE_OFFSET_LATENCY_SOFT, srcSecOffsetLatencySOFT = AL_SEC_OFFSET_LATENCY_SOFT, + /* AL_EXT_STEREO_ANGLES */ + srcAngles = AL_STEREO_ANGLES, + /* AL_EXT_BFORMAT */ srcOrientation = AL_ORIENTATION, } SourceProp; @@ -157,6 +160,7 @@ static ALint FloatValsByProp(ALenum prop) case AL_SAMPLE_RW_OFFSETS_SOFT: case AL_BYTE_RW_OFFSETS_SOFT: + case AL_STEREO_ANGLES: return 2; case AL_POSITION: @@ -221,6 +225,7 @@ static ALint DoubleValsByProp(ALenum prop) case AL_SAMPLE_RW_OFFSETS_SOFT: case AL_BYTE_RW_OFFSETS_SOFT: case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_STEREO_ANGLES: return 2; case AL_POSITION: @@ -299,6 +304,8 @@ static ALint IntValsByProp(ALenum prop) break; /* i64 only */ case AL_SEC_OFFSET_LATENCY_SOFT: break; /* Double only */ + case AL_STEREO_ANGLES: + break; /* Float/double only */ } return 0; } @@ -359,6 +366,8 @@ static ALint Int64ValsByProp(ALenum prop) case AL_SEC_OFFSET_LATENCY_SOFT: break; /* Double only */ + case AL_STEREO_ANGLES: + break; /* Float/double only */ } return 0; } @@ -507,6 +516,17 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p return AL_TRUE; + case AL_STEREO_ANGLES: + CHECKVAL(isfinite(values[0]) && isfinite(values[1])); + + LockContext(Context); + Source->StereoPan[0] = values[0]; + Source->StereoPan[1] = values[1]; + UnlockContext(Context); + ATOMIC_STORE(&Source->NeedsUpdate, AL_TRUE); + return AL_TRUE; + + case AL_POSITION: CHECKVAL(isfinite(values[0]) && isfinite(values[1]) && isfinite(values[2])); @@ -830,6 +850,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SAMPLE_OFFSET_LATENCY_SOFT: case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_STEREO_ANGLES: break; } @@ -931,6 +952,7 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp return SetSourcefv(Source, Context, (int)prop, fvals); case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_STEREO_ANGLES: break; } @@ -1054,6 +1076,13 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p UnlockContext(Context); return AL_TRUE; + case AL_STEREO_ANGLES: + LockContext(Context); + values[0] = Source->StereoPan[0]; + values[1] = Source->StereoPan[1]; + UnlockContext(Context); + return AL_TRUE; + case AL_POSITION: LockContext(Context); values[0] = Source->Position.v[0]; @@ -1325,6 +1354,8 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p break; /* i64 only */ case AL_SEC_OFFSET_LATENCY_SOFT: break; /* Double only */ + case AL_STEREO_ANGLES: + break; /* Float/double only */ case AL_DIRECT_FILTER: case AL_AUXILIARY_SEND_FILTER: @@ -1446,6 +1477,8 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_SEC_OFFSET_LATENCY_SOFT: break; /* Double only */ + case AL_STEREO_ANGLES: + break; /* Float/double only */ } ERR("Unexpected property: 0x%04x\n", prop); @@ -2530,6 +2563,9 @@ static ALvoid InitSourceParams(ALsource *Source) Source->DopplerFactor = 1.0f; Source->DirectChannels = AL_FALSE; + Source->StereoPan[0] = DEG2RAD( 30.0f); + Source->StereoPan[1] = DEG2RAD(-30.0f); + Source->Radius = 0.0f; Source->DistanceModel = DefaultDistanceModel; |