MCPcopy Create free account
hub / github.com/AbyssEngine/AbyssEngineOld / getSample

Method getSample

src/Abyss/Streams/SoundEffect.cpp:58–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58int16_t SoundEffect::getSample() {
59 std::lock_guard lock(_mutex);
60
61 auto sample = static_cast<int32_t>(_audioStream->getSample());
62
63 if (sample == 0)
64 return 0;
65
66 sample = static_cast<int32_t>(static_cast<float>(sample) * _volumeActual);
67
68 sample = std::clamp(sample, -32768, 32767);
69
70 return static_cast<int16_t>(sample);
71}
72
73} // namespace Abyss::Streams

Callers 2

fillAudioBufferMethod · 0.45
getAudioSampleMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected