Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarVoice.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-12-31 15:26:01 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2024-12-31 15:26:01 +1100
commit4903d39eed1af80021e95424731038080ed1c9a3 (patch)
tree3fbed21674ad9ebe3c2adcfccea26cc1797574fa /source/frontend/StarVoice.cpp
parent9e3341f2f25861b1a0c5dc62a97163ed4ab59254 (diff)
clang hates that I guess
Diffstat (limited to 'source/frontend/StarVoice.cpp')
-rw-r--r--source/frontend/StarVoice.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/frontend/StarVoice.cpp b/source/frontend/StarVoice.cpp
index 1328846..978bc2c 100644
--- a/source/frontend/StarVoice.cpp
+++ b/source/frontend/StarVoice.cpp
@@ -387,7 +387,7 @@ void Voice::mix(int16_t* buffer, size_t frameCount, unsigned channels) {
mix = true;
float volume = speaker->volume;
- Array2F levels = speaker->channelVolumes;
+ std::array<float, 2> levels = speaker->channelVolumes;
for (size_t i = 0; i != samples; ++i)
sharedBuffer[i] += (int32_t)(speakerBuffer[i]) * levels[i % 2] * volume;
//Blends the weaker channel into the stronger one,
@@ -438,14 +438,12 @@ void Voice::mix(int16_t* buffer, size_t frameCount, unsigned channels) {
void Voice::update(float, PositionalAttenuationFunction positionalAttenuationFunction) {
for (auto& entry : m_speakers) {
if (SpeakerPtr& speaker = entry.second) {
- if (positionalAttenuationFunction) {
- speaker->channelVolumes = {
- 1.0f - positionalAttenuationFunction(0, speaker->position, 1.0f),
- 1.0f - positionalAttenuationFunction(1, speaker->position, 1.0f)
- };
- }
- else
- speaker->channelVolumes = Vec2F::filled(1.0f);
+ if (positionalAttenuationFunction) {
+ speaker->channelVolumes = {
+ 1.0f - positionalAttenuationFunction(0, speaker->position, 1.0f),
+ 1.0f - positionalAttenuationFunction(1, speaker->position, 1.0f)};
+ } else
+ speaker->channelVolumes = {1.0f, 1.0f};
auto& dbHistory = speaker->dbHistory;
memmove(&dbHistory[1], &dbHistory[0], (dbHistory.size() - 1) * sizeof(float));