| 50 | } |
| 51 | |
| 52 | void OvAudio::Core::AudioEngine::Update() |
| 53 | { |
| 54 | if (!IsValid()) |
| 55 | { |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | for (const auto& source : m_audioSources) |
| 60 | { |
| 61 | source.get().Update(); |
| 62 | } |
| 63 | |
| 64 | // Defines the listener position using the last listener created (If any) |
| 65 | const auto listener = FindMainListener(); |
| 66 | |
| 67 | if (listener.has_value()) |
| 68 | { |
| 69 | const auto& transform = listener->GetTransform(); |
| 70 | const auto& pos = transform.GetWorldPosition(); |
| 71 | const auto at = transform.GetWorldForward() * -1.0f; |
| 72 | m_backend->set3dListenerPosition(pos.x, pos.y, pos.z); |
| 73 | m_backend->set3dListenerAt(at.x, at.y, at.z); |
| 74 | } |
| 75 | else |
| 76 | { |
| 77 | m_backend->set3dListenerPosition(0.0f, 0.0f, 0.0f); |
| 78 | m_backend->set3dListenerAt(0.0f, 0.0f, -1.0f); |
| 79 | } |
| 80 | |
| 81 | m_backend->update3dAudio(); |
| 82 | } |
| 83 | |
| 84 | void OvAudio::Core::AudioEngine::Suspend() |
| 85 | { |
nothing calls this directly
no test coverage detected