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

Method setVolume

src/Abyss/Streams/SoundEffect.cpp:39–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void SoundEffect::setVolume(const float volume) {
40 std::lock_guard lock(_mutex);
41
42 _volume = volume;
43 _volumeActual = std::pow(volume, 2.0f);
44
45 if (_volume > 1.0f) {
46 _volume = 1.0f;
47 } else if (_volume < 0.0f) {
48 _volume = 0.0f;
49 }
50
51 if (_volumeActual > 1.0f) {
52 _volumeActual = 1.0f;
53 } else if (_volumeActual < 0.0f) {
54 _volumeActual = 0.0f;
55 }
56}
57
58int16_t SoundEffect::getSample() {
59 std::lock_guard lock(_mutex);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected