MCPcopy Create free account
hub / github.com/ValveSoftware/steam-audio / SoundPath

Method SoundPath

core/src/core/path_data.cpp:27–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25// --------------------------------------------------------------------------------------------------------------------
26
27SoundPath::SoundPath(const ProbePath& probePath,
28 const ProbeBatch& probes)
29 : SoundPath()
30{
31 if (probePath.valid)
32 {
33 if (probePath.nodes.empty())
34 {
35 direct = true;
36 }
37 else
38 {
39 firstProbe = probePath.nodes.front();
40 lastProbe = probePath.nodes.back();
41
42 if (probePath.nodes.size() >= 2)
43 {
44 probeAfterFirst = probePath.nodes[1];
45 probeBeforeLast = probePath.nodes[probePath.nodes.size() - 2];
46 }
47
48 for (auto i = 1u; i < probePath.nodes.size(); ++i)
49 {
50 const auto& prevPoint = probes[probePath.nodes[i - 1]].influence.center;
51 const auto& curPoint = probes[probePath.nodes[i]].influence.center;
52
53 distanceInternal += (curPoint - prevPoint).length();
54 }
55
56 for (auto i = 1u; i < probePath.nodes.size() - 1; ++i)
57 {
58 const auto& prevPoint = probes[probePath.nodes[i - 1]].influence.center;
59 const auto& curPoint = probes[probePath.nodes[i]].influence.center;
60 const auto& nextPoint = probes[probePath.nodes[i + 1]].influence.center;
61
62 auto prevDir = Vector3f::unitVector(curPoint - prevPoint);
63 auto nextDir = Vector3f::unitVector(nextPoint - curPoint);
64
65 deviationInternal += Vector3f::angleBetween(prevDir, nextDir);
66 }
67 }
68 }
69}
70
71float SoundPath::distance(const ProbeBatch& probes,
72 int start,

Callers

nothing calls this directly

Calls 3

unitVectorFunction · 0.50
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected