mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
code cleanup
This commit is contained in:
parent
a48811777e
commit
8ccbfcf695
2 changed files with 4 additions and 9 deletions
|
@ -732,7 +732,8 @@ void AudioMixer::run() {
|
|||
|
||||
// Pack stream properties
|
||||
for (int i = 0; i < _zoneReverbSettings.size(); ++i) {
|
||||
glm::vec3 streamPosition = static_cast<AudioMixerClientData*>(node->getLinkedData())->getAvatarAudioStream()->getPosition();
|
||||
AudioMixerClientData* data = static_cast<AudioMixerClientData*>(node->getLinkedData());
|
||||
glm::vec3 streamPosition = data->getAvatarAudioStream()->getPosition();
|
||||
if (_audioZones[_zoneReverbSettings[i].zone].contains(streamPosition)) {
|
||||
bool hasReverb = true;
|
||||
float reverbTime = _zoneReverbSettings[i].reverbTime;
|
||||
|
@ -751,7 +752,6 @@ void AudioMixer::run() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// pack mixed audio samples
|
||||
memcpy(dataAt, _mixSamples, NETWORK_BUFFER_LENGTH_BYTES_STEREO);
|
||||
dataAt += NETWORK_BUFFER_LENGTH_BYTES_STEREO;
|
||||
|
@ -1076,7 +1076,6 @@ void AudioMixer::parseSettingsObject(const QJsonObject &settingsObject) {
|
|||
float wetLevel = reverbObject.value(WET_LEVEL).toString().toFloat(&okWetLevel);
|
||||
|
||||
if (okReverbTime && okWetLevel && _audioZones.contains(zone)) {
|
||||
|
||||
ReverbSettings settings;
|
||||
settings.zone = zone;
|
||||
settings.reverbTime = reverbTime;
|
||||
|
|
|
@ -544,15 +544,11 @@ void Audio::addReverb(int16_t* samplesData, int numSamples, QAudioFormat& audioF
|
|||
for (unsigned int j = sample; j < sample + audioFormat.channelCount(); j++) {
|
||||
if (j == sample) {
|
||||
// left channel
|
||||
int lResult = (int)(samplesData[j] * dryFraction + lValue * wetFraction);
|
||||
if (lResult > 32767) lResult = 32767;
|
||||
if (lResult < -32768) lResult = -32768;
|
||||
int lResult = glm::clamp((int)(samplesData[j] * dryFraction + lValue * wetFraction), -32768, 32767);
|
||||
samplesData[j] = (int16_t)lResult;
|
||||
} else if (j == (sample + 1)) {
|
||||
// right channel
|
||||
int rResult = (int)(samplesData[j] * dryFraction + rValue * wetFraction);
|
||||
if (rResult > 32767) rResult = 32767;
|
||||
if (rResult < -32768) rResult = -32768;
|
||||
int rResult = glm::clamp((int)(samplesData[j] * dryFraction + rValue * wetFraction), -32768, 32767);
|
||||
samplesData[j] = (int16_t)rResult;
|
||||
} else {
|
||||
// ignore channels above 2
|
||||
|
|
Loading…
Reference in a new issue