mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 13:50:35 +02:00
for agent loopback perform no distance and angle calculations
This commit is contained in:
parent
00c11d82b2
commit
82cff262b1
2 changed files with 68 additions and 64 deletions
|
@ -120,6 +120,11 @@ void *sendBuffer(void *args) {
|
|||
AudioRingBuffer* otherAgentBuffer = (AudioRingBuffer*) otherAgent->getLinkedData();
|
||||
|
||||
if (otherAgentBuffer->shouldBeAddedToMix()) {
|
||||
|
||||
float bearingRelativeAngleToSource = 0.f;
|
||||
float attenuationCoefficient = 1.f;
|
||||
|
||||
if (otherAgent != agent) {
|
||||
float *agentPosition = agentRingBuffer->getPosition();
|
||||
float *otherAgentPosition = otherAgentBuffer->getPosition();
|
||||
|
||||
|
@ -146,7 +151,6 @@ void *sendBuffer(void *args) {
|
|||
float absoluteAngleToSource = 0;
|
||||
float bearingRelativeAngleToSource = 0;
|
||||
|
||||
|
||||
// find the angle we need for calculation based on the orientation of the triangle
|
||||
if (otherAgentPosition[0] > agentPosition[0]) {
|
||||
if (otherAgentPosition[2] > agentPosition[2]) {
|
||||
|
@ -180,13 +184,14 @@ void *sendBuffer(void *args) {
|
|||
float offAxisCoefficient = MAX_OFF_AXIS_ATTENUATION +
|
||||
(OFF_AXIS_ATTENUATION_FORMULA_STEP * (fabsf(angleOfDelivery) / 90.0f));
|
||||
|
||||
float attenuationCoefficient = distanceCoefficients[lowAgentIndex][highAgentIndex]
|
||||
attenuationCoefficient = distanceCoefficients[lowAgentIndex][highAgentIndex]
|
||||
* otherAgentBuffer->getAttenuationRatio()
|
||||
* offAxisCoefficient;
|
||||
|
||||
float sinRatio = fabsf(sinf(bearingRelativeAngleToSource));
|
||||
int numSamplesDelay = PHASE_DELAY_AT_90 * sinRatio;
|
||||
float weakChannelAmplitudeRatio = 1 - (PHASE_AMPLITUDE_RATIO_AT_90 * sinRatio);
|
||||
}
|
||||
|
||||
int16_t* goodChannel = bearingRelativeAngleToSource > 0 ? clientMix + BUFFER_LENGTH_SAMPLES_PER_CHANNEL : clientMix;
|
||||
int16_t* delayedChannel = bearingRelativeAngleToSource > 0 ? clientMix : clientMix + BUFFER_LENGTH_SAMPLES_PER_CHANNEL;
|
||||
|
|
|
@ -113,6 +113,7 @@ int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
attenuationRatio = attenuationByte / 255.0f;
|
||||
|
||||
memcpy(&bearing, dataPtr, sizeof(float));
|
||||
dataPtr += sizeof(bearing);
|
||||
|
||||
if (bearing > 180 || bearing < -180) {
|
||||
// we were passed an invalid bearing because this agent wants loopback (pressed the H key)
|
||||
|
@ -126,8 +127,6 @@ int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
_shouldLoopbackForAgent = false;
|
||||
}
|
||||
|
||||
dataPtr += sizeof(float);
|
||||
|
||||
sourceBuffer = dataPtr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue