Merge branch 'master' of https://github.com/worklist/hifi into 19508

Conflicts:
	assignment-client/src/audio/AudioMixer.cpp
	assignment-client/src/audio/AudioMixerClientData.cpp
	interface/interface_en.ts
	interface/src/Menu.cpp
	libraries/audio/src/AudioRingBuffer.cpp
This commit is contained in:
stojce 2014-03-21 22:35:57 +01:00
commit aaa5e15035
13 changed files with 91 additions and 332 deletions

View file

@ -370,50 +370,6 @@ void AudioMixer::run() {
_maxSourceLoudnessInFrame);
}
}
const float STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD = 0.10;
const float BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD = 0.30;
const float CUTOFF_EPSILON = 0.0001;
const int TRAILING_AVERAGE_FRAMES = 100;
const float CURRENT_FRAME_RATIO = 1.0f / TRAILING_AVERAGE_FRAMES;
const float PREVIOUS_FRAMES_RATIO = 1 - CURRENT_FRAME_RATIO;
if (usecToSleep < 0) {
usecToSleep = 0;
}
_trailingSleepRatio = (PREVIOUS_FRAMES_RATIO * _trailingSleepRatio)
+ (usecToSleep * CURRENT_FRAME_RATIO / (float) BUFFER_SEND_INTERVAL_USECS);
float lastCutoffRatio = _loudnessCutoffRatio;
bool hasRatioChanged = false;
if (_trailingSleepRatio <= STRUGGLE_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD) {
// we're struggling - change our min required loudness to reduce some load
_loudnessCutoffRatio += (1 - _loudnessCutoffRatio) / 2;
qDebug() << "Mixer is struggling, sleeping" << _trailingSleepRatio * 100 << "% of frame time. Old cutoff was"
<< lastCutoffRatio << "and is now" << _loudnessCutoffRatio;
hasRatioChanged = true;
} else if (_trailingSleepRatio >= BACK_OFF_TRIGGER_SLEEP_PERCENTAGE_THRESHOLD && _loudnessCutoffRatio != 0) {
// we've recovered and can back off the required loudness
_loudnessCutoffRatio -= _loudnessCutoffRatio / 2;
if (_loudnessCutoffRatio < CUTOFF_EPSILON) {
_loudnessCutoffRatio = 0;
}
qDebug() << "Mixer is recovering, sleeping" << _trailingSleepRatio * 100 << "% of frame time. Old cutoff was"
<< lastCutoffRatio << "and is now" << _loudnessCutoffRatio;
hasRatioChanged = true;
}
if (hasRatioChanged) {
// set out min required loudness from the new ratio
_minRequiredLoudness = _loudnessCutoffRatio * (_maxSourceLoudnessInFrame - _minSourceLoudnessInFrame);
qDebug() << "Minimum loudness required to be mixed is now" << _minRequiredLoudness;
}
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
if (node->getType() == NodeType::Agent && node->getActiveSocket() && node->getLinkedData()

View file

@ -96,16 +96,7 @@ void AudioMixerClientData::checkBuffersBeforeFrameSend(int jitterBufferLengthSam
// calculate the average loudness for the next NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL
// that would be mixed in
_ringBuffers[i]->updateAverageLoudnessForBoundarySamples(NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
float ringBufferLoudness = _ringBuffers[i]->getAverageLoudness();
if (ringBufferLoudness != 0 && ringBufferLoudness < currentMinLoudness) {
currentMinLoudness = ringBufferLoudness;
}
if (ringBufferLoudness > currentMaxLoudness) {
currentMaxLoudness = ringBufferLoudness;
}
}
}
}

View file

@ -26,15 +26,25 @@ var CHANCE_OF_MOVING = 0.005;
var CHANCE_OF_SOUND = 0.005;
var CHANCE_OF_HEAD_TURNING = 0.05;
var CHANCE_OF_BIG_MOVE = 0.1;
var CHANCE_OF_WAVING = 0.005; // Currently this isn't working
var shouldReceiveVoxels = true;
var VOXEL_FPS = 60.0;
var lastVoxelQueryTime = 0.0;
var isMoving = false;
var isTurningHead = false;
var isPlayingAudio = false;
var isWaving = false;
var waveFrequency = 0.0;
var waveAmplitude = 0.0;
var X_MIN = 0.0;
var X_MAX = 5.0;
var Z_MIN = 0.0;
var Z_MAX = 5.0;
var Y_PELVIS = 2.5;
var SHOULDER_JOINT_NUMBER = 15;
var MOVE_RANGE_SMALL = 0.5;
var MOVE_RANGE_BIG = Math.max(X_MAX - X_MIN, Z_MAX - Z_MIN) / 2.0;
@ -51,6 +61,8 @@ var targetDirection = { x: 0, y: 0, z: 0, w: 0 };
var currentDirection = { x: 0, y: 0, z: 0, w: 0 };
var targetHeadPitch = 0.0;
var cumulativeTime = 0.0;
var sounds = [];
loadSounds();
@ -100,13 +112,37 @@ Agent.isListeningToAudioStream = true;
Avatar.position = firstPosition;
printVector("New bot, position = ", Avatar.position);
function stopWaving() {
isWaving = false;
Avatar.clearJointData(SHOULDER_JOINT_NUMBER);
}
function updateBehavior(deltaTime) {
if (Math.random() < CHANCE_OF_SOUND) {
playRandomSound();
cumulativeTime += deltaTime;
if (shouldReceiveVoxels && ((cumulativeTime - lastVoxelQueryTime) > (1.0 / VOXEL_FPS))) {
VoxelViewer.setPosition(Avatar.position);
VoxelViewer.setOrientation(Avatar.orientation);
VoxelViewer.queryOctree();
lastVoxelQueryTime = cumulativeTime;
/*
if (Math.random() < (1.0 / VOXEL_FPS)) {
print("Voxels in view = " + VoxelViewer.getOctreeElementsCount());
}*/
}
if (Agent.isPlayingAvatarSound) {
Avatar.handPosition = Vec3.sum(Avatar.position, Quat.getFront(Avatar.orientation));
if (!isWaving && (Math.random() < CHANCE_OF_WAVING)) {
isWaving = true;
waveFrequency = 1.0 + Math.random() * 5.0;
waveAmplitude = 5.0 + Math.random() * 60.0;
Script.setTimeout(stopWaving, 1000 + Math.random() * 2000);
} else if (isWaving) {
Avatar.setJointData(SHOULDER_JOINT_NUMBER, Quat.fromPitchYawRollDegrees(0.0, 0.0, waveAmplitude * Math.sin(cumulativeTime * waveFrequency)));
}
if (Math.random() < CHANCE_OF_SOUND) {
playRandomSound();
}
if (!isTurningHead && (Math.random() < CHANCE_OF_HEAD_TURNING)) {

View file

@ -12,6 +12,10 @@ var AMPLITUDE = 45.0;
var cumulativeTime = 0.0;
print("Joint List:");
var jointList = MyAvatar.getJointNames();
print(jointList);
Script.update.connect(function(deltaTime) {
cumulativeTime += deltaTime;
MyAvatar.setJointData("joint_R_hip", Quat.fromPitchYawRollDegrees(0.0, 0.0, AMPLITUDE * Math.sin(cumulativeTime * FREQUENCY)));

View file

@ -33,7 +33,7 @@ var zFightingSizeAdjust = 0.002; // used to adjust preview voxels to prevent z f
var previewLineWidth = 1.5;
var oldMode = Camera.getMode();
var trackAsOrbitOrPan = false;
var isAdding = false;
var isExtruding = false;
var extrudeDirection = { x: 0, y: 0, z: 0 };
@ -792,7 +792,6 @@ function mousePressEvent(event) {
if (!trackAsOrbitOrPan) {
var clickedOnSomething = false;
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
// If the user clicked on the thumb, handle the slider logic
if (clickedOverlay == thumb) {
@ -1113,7 +1112,6 @@ function mouseMoveEvent(event) {
var dy = event.y - mouseY;
if (Math.sqrt(dx*dx + dy*dy) > PIXELS_PER_EXTRUDE_VOXEL) {
lastVoxelPosition = Vec3.sum(lastVoxelPosition, extrudeDirection);
Voxels.eraseVoxel(voxelDetails.x, voxelDetails.y, voxelDetails.z, voxelDetails.s);
Voxels.setVoxel(lastVoxelPosition.x, lastVoxelPosition.y, lastVoxelPosition.z,
extrudeScale, lastVoxelColor.red, lastVoxelColor.green, lastVoxelColor.blue);
mouseX = event.x;

View file

@ -12,6 +12,11 @@
//
//
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
var lastX = 0;
var lastY = 0;
var yawFromMouse = 0;
@ -19,17 +24,22 @@ var pitchFromMouse = 0;
var isMouseDown = false;
var BULLET_VELOCITY = 5.0;
var MIN_THROWER_DELAY = 1000;
var MAX_THROWER_DELAY = 1000;
var LEFT_BUTTON_3 = 3;
// Load some sound to use for loading and firing
var fireSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/GUN-SHOT2.raw");
var loadSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/Gun_Reload_Weapon22.raw");
var impactSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/BulletImpact2.raw");
var targetLaunchSound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guns/GUN-SHOT2.raw");
var targetHitSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/hit.raw");
var targetLaunchSound = new Sound("http://highfidelity-public.s3-us-west-1.amazonaws.com/sounds/Space%20Invaders/shoot.raw");
var audioOptions = new AudioInjectionOptions();
audioOptions.volume = 0.9;
var shotTime = new Date();
// initialize our triggers
var triggerPulled = new Array();
var numberOfTriggers = Controller.getNumberOfTriggers();
@ -94,7 +104,9 @@ function shootTarget() {
var DISTANCE_TO_LAUNCH_FROM = 3.0;
var camera = Camera.getPosition();
//printVector("camera", camera);
var forwardVector = Quat.getFront(Camera.getOrientation());
var targetDirection = Quat.angleAxis(getRandomFloat(-20.0, 20.0), { x:0, y:1, z:0 });
targetDirection = Quat.multiply(Camera.getOrientation(), targetDirection);
var forwardVector = Quat.getFront(targetDirection);
//printVector("forwardVector", forwardVector);
var newPosition = Vec3.sum(camera, Vec3.multiply(forwardVector, DISTANCE_TO_LAUNCH_FROM));
//printVector("newPosition", newPosition);
@ -111,6 +123,9 @@ function shootTarget() {
lifetime: 1000.0,
damping: 0.99 });
// Record start time
shotTime = new Date();
// Play target shoot sound
audioOptions.position = newPosition;
Audio.playSound(targetLaunchSound, audioOptions);
@ -119,31 +134,43 @@ function shootTarget() {
function particleCollisionWithVoxel(particle, voxel, penetration) {
Vec3.print('particleCollisionWithVoxel() ... penetration=', penetration);
var HOLE_SIZE = 0.125;
var particleProperties = Particles.getParticleProperties(particle);
var position = particleProperties.position;
Particles.deleteParticle(particle);
// Make a hole in this voxel
Vec3.print("penetration", penetration);
Vec3.print("position", position);
var pointOfEntry = Vec3.subtract(position, penetration);
Vec3.print("pointOfEntry", pointOfEntry);
Voxels.eraseVoxel(pointOfEntry.x, pointOfEntry.y, pointOfEntry.z, HOLE_SIZE);
Voxels.eraseVoxel(position.x, position.y, position.z, HOLE_SIZE);
//audioOptions.position = position;
audioOptions.position = Vec3.sum(Camera.getPosition(), Quat.getFront(Camera.getOrientation()));
Audio.playSound(impactSound, audioOptions);
Audio.playSound(targetHitSound, audioOptions);
}
function particleCollisionWithParticle(particle1, particle2) {
print("Particle/Particle!");
score++;
Overlays.editOverlay(text, { text: "Score: " + score } );
// Sort out which particle is which
// Record shot time
var endTime = new Date();
var msecs = endTime.valueOf() - shotTime.valueOf();
print("hit, msecs = " + msecs);
Particles.deleteParticle(particle1);
Particles.deleteParticle(particle2);
audioOptions.position = newPosition;
audioOptions.position = Vec3.sum(Camera.getPosition(), Quat.getFront(Camera.getOrientation()));
Audio.playSound(targetHitSound, audioOptions);
}
function keyPressEvent(event) {
// if our tools are off, then don't do anything
if (event.text == "t") {
shootTarget();
var time = MIN_THROWER_DELAY + Math.random() * MAX_THROWER_DELAY;
Script.setTimeout(shootTarget, time);
}
}
@ -164,7 +191,8 @@ function update(deltaTime) {
// Check hydra controller for launch button press
if (!isLaunchButtonPressed && Controller.isButtonPressed(LEFT_BUTTON_3)) {
isLaunchButtonPressed = true;
shootTarget();
var time = MIN_THROWER_DELAY + Math.random() * MAX_THROWER_DELAY;
Script.setTimeout(shootTarget, time);
} else if (isLaunchButtonPressed && !Controller.isButtonPressed(LEFT_BUTTON_3)) {
isLaunchButtonPressed = false;

View file

@ -1,133 +0,0 @@
//
// This sample script moves a voxel around like a bird and sometimes makes tweeting noises
//
function vLength(v) {
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
}
function printVector(v) {
print(v.x + ", " + v.y + ", " + v.z + "\n");
}
// Create a random vector with individual lengths between a,b
function randVector(a, b) {
var rval = { x: a + Math.random() * (b - a), y: a + Math.random() * (b - a), z: a + Math.random() * (b - a) };
return rval;
}
function vMinus(a, b) {
var rval = { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
return rval;
}
function vPlus(a, b) {
var rval = { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
return rval;
}
function vCopy(a, b) {
a.x = b.x;
a.y = b.y;
a.z = b.z;
return;
}
// Returns a vector which is fraction of the way between a and b
function vInterpolate(a, b, fraction) {
var rval = { x: a.x + (b.x - a.x) * fraction, y: a.y + (b.y - a.y) * fraction, z: a.z + (b.z - a.z) * fraction };
return rval;
}
// Decide what kind of bird we are
var tweet;
var which = Math.random();
if (which < 0.2) {
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw");
} else if (which < 0.4) {
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/rosyfacedlovebird.raw");
} else if (which < 0.6) {
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/saysphoebe.raw");
} else if (which < 0.8) {
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
} else {
tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/westernscreechowl.raw");
}
var position = { x: 0, y: 0, z: 0 };
var lastPosition = { x: 0, y: 0, z: 0 };
var oldPosition = { x: 0, y: 0, z:0 };
var targetPosition = { x: 0, y: 0, z: 0 };
var size = 0.125;
var range = 50.0; // Over what distance in meters do you want your bird to fly around
var color = { r: 100, g: 50, b: 150 };
var colorEdge = { r:255, g:250, b:175 };
var frame = 0;
var thisColor = color;
var moving = false;
var tweeting = 0;
var moved = true;
var CHANCE_OF_MOVING = 0.05;
var CHANCE_OF_TWEETING = 0.05;
function moveBird(deltaTime) {
frame++;
if (frame % 3 == 0) {
// Tweeting behavior
if (tweeting == 0) {
if (Math.random() < CHANCE_OF_TWEETING) {
//print("tweet!" + "\n");
var options = new AudioInjectionOptions();
options.position = position;
options.volume = 0.75;
Audio.playSound(tweet, options);
tweeting = 10;
}
} else {
tweeting -= 1;
}
// Moving behavior
if (moving == false) {
if (Math.random() < CHANCE_OF_MOVING) {
targetPosition = randVector(0, range);
//printVector(position);
moving = true;
}
}
if (moving) {
position = vInterpolate(position, targetPosition, 0.5);
if (vLength(vMinus(position, targetPosition)) < (size / 2.0)) {
moved = false;
moving = false;
} else {
moved = true;
}
}
if (tweeting > 0) {
// Change color of voxel to blinky red a bit while playing the sound
var blinkColor = { r: Math.random() * 255, g: 0, b: 0 };
Voxels.setVoxel(position.x,
position.y,
position.z,
size,
blinkColor.r, blinkColor.g, blinkColor.b);
}
if (moved) {
Voxels.setVoxel(position.x, position.y, position.z, size, thisColor.r, thisColor.g, thisColor.b);
// delete old voxel
Voxels.eraseVoxel(oldPosition.x, oldPosition.y, oldPosition.z, size);
// Copy old location to new
vCopy(oldPosition, position);
moved = false;
}
}
}
Voxels.setPacketsPerSecond(10000);
// Connect a call back that happens every frame
Script.update.connect(moveBird);

View file

@ -113,139 +113,22 @@
<context>
<name>Menu</name>
<message>
<location filename="src/Menu.cpp" line="440"/>
<location filename="src/Menu.cpp" line="439"/>
<source>Open .ini config file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Menu.cpp" line="442"/>
<location filename="src/Menu.cpp" line="454"/>
<location filename="src/Menu.cpp" line="441"/>
<location filename="src/Menu.cpp" line="453"/>
<source>Text files (*.ini)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Menu.cpp" line="452"/>
<location filename="src/Menu.cpp" line="451"/>
<source>Save .ini config file</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PreferencesDialog</name>
<message>
<location filename="ui/preferencesDialog.ui" line="196"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="611"/>
<source>Avatar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="230"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="612"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Avatar display name &lt;span style=&quot; color:#909090;&quot;&gt;(optional)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="266"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="613"/>
<source>Not showing a name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="294"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="614"/>
<source>Head</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="395"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="616"/>
<source>Body</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="506"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="618"/>
<source>Advanced Tuning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="534"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="619"/>
<source>It&apos;s not recomended that you play with these settings unless you&apos;ve looked into exactly what they do.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="570"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="620"/>
<source>&lt;p&gt;Avatar&lt;/p&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="702"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="622"/>
<source>Lean scale (applies to Faceshift users)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="602"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="621"/>
<source>Vertical field of view</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="784"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="623"/>
<source>Avatar scale (default is 1.0)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="863"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="624"/>
<source>Pupil dillation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="939"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="625"/>
<source>Audio Jitter Buffer Samples (0 for automatic)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="1027"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="626"/>
<source>Faceshift eye detection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="1104"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="627"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Voxels&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="1136"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="628"/>
<source>Maximum voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="1212"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="629"/>
<source>Max voxels sent each second</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="90"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="609"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="125"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="610"/>
<source>Save all changes</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>

View file

@ -40,7 +40,7 @@ detect_strip_roi_width 2
detect_strip_roi_height 4
smoothing_factors
150 5 -2 100 -1 50 50 0
5 25 -2 100 -1 50 25 0
#translation rotation action_units eyebrows mouth gaze eye_closure other
process_eyes 1

View file

@ -66,12 +66,8 @@ void AudioRingBuffer::updateAverageLoudnessForBoundarySamples(int numSamples) {
nextLoudness /= numSamples;
nextLoudness /= MAX_SAMPLE_VALUE;
const int TRAILING_AVERAGE_FRAMES = 100;
const float CURRENT_FRAME_RATIO = 1.0f / TRAILING_AVERAGE_FRAMES;
const float PREVIOUS_FRAMES_RATIO = 1 - CURRENT_FRAME_RATIO;
_averageLoudness = (_averageLoudness * PREVIOUS_FRAMES_RATIO) + (CURRENT_FRAME_RATIO * nextLoudness);
_averageLoudness = nextLoudness;
}
qint64 AudioRingBuffer::readSamples(int16_t* destination, qint64 maxSamples) {

View file

@ -80,13 +80,11 @@ int PositionalAudioRingBuffer::parsePositionalData(const QByteArray& positionalB
bool PositionalAudioRingBuffer::shouldBeAddedToMix(int numJitterBufferSamples) {
if (!isNotStarvedOrHasMinimumSamples(NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL + numJitterBufferSamples)) {
if (_shouldOutputStarveDebug) {
qDebug() << "Starved and do not have minimum samples to start. Buffer held back.";
_shouldOutputStarveDebug = false;
}
return false;
} else if (samplesAvailable() < NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL) {
qDebug() << "Do not have number of samples needed for interval. Buffer starved.";
_isStarved = true;
// reset our _shouldOutputStarveDebug to true so the next is printed

View file

@ -11,9 +11,10 @@
#include <GeometryUtil.h>
#include <SharedUtil.h>
#include "AvatarData.h"
#include "AvatarData.h"
#include "HandData.h"
HandData::HandData(AvatarData* owningAvatar) :
_owningAvatarData(owningAvatar)
{

View file

@ -56,6 +56,7 @@ void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeTy
void ThreadedAssignment::checkInWithDomainServerOrExit() {
if (NodeList::getInstance()->getNumNoReplyDomainCheckIns() == MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
qDebug() << "NRDC:" << NodeList::getInstance()->getNumNoReplyDomainCheckIns();
setFinished(true);
} else {
NodeList::getInstance()->sendDomainServerCheckIn();