MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / renderSounds

Method renderSounds

source/game/StarObject.cpp:1345–1366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1343}
1344
1345void 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
1368List<ObjectOrientationPtr> const& Object::getOrientations() const {
1369 return m_orientations ? *m_orientations : m_config->orientations;

Callers

nothing calls this directly

Calls 15

singletonClass · 0.85
randfFunction · 0.85
audioMethod · 0.80
assetsMethod · 0.80
setLoopsMethod · 0.80
setRangeMultiplierMethod · 0.80
addAudioMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
finishedMethod · 0.45
seekTimeMethod · 0.45
totalTimeMethod · 0.45

Tested by

no test coverage detected