MCPcopy Create free account
hub / github.com/crownengine/crown / GetSourcei64v

Function GetSourcei64v

3rdparty/openal/al/source.cpp:1917–2055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1915}
1916
1917bool GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, const al::span<ALint64SOFT> values)
1918{
1919 ALCdevice *device = Context->mDevice.get();
1920 ClockLatency clocktime;
1921 nanoseconds srcclock;
1922 ALdouble dvals[MaxValues];
1923 ALint ivals[MaxValues];
1924 bool err;
1925
1926 switch(prop)
1927 {
1928 case AL_SAMPLE_OFFSET_LATENCY_SOFT:
1929 CHECKSIZE(values, 2);
1930 /* Get the source offset with the clock time first. Then get the clock
1931 * time with the device latency. Order is important.
1932 */
1933 values[0] = GetSourceSampleOffset(Source, Context, &srcclock);
1934 {
1935 std::lock_guard<std::mutex> _{device->StateLock};
1936 clocktime = GetClockLatency(device);
1937 }
1938 if(srcclock == clocktime.ClockTime)
1939 values[1] = clocktime.Latency.count();
1940 else
1941 {
1942 /* If the clock time incremented, reduce the latency by that much
1943 * since it's that much closer to the source offset it got earlier.
1944 */
1945 const nanoseconds diff{clocktime.ClockTime - srcclock};
1946 values[1] = nanoseconds{clocktime.Latency - std::min(clocktime.Latency, diff)}.count();
1947 }
1948 return true;
1949
1950 case AL_SAMPLE_OFFSET_CLOCK_SOFT:
1951 CHECKSIZE(values, 2);
1952 values[0] = GetSourceSampleOffset(Source, Context, &srcclock);
1953 values[1] = srcclock.count();
1954 return true;
1955
1956 /* 1x float/double */
1957 case AL_CONE_INNER_ANGLE:
1958 case AL_CONE_OUTER_ANGLE:
1959 case AL_PITCH:
1960 case AL_GAIN:
1961 case AL_MIN_GAIN:
1962 case AL_MAX_GAIN:
1963 case AL_REFERENCE_DISTANCE:
1964 case AL_ROLLOFF_FACTOR:
1965 case AL_CONE_OUTER_GAIN:
1966 case AL_MAX_DISTANCE:
1967 case AL_SEC_OFFSET:
1968 case AL_SAMPLE_OFFSET:
1969 case AL_BYTE_OFFSET:
1970 case AL_DOPPLER_FACTOR:
1971 case AL_AIR_ABSORPTION_FACTOR:
1972 case AL_ROOM_ROLLOFF_FACTOR:
1973 case AL_CONE_OUTER_GAINHF:
1974 case AL_SOURCE_RADIUS:

Callers 1

source.cppFile · 0.85

Calls 8

GetSourceSampleOffsetFunction · 0.85
GetClockLatencyFunction · 0.85
GetSourcedvFunction · 0.85
GetSourceivFunction · 0.85
setErrorMethod · 0.80
minFunction · 0.50
getMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected