| 1343 | } |
| 1344 | |
| 1345 | void Object::renderSounds(RenderCallback* renderCallback) { |
| 1346 | if (m_soundEffectEnabled.get()) { |
| 1347 | if (!m_config->soundEffect.empty() && (!m_soundEffect || m_soundEffect->finished())) { |
| 1348 | auto& root = Root::singleton(); |
| 1349 | |
| 1350 | m_soundEffect = make_shared<AudioInstance>(*root.assets()->audio(m_config->soundEffect)); |
| 1351 | m_soundEffect->setLoops(-1); |
| 1352 | // Randomize the start position of the looping persistent audio |
| 1353 | m_soundEffect->seekTime(Random::randf() * m_soundEffect->totalTime()); |
| 1354 | m_soundEffect->setRangeMultiplier(m_config->soundEffectRangeMultiplier); |
| 1355 | m_soundEffect->setPosition(metaBoundBox().center() + position()); |
| 1356 | // Fade the audio in slowly |
| 1357 | m_soundEffect->setVolume(0); |
| 1358 | m_soundEffect->setVolume(1, 1.0); |
| 1359 | |
| 1360 | renderCallback->addAudio(m_soundEffect); |
| 1361 | } |
| 1362 | } else { |
| 1363 | if (m_soundEffect) |
| 1364 | m_soundEffect->stop(); |
| 1365 | } |
| 1366 | } |
| 1367 | |
| 1368 | List<ObjectOrientationPtr> const& Object::getOrientations() const { |
| 1369 | return m_orientations ? *m_orientations : m_config->orientations; |
nothing calls this directly
no test coverage detected