MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / update

Method update

src/engine/AudioEngine.cpp:287–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void Xaudio2Effect3D::update(std::chrono::system_clock::time_point const & now, bool leftHanded)
288{
289 using namespace std::chrono;
290
291 float dt = (float)0.001f * duration_cast<milliseconds>(now - prevTime).count();
292
293 affine3 const & xform = transform.get();
294
295 float3 prevP = prevPosition,
296 curP = xform.m_translation,
297 V = dt * (curP - prevP);
298
299 float3 front = xform.transformVector({ 0.f, 0.f, -1.f }),
300 up = xform.transformVector({ 0.f, 1.f, 0.f });
301
302 if (leftHanded)
303 {
304 emitter.Position = X3DAUDIO_VECTOR(curP.x, curP.y, curP.z);
305 emitter.Velocity = X3DAUDIO_VECTOR(V.x, V.y, V.z);
306 emitter.OrientFront = X3DAUDIO_VECTOR(front.x, front.y, front.z);
307 emitter.OrientTop = X3DAUDIO_VECTOR(up.x, up.y, up.z);
308 }
309 else
310 {
311 emitter.Position = X3DAUDIO_VECTOR(curP.x, curP.y, -curP.z);
312 emitter.Velocity = X3DAUDIO_VECTOR(V.x, V.y, -V.z);
313 emitter.OrientFront = X3DAUDIO_VECTOR(front.x, front.y, -front.z);
314 emitter.OrientTop = X3DAUDIO_VECTOR(up.x, up.y, -up.z);
315 }
316
317 prevPosition = prevP;
318 prevTime = now;
319}
320
321//
322// Xaudio2 engine specialization

Callers

nothing calls this directly

Calls 14

warningFunction · 0.85
getMethod · 0.80
GetStateMethod · 0.80
StopMethod · 0.80
setVolumeMethod · 0.80
stopMethod · 0.80
resetMethod · 0.80
maxFunction · 0.50
inverseFunction · 0.50
transformVectorMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected