mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 19:01:14 +02:00
loop and variable name cleanup
This commit is contained in:
parent
e514c95642
commit
5bc8c83706
1 changed files with 6 additions and 7 deletions
|
@ -708,13 +708,12 @@ void Audio::addSpatialAudioToBuffer(unsigned int sampleTime, const QByteArray& s
|
||||||
mixedSamplesCount = (mixedSamplesCount < numSamples) ? mixedSamplesCount : numSamples;
|
mixedSamplesCount = (mixedSamplesCount < numSamples) ? mixedSamplesCount : numSamples;
|
||||||
|
|
||||||
const int16_t* spatial = reinterpret_cast<const int16_t*>(spatialAudio.data());
|
const int16_t* spatial = reinterpret_cast<const int16_t*>(spatialAudio.data());
|
||||||
int j = 0;
|
for (int i = 0; i < mixedSamplesCount; i++) {
|
||||||
for (int i = mixedSamplesCount; --i >= 0; j++) {
|
int existingSample = _spatialAudioRingBuffer[i + offset];
|
||||||
int t1 = _spatialAudioRingBuffer[j + offset];
|
int newSample = spatial[i];
|
||||||
int t2 = spatial[j];
|
int sumOfSamples = existingSample + newSample;
|
||||||
int tmp = t1 + t2;
|
_spatialAudioRingBuffer[i + offset] = static_cast<int16_t>(glm::clamp<int>(sumOfSamples,
|
||||||
_spatialAudioRingBuffer[j + offset] =
|
std::numeric_limits<short>::min(), std::numeric_limits<short>::max()));
|
||||||
static_cast<int16_t>(glm::clamp<int>(tmp, std::numeric_limits<short>::min(), std::numeric_limits<short>::max()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the remaining unoverlapped spatial audio to the spatial audio buffer, if any
|
// Copy the remaining unoverlapped spatial audio to the spatial audio buffer, if any
|
||||||
|
|
Loading…
Reference in a new issue