mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 15:43:17 +02:00
Disable parameter interpolation from reset state
Restores original behavior of constant-volume streams (no initial fade-in)
This commit is contained in:
parent
423da7d737
commit
181a4e9bdc
3 changed files with 31 additions and 1 deletions
|
@ -1081,10 +1081,15 @@ void AudioFOA::render(int16_t* input, float* output, int index, float qw, float
|
|||
// apply gain as uniform scale
|
||||
scaleMatrix_4x4(gain, rotation);
|
||||
|
||||
// disable interpolation from reset state
|
||||
if (_resetState) {
|
||||
memcpy(_rotationState, rotation, sizeof(_rotationState));
|
||||
}
|
||||
|
||||
// rotate and scale the soundfield
|
||||
rotate_4x4(in, _rotationState, rotation, crossfadeTable, FOA_BLOCK);
|
||||
|
||||
// rotation history update
|
||||
// new parameters become old
|
||||
memcpy(_rotationState, rotation, sizeof(_rotationState));
|
||||
|
||||
//
|
||||
|
@ -1119,4 +1124,6 @@ void AudioFOA::render(int16_t* input, float* output, int index, float qw, float
|
|||
output[2*i+0] += accBuffer[0][i + FOA_OVERLAP];
|
||||
output[2*i+1] += accBuffer[1][i + FOA_OVERLAP];
|
||||
}
|
||||
|
||||
_resetState = false;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@ private:
|
|||
|
||||
// orientation and gain history
|
||||
float _rotationState[4][4] = {};
|
||||
|
||||
bool _resetState = true;
|
||||
};
|
||||
|
||||
#endif // AudioFOA_h
|
||||
|
|
|
@ -1141,6 +1141,13 @@ void AudioHRTF::render(int16_t* input, float* output, int index, float azimuth,
|
|||
// apply global and local gain adjustment
|
||||
gain *= _gainAdjust;
|
||||
|
||||
// disable interpolation from reset state
|
||||
if (_resetState) {
|
||||
_azimuthState = azimuth;
|
||||
_distanceState = distance;
|
||||
_gainState = gain;
|
||||
}
|
||||
|
||||
// to avoid polluting the cache, old filters are recomputed instead of stored
|
||||
setFilters(firCoef, bqCoef, delay, index, _azimuthState, _distanceState, _gainState, L0);
|
||||
|
||||
|
@ -1220,11 +1227,18 @@ void AudioHRTF::mixMono(int16_t* input, float* output, float gain, int numFrames
|
|||
// apply global and local gain adjustment
|
||||
gain *= _gainAdjust;
|
||||
|
||||
// disable interpolation from reset state
|
||||
if (_resetState) {
|
||||
_gainState = gain;
|
||||
}
|
||||
|
||||
// crossfade gain and accumulate
|
||||
gainfade_1x2(input, output, crossfadeTable, _gainState, gain, HRTF_BLOCK);
|
||||
|
||||
// new parameters become old
|
||||
_gainState = gain;
|
||||
|
||||
_resetState = false;
|
||||
}
|
||||
|
||||
void AudioHRTF::mixStereo(int16_t* input, float* output, float gain, int numFrames) {
|
||||
|
@ -1234,9 +1248,16 @@ void AudioHRTF::mixStereo(int16_t* input, float* output, float gain, int numFram
|
|||
// apply global and local gain adjustment
|
||||
gain *= _gainAdjust;
|
||||
|
||||
// disable interpolation from reset state
|
||||
if (_resetState) {
|
||||
_gainState = gain;
|
||||
}
|
||||
|
||||
// crossfade gain and accumulate
|
||||
gainfade_2x2(input, output, crossfadeTable, _gainState, gain, HRTF_BLOCK);
|
||||
|
||||
// new parameters become old
|
||||
_gainState = gain;
|
||||
|
||||
_resetState = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue