mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-12 14:35:29 +02:00
whitespace
This commit is contained in:
parent
9eed430f49
commit
5065f027e7
1 changed files with 3 additions and 3 deletions
|
@ -268,7 +268,7 @@ var LOUDNESS_FLOOR = 11.0;
|
||||||
var LOUDNESS_SCALE = 2.8 / 5.0;
|
var LOUDNESS_SCALE = 2.8 / 5.0;
|
||||||
var LOG2 = Math.log(2.0);
|
var LOG2 = Math.log(2.0);
|
||||||
var AUDIO_LEVEL_UPDATE_INTERVAL_MS = 100; // 10hz for now (change this and change the AVERAGING_RATIO too)
|
var AUDIO_LEVEL_UPDATE_INTERVAL_MS = 100; // 10hz for now (change this and change the AVERAGING_RATIO too)
|
||||||
var accumulatedLevels={};
|
var accumulatedLevels = {};
|
||||||
|
|
||||||
function getAudioLevel(id) {
|
function getAudioLevel(id) {
|
||||||
// the VU meter should work similarly to the one in AvatarInputs: log scale, exponentially averaged
|
// the VU meter should work similarly to the one in AvatarInputs: log scale, exponentially averaged
|
||||||
|
@ -278,11 +278,11 @@ function getAudioLevel(id) {
|
||||||
var audioLevel = 0.0;
|
var audioLevel = 0.0;
|
||||||
|
|
||||||
// we will do exponential moving average by taking some the last loudness and averaging
|
// we will do exponential moving average by taking some the last loudness and averaging
|
||||||
accumulatedLevels[id] = AVERAGING_RATIO*(accumulatedLevels[id] || 0 ) + (1-AVERAGING_RATIO)*(avatar.audioLoudness);
|
accumulatedLevels[id] = AVERAGING_RATIO * (accumulatedLevels[id] || 0 ) + (1 - AVERAGING_RATIO) * (avatar.audioLoudness);
|
||||||
|
|
||||||
// add 1 to insure we don't go log() and hit -infinity. Math.log is
|
// add 1 to insure we don't go log() and hit -infinity. Math.log is
|
||||||
// natural log, so to get log base 2, just divide by ln(2).
|
// natural log, so to get log base 2, just divide by ln(2).
|
||||||
var logLevel = Math.log(accumulatedLevels[id]+1) / LOG2;
|
var logLevel = Math.log(accumulatedLevels[id] + 1) / LOG2;
|
||||||
|
|
||||||
if (logLevel <= LOUDNESS_FLOOR) {
|
if (logLevel <= LOUDNESS_FLOOR) {
|
||||||
audioLevel = logLevel / LOUDNESS_FLOOR * LOUDNESS_SCALE;
|
audioLevel = logLevel / LOUDNESS_FLOOR * LOUDNESS_SCALE;
|
||||||
|
|
Loading…
Reference in a new issue