From e3fe20c818151163bcb3b9559eed32604cf67d85 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 3 Feb 2016 13:50:10 -0800 Subject: [PATCH] query octree right away --- .../ACAudioSearchAndInject.js | 1 + .../ACAudioSearchAndInject2.js | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 examples/audioExamples/acAudioSearching/ACAudioSearchAndInject2.js diff --git a/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject.js b/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject.js index 0b3aab0b84..bafaead7db 100644 --- a/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject.js +++ b/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject.js @@ -39,6 +39,7 @@ var DEFAULT_SOUND_DATA = { intervalSpread: 0 // amount of randomness to add to the interval }; var MIN_INTERVAL = 0.2; +EntityViewer.queryOctree(); function messageReceived(channel, message, sender) { print("EBL MESSAGE RECIEVED"); diff --git a/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject2.js b/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject2.js new file mode 100644 index 0000000000..ada682e2a1 --- /dev/null +++ b/examples/audioExamples/acAudioSearching/ACAudioSearchAndInject2.js @@ -0,0 +1,48 @@ +// +// ACAudioSearchAndInject.js +// audio +// +// Created by Eric Levin 2/1/2016 +// Copyright 2016 High Fidelity, Inc. + +// This AC script constantly searches for entities with a special userData field that specifies audio settings, and then +// injects the sound with the specified URL with other specified settings (playback volume) or playback at interval, or random interval +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +Script.include("https://rawgit.com/highfidelity/hifi/master/examples/libraries/utils.js"); + +var SOUND_DATA_KEY = "soundKey"; +var MESSAGE_CHANNEL = "Hifi-Sound-Entity"; + +// Map of all sound entities in domain- key is entity id, value is sound data +var soundEntityMap = {}; +// Map of sound urls so a sound that's already been downloaded from one entity is not re-downloaded if +// another entity with same sound url is discovered +var soundUrls = {}; + +Agent.isAvatar = true; + +EntityViewer.setPosition({ + x: 0, + y: 0, + z: 0 +}); + +EntityViewer.setKeyholeRadius(60000); +Entities.setPacketsPerSecond(6000); +EntityViewer.queryOctree(); + +var DEFAULT_SOUND_DATA = { + volume: 0.5, + loop: false, + interval: -1, // An interval of -1 means this sound only plays once (if it's non-looping) (In seconds) + intervalSpread: 0 // amount of randomness to add to the interval +}; +var MIN_INTERVAL = 0.2; + +var avatars = AvatarList.getAvatarIdentifiers(); +print("EBL AVATARS " + JSON.stringify(avatars)); +