From ab80e3dc84ca5075b2927518c2b8899668ff5ddc Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 27 May 2014 10:32:55 -0700 Subject: [PATCH] improved playSound.js to work if no spatial controller attached --- examples/playSound.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/playSound.js b/examples/playSound.js index 317581ba36..189c24e86f 100644 --- a/examples/playSound.js +++ b/examples/playSound.js @@ -3,22 +3,22 @@ // examples // // Copyright 2014 High Fidelity, Inc. -// This sample script loads a sound file and plays it at the 'fingertip' of the +// Plays a sample audio file at the avatar's current location // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// First, load the clap sound from a URL -var clap = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw"); +// First, load a sample sound from a URL +var bird = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw"); function maybePlaySound(deltaTime) { if (Math.random() < 0.01) { // Set the location and other info for the sound to play var options = new AudioInjectionOptions(); - var palmPosition = Controller.getSpatialControlPosition(0); - options.position = palmPosition; + var position = MyAvatar.position; + options.position = position; options.volume = 0.5; - Audio.playSound(clap, options); + Audio.playSound(bird, options); } }