diff options
author | Chris Robinson <[email protected]> | 2017-12-03 14:45:19 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-12-03 14:45:19 -0800 |
commit | 32f72c7471daaea53c6f0c6a50a98f4a7fec3614 (patch) | |
tree | 4f7f52c212c812506f28a4bbd61008c8af019e6b | |
parent | 5993ef0baa9096ca62d8bca0f17b95c5468ffde3 (diff) |
Add queries to get the source offset with the device clock
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 32 |
2 files changed, 34 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index a4ca829f..fe282c88 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -56,6 +56,8 @@ typedef uint64_t ALCuint64SOFT; #define ALC_DEVICE_CLOCK_SOFT 0x1600 #define ALC_DEVICE_LATENCY_SOFT 0x1601 #define ALC_DEVICE_CLOCK_LATENCY_SOFT 0x1602 +#define AL_SAMPLE_OFFSET_CLOCK_SOFT 0x1202 +#define AL_SEC_OFFSET_CLOCK_SOFT 0x1203 typedef void (ALC_APIENTRY*LPALCGETINTEGER64VSOFT)(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); #ifdef AL_ALEXT_PROTOTYPES ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index db698692..cc19a0c3 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -122,6 +122,10 @@ typedef enum SourceProp { /* AL_SOFT_source_spatialize */ srcSpatialize = AL_SOURCE_SPATIALIZE_SOFT, + + /* ALC_SOFT_device_clock */ + srcSampleOffsetClockSOFT = AL_SAMPLE_OFFSET_CLOCK_SOFT, + srcSecOffsetClockSOFT = AL_SEC_OFFSET_CLOCK_SOFT, } SourceProp; static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values); @@ -236,6 +240,7 @@ static ALint FloatValsByProp(ALenum prop) return 6; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_BUFFER: @@ -243,6 +248,7 @@ static ALint FloatValsByProp(ALenum prop) case AL_AUXILIARY_SEND_FILTER: break; /* i/i64 only */ case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ } return 0; @@ -290,6 +296,7 @@ static ALint DoubleValsByProp(ALenum prop) return 1; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: return 2; @@ -306,6 +313,7 @@ static ALint DoubleValsByProp(ALenum prop) case AL_AUXILIARY_SEND_FILTER: break; /* i/i64 only */ case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ } return 0; @@ -365,8 +373,10 @@ static ALint IntValsByProp(ALenum prop) return 6; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -418,6 +428,7 @@ static ALint Int64ValsByProp(ALenum prop) return 1; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: return 2; case AL_POSITION: @@ -430,6 +441,7 @@ static ALint Int64ValsByProp(ALenum prop) return 6; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -463,6 +475,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SAMPLE_LENGTH_SOFT: case AL_SEC_LENGTH_SOFT: case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: /* Query only */ SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); @@ -676,6 +689,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_DIRECT_FILTER: case AL_AUXILIARY_SEND_FILTER: case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; } @@ -1005,6 +1019,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SAMPLE_OFFSET_LATENCY_SOFT: case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: break; } @@ -1025,6 +1041,7 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_BUFFERS_PROCESSED: case AL_SOURCE_STATE: case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: case AL_BYTE_LENGTH_SOFT: case AL_SAMPLE_LENGTH_SOFT: case AL_SEC_LENGTH_SOFT: @@ -1108,6 +1125,7 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp return SetSourcefv(Source, Context, (int)prop, fvals); case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: break; } @@ -1243,6 +1261,11 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p } return AL_TRUE; + case AL_SEC_OFFSET_CLOCK_SOFT: + values[0] = GetSourceSecOffset(Source, Context, &srcclock); + values[1] = srcclock / 1000000000.0; + return AL_TRUE; + case AL_POSITION: values[0] = Source->Position[0]; values[1] = Source->Position[1]; @@ -1294,6 +1317,7 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_DIRECT_FILTER: case AL_AUXILIARY_SEND_FILTER: case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; } @@ -1514,8 +1538,10 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p return err; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -1559,6 +1585,11 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp } return AL_TRUE; + case AL_SAMPLE_OFFSET_CLOCK_SOFT: + values[0] = GetSourceSampleOffset(Source, Context, &srcclock); + values[1] = srcclock; + return AL_TRUE; + /* 1x float/double */ case AL_CONE_INNER_ANGLE: case AL_CONE_OUTER_ANGLE: @@ -1646,6 +1677,7 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp return err; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ |