mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-21 20:29:09 +02:00
parent
e30cf33a03
commit
03d3a535f8
2 changed files with 18 additions and 10 deletions
|
@ -11,6 +11,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
||||||
|
var CHANCE_OF_PLAYING_SOUND = 0.01;
|
||||||
|
|
||||||
var FACTOR = 0.75;
|
var FACTOR = 0.75;
|
||||||
|
|
||||||
var countParticles = 0; // the first time around we want to create the particle and thereafter to modify it.
|
var countParticles = 0; // the first time around we want to create the particle and thereafter to modify it.
|
||||||
|
@ -23,11 +25,13 @@ function updateParticle() {
|
||||||
// move particle three units in front of the avatar
|
// move particle three units in front of the avatar
|
||||||
var particlePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(avatarFront, 3));
|
var particlePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(avatarFront, 3));
|
||||||
|
|
||||||
|
if (Math.random() < CHANCE_OF_PLAYING_SOUND) {
|
||||||
// play a sound at the location of the particle
|
// play a sound at the location of the particle
|
||||||
var options = new AudioInjectionOptions();
|
var options = new AudioInjectionOptions();
|
||||||
options.position = particlePosition;
|
options.position = particlePosition;
|
||||||
options.volume = 0.75;
|
options.volume = 0.75;
|
||||||
Audio.playSound(sound, options);
|
Audio.playSound(sound, options);
|
||||||
|
}
|
||||||
|
|
||||||
var audioAverageLoudness = MyAvatar.audioAverageLoudness * FACTOR;
|
var audioAverageLoudness = MyAvatar.audioAverageLoudness * FACTOR;
|
||||||
//print ("Audio Loudness = " + MyAvatar.audioLoudness + " -- Audio Average Loudness = " + MyAvatar.audioAverageLoudness);
|
//print ("Audio Loudness = " + MyAvatar.audioLoudness + " -- Audio Average Loudness = " + MyAvatar.audioAverageLoudness);
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
||||||
|
var CHANCE_OF_PLAYING_SOUND = 0.01;
|
||||||
|
|
||||||
var FACTOR = 0.75;
|
var FACTOR = 0.75;
|
||||||
|
|
||||||
function addParticle() {
|
function addParticle() {
|
||||||
|
@ -20,11 +22,13 @@ function addParticle() {
|
||||||
// move particle three units in front of the avatar
|
// move particle three units in front of the avatar
|
||||||
var particlePosition = Vec3.sum(MyAvatar.position, Vec3.multiply (avatarFront, 3));
|
var particlePosition = Vec3.sum(MyAvatar.position, Vec3.multiply (avatarFront, 3));
|
||||||
|
|
||||||
|
if (Math.random() < CHANCE_OF_PLAYING_SOUND) {
|
||||||
// play a sound at the location of the particle
|
// play a sound at the location of the particle
|
||||||
var options = new AudioInjectionOptions();
|
var options = new AudioInjectionOptions();
|
||||||
options.position = particlePosition;
|
options.position = particlePosition;
|
||||||
options.volume = 0.25;
|
options.volume = 0.25;
|
||||||
Audio.playSound(sound, options);
|
Audio.playSound(sound, options);
|
||||||
|
}
|
||||||
|
|
||||||
var audioAverageLoudness = MyAvatar.audioAverageLoudness * FACTOR;
|
var audioAverageLoudness = MyAvatar.audioAverageLoudness * FACTOR;
|
||||||
//print ("Audio Loudness = " + MyAvatar.audioLoudness + " -- Audio Average Loudness = " + MyAvatar.audioAverageLoudness);
|
//print ("Audio Loudness = " + MyAvatar.audioLoudness + " -- Audio Average Loudness = " + MyAvatar.audioAverageLoudness);
|
||||||
|
|
Loading…
Reference in a new issue