From d40e510752a426577e8df0a1a62d122868d52fcc Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Fri, 25 Mar 2016 12:59:28 -0700 Subject: [PATCH 1/9] no vrvj --- .../VR-VJ/VRVJSoundCartridgeEntityScript.js | 35 ----------- .../VR-VJ/VRVJVisualCartridgeEntityScript.js | 58 ------------------- examples/VR-VJ/cartridgesSpawner.js | 49 ---------------- 3 files changed, 142 deletions(-) delete mode 100644 examples/VR-VJ/VRVJSoundCartridgeEntityScript.js delete mode 100644 examples/VR-VJ/VRVJVisualCartridgeEntityScript.js delete mode 100644 examples/VR-VJ/cartridgesSpawner.js diff --git a/examples/VR-VJ/VRVJSoundCartridgeEntityScript.js b/examples/VR-VJ/VRVJSoundCartridgeEntityScript.js deleted file mode 100644 index c8e106c468..0000000000 --- a/examples/VR-VJ/VRVJSoundCartridgeEntityScript.js +++ /dev/null @@ -1,35 +0,0 @@ - -(function() { - var _this; - Script.include("../libraries/utils.js"); - VRVJSoundEntity = function() { - _this = this; - - }; - - VRVJSoundEntity.prototype = { - playSound: function() { - // _this.soundInjector = Audio.playSound(_this.clip, {position: _this.position, volume: 1.0}); - }, - - preload: function(entityID) { - _this.entityID = entityID; - _this.position = Entities.getEntityProperties(_this.entityID, "position").position; - _this.userData = getEntityUserData(_this.entityID); - _this.clip = SoundCache.getSound(_this.userData.soundURL); - - }, - - unload: function() { - if (_this.soundInjector) { - _this.soundInjector.stop(); - delete _this.soundInjector; - } - } - - - }; - - // entity scripts always need to return a newly constructed object of our type - return new VRVJSoundEntity(); -}); \ No newline at end of file diff --git a/examples/VR-VJ/VRVJVisualCartridgeEntityScript.js b/examples/VR-VJ/VRVJVisualCartridgeEntityScript.js deleted file mode 100644 index a37b830a58..0000000000 --- a/examples/VR-VJ/VRVJVisualCartridgeEntityScript.js +++ /dev/null @@ -1,58 +0,0 @@ -(function() { - var _this; - Script.include("../libraries/utils.js"); - var NULL_UUID = "{00000000-0000-0000-0000-000000000000}"; - var ZERO_VEC = {x: 0, y: 0, z: 0}; - VRVJVisualEntity = function() { - _this = this; - _this.SOUND_LOOP_NAME = "VRVJ-Sound-Cartridge"; - _this.SOUND_CARTRIDGE_SEARCH_RANGE = 0.1; - - }; - - VRVJVisualEntity.prototype = { - - releaseGrab: function() { - print("RELEASE GRAB") - // search for nearby sound loop entities and if found, add it as a parent - Script.setTimeout(function() { - _this.searchForNearbySoundLoops(); - }, 100); - }, - - searchForNearbySoundLoops: function() { - _this.position = Entities.getEntityProperties(_this.entityID, "position").position; - var entities = Entities.findEntities(_this.position, _this.SOUND_CARTRIDGE_SEARCH_RANGE); - for (var i = 0; i < entities.length; i++) { - var entity = entities[i]; - var props = Entities.getEntityProperties(entity, ["name", "color"]); - if (props.name.indexOf(_this.SOUND_LOOP_NAME) !== -1) { - // Need to set a timeout to wait for grab script to stop messing with entity - Entities.editEntity(_this.entityID, { - parentID: entity, - dynamic: false - }); - Script.setTimeout(function() { - Entities.editEntity(_this.entityID, {dynamic: true, velocity: ZERO_VEC, color: props.color}); - }, 100); - return; - } - - } - Entities.editEntity(_this.entityID, { - parentID: NULL_UUID, - color: _this.originalColor - }); - }, - - preload: function(entityID) { - print("YAAAA") - _this.entityID = entityID; - _this.originalColor = Entities.getEntityProperties(_this.entityID, "color").color; - - }, - }; - - // entity scripts always need to return a newly constructed object of our type - return new VRVJVisualEntity(); -}); \ No newline at end of file diff --git a/examples/VR-VJ/cartridgesSpawner.js b/examples/VR-VJ/cartridgesSpawner.js deleted file mode 100644 index 3ce8fd953a..0000000000 --- a/examples/VR-VJ/cartridgesSpawner.js +++ /dev/null @@ -1,49 +0,0 @@ - var orientation = MyAvatar.orientation; - orientation = Quat.safeEulerAngles(orientation); - orientation.x = 0; - orientation = Quat.fromVec3Degrees(orientation); - var center = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(2, Quat.getFront(orientation))); - - -Script.include("../libraries/utils.js"); - -var SOUND_SCRIPT_URL = Script.resolvePath("VRVJSoundCartridgeEntityScript.js"); -var SOUND_CARTRIDGE_NAME = "VRVJ-Sound-Cartridge"; -var soundEntity = Entities.addEntity({ - type: "Box", - name: SOUND_CARTRIDGE_NAME, - dimensions: {x: 0.1, y: 0.1, z: 0.1}, - color: {red: 200, green: 10, blue: 200}, - position: center, - damping: 1, - angularDamping: 1, - dynamic: true, - script: SOUND_SCRIPT_URL, - userData: JSON.stringify({ - soundURL: "https://s3-us-west-1.amazonaws.com/hifi-content/eric/Sounds/VRVJ/Synth-MarchToWar.wav", - }) -}); - -var VISUAL_SCRIPT_URL = Script.resolvePath("VRVJVisualCartridgeEntityScript.js?v1" + Math.random()); -var visualEntity = Entities.addEntity({ - type: "Sphere", - name: "VRVJ-Visual-Cartridge", - dimensions: {x: 0.1, y: 0.1, z: 0.1}, - damping: 1, - angularDamping: 1, - color: {red: 0, green: 200, blue: 10}, - dynamic: true, - position: Vec3.subtract(center, {x: 0, y: 0.2, z: 0}), - script: VISUAL_SCRIPT_URL -}); -Script.setTimeout(function() { - // Wait for sounds to load - Entities.callEntityMethod(soundEntity, "playSound"); -}, 1000) - -function cleanup() { - Entities.deleteEntity(soundEntity); - Entities.deleteEntity(visualEntity); -} - -Script.scriptEnding.connect(cleanup); \ No newline at end of file From 5bbca785b345e365a9781c6b433cd3f95cf6f689 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Fri, 1 Apr 2016 17:43:10 -0700 Subject: [PATCH 2/9] added new audio room examples --- examples/example/audio/largeHall.js | 120 ++++++++++++++++++++++++++++ examples/example/audio/smallRoom.js | 120 ++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+) create mode 100644 examples/example/audio/largeHall.js create mode 100644 examples/example/audio/smallRoom.js diff --git a/examples/example/audio/largeHall.js b/examples/example/audio/largeHall.js new file mode 100644 index 0000000000..fd400a6fec --- /dev/null +++ b/examples/example/audio/largeHall.js @@ -0,0 +1,120 @@ +(function() { + var _this = this; +​ + Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); +print("EBL PRELOADING NEW VERSION ") + var audioOptions = new AudioEffectOptions({ + bandwidth: 7000, + preDelay: 80, + lateDelay: 0, + reverbTime: 3, + earlyDiffusion: 100, + lateDiffusion: 100, + roomSize: 50, + density: 100, + bassMult: 1.5, + bassFreq: 250, + highGain: -12, + highFreq: 3000, + modRate: 2.3, + modDepth: 50, + earlyGain: -12, + lateGain: -12, + earlyMixLeft: 20, + earlyMixRight: 20, + lateMixLeft: 90, + lateMixRight: 90, + wetDryMix: 90, +}); +​ +​ +​ + var panel = new Panel(10, 160); +​ +var parameters = [ +// { name: "bandwidth", min: 1000, max: 12000, units: " Hz" }, +// { name: "preDelay", min: 0, max: 333, units: " ms" }, +// { name: "lateDelay", min: 0, max: 166, units: " ms" }, +// { name: "reverbTime", min: 0.1, max: 10, units: " seconds" }, +// { name: "earlyDiffusion", min: 0, max: 100, units: " percent" }, +// { name: "lateDiffusion", min: 0, max: 100, units: " percent" }, +// { name: "roomSize", min: 0, max: 100, units: " percent" }, +// { name: "density", min: 0, max: 100, units: " percent" }, +// { name: "bassMult", min: 0.1, max: 4, units: " ratio" }, +// { name: "bassFreq", min: 10, max: 500, units: " Hz" }, +// { name: "highGain", min: -24, max: 0, units: " dB" }, +// { name: "highFreq", min: 1000, max: 12000, units: " Hz" }, +// { name: "modRate", min: 0.1, max: 10, units: " Hz" }, +// { name: "modDepth", min: 0, max: 100, units: " percent" }, +// { name: "earlyGain", min: -96, max: 24, units: " dB" }, +// { name: "lateGain", min: -96, max: 24, units: " dB" }, +// { name: "earlyMixLeft", min: 0, max: 100, units: " percent" }, +// { name: "earlyMixRight", min: 0, max: 100, units: " percent" }, +// { name: "lateMixLeft", min: 0, max: 100, units: " percent" }, +// { name: "lateMixRight", min: 0, max: 100, units: " percent" }, +// { name: "wetDryMix", min: 0, max: 100, units: " percent" }, +] +​ +​ + function setter(name) { + return function(value) { + audioOptions[name] = value; + AudioDevice.setReverbOptions(audioOptions); + } + } +​ + function getter(name) { + return function() { + return audioOptions[name]; + } + } +​ + function displayer(units) { + return function(value) { + return (value).toFixed(1) + units; + } + } +​ + + function scriptEnding() { + panel.destroy(); + AudioDevice.setReverb(false); + print("Reverb is OFF."); + } +​ + _this.enterEntity = function(entityID) { + print('EBL I am insiude'); + // create a slider for each parameter + for (var i = 0; i < parameters.length; i++) { + var p = parameters[i]; + panel.newSlider(p.name, p.min, p.max, setter(p.name), getter(p.name), displayer(p.units)); + } +​ + Controller.mouseMoveEvent.connect(function panelMouseMoveEvent(event) { + return panel.mouseMoveEvent(event); + }); + Controller.mousePressEvent.connect(function panelMousePressEvent(event) { + return panel.mousePressEvent(event); + }); + Controller.mouseReleaseEvent.connect(function(event) { + return panel.mouseReleaseEvent(event); + }); +​ + AudioDevice.setReverbOptions(audioOptions); + AudioDevice.setReverb(true); + print("Reverb is ON."); +​ +​ + // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); + }; + + _this.leaveEntity = function(entityID) { + print('EBL I am outsidee'); + panel.destroy(); + AudioDevice.setReverb(false); + print("Reverb is OFF."); +​ +​ + // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); + }; +}); \ No newline at end of file diff --git a/examples/example/audio/smallRoom.js b/examples/example/audio/smallRoom.js new file mode 100644 index 0000000000..72bf3fb5e6 --- /dev/null +++ b/examples/example/audio/smallRoom.js @@ -0,0 +1,120 @@ +(function() { + var _this = this; +​ + Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); +print("EBL PRELOADING NEW VERSION ") + var audioOptions = new AudioEffectOptions({ + bandwidth: 7000, + preDelay: 20, + lateDelay: 0, + reverbTime: 1.5, + earlyDiffusion: 100, + lateDiffusion: 100, + roomSize: 50, + density: 100, + bassMult: 1.5, + bassFreq: 250, + highGain: -12, + highFreq: 3000, + modRate: 2.3, + modDepth: 50, + earlyGain: -24, + lateGain: -24, + earlyMixLeft: 20, + earlyMixRight: 20, + lateMixLeft: 90, + lateMixRight: 90, + wetDryMix: 70, +}); +​ +​ +​ + var panel = new Panel(10, 160); +​ +var parameters = [ +// { name: "bandwidth", min: 1000, max: 12000, units: " Hz" }, +// { name: "preDelay", min: 0, max: 333, units: " ms" }, +// { name: "lateDelay", min: 0, max: 166, units: " ms" }, +// { name: "reverbTime", min: 0.1, max: 10, units: " seconds" }, +// { name: "earlyDiffusion", min: 0, max: 100, units: " percent" }, +// { name: "lateDiffusion", min: 0, max: 100, units: " percent" }, +// { name: "roomSize", min: 0, max: 100, units: " percent" }, +// { name: "density", min: 0, max: 100, units: " percent" }, +// { name: "bassMult", min: 0.1, max: 4, units: " ratio" }, +// { name: "bassFreq", min: 10, max: 500, units: " Hz" }, +// { name: "highGain", min: -24, max: 0, units: " dB" }, +// { name: "highFreq", min: 1000, max: 12000, units: " Hz" }, +// { name: "modRate", min: 0.1, max: 10, units: " Hz" }, +// { name: "modDepth", min: 0, max: 100, units: " percent" }, +// { name: "earlyGain", min: -96, max: 24, units: " dB" }, +// { name: "lateGain", min: -96, max: 24, units: " dB" }, +// { name: "earlyMixLeft", min: 0, max: 100, units: " percent" }, +// { name: "earlyMixRight", min: 0, max: 100, units: " percent" }, +// { name: "lateMixLeft", min: 0, max: 100, units: " percent" }, +// { name: "lateMixRight", min: 0, max: 100, units: " percent" }, +// { name: "wetDryMix", min: 0, max: 100, units: " percent" }, +] +​ +​ + function setter(name) { + return function(value) { + audioOptions[name] = value; + AudioDevice.setReverbOptions(audioOptions); + } + } +​ + function getter(name) { + return function() { + return audioOptions[name]; + } + } +​ + function displayer(units) { + return function(value) { + return (value).toFixed(1) + units; + } + } +​ + + function scriptEnding() { + panel.destroy(); + AudioDevice.setReverb(false); + print("Reverb is OFF."); + } +​ + _this.enterEntity = function(entityID) { + print('EBL I am insiude'); + // create a slider for each parameter + for (var i = 0; i < parameters.length; i++) { + var p = parameters[i]; + panel.newSlider(p.name, p.min, p.max, setter(p.name), getter(p.name), displayer(p.units)); + } +​ + Controller.mouseMoveEvent.connect(function panelMouseMoveEvent(event) { + return panel.mouseMoveEvent(event); + }); + Controller.mousePressEvent.connect(function panelMousePressEvent(event) { + return panel.mousePressEvent(event); + }); + Controller.mouseReleaseEvent.connect(function(event) { + return panel.mouseReleaseEvent(event); + }); +​ + AudioDevice.setReverbOptions(audioOptions); + AudioDevice.setReverb(true); + print("Reverb is ON."); +​ +​ + // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); + }; + + _this.leaveEntity = function(entityID) { + print('EBL I am outsidee'); + panel.destroy(); + AudioDevice.setReverb(false); + print("Reverb is OFF."); +​ +​ + // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); + }; +}); \ No newline at end of file From f7f7c18d721aa04d838b8b3fdef62769808dd961 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Fri, 1 Apr 2016 17:45:15 -0700 Subject: [PATCH 3/9] added new audio room examples --- examples/example/audio/largeHall.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/example/audio/largeHall.js b/examples/example/audio/largeHall.js index fd400a6fec..8a37aa5f4a 100644 --- a/examples/example/audio/largeHall.js +++ b/examples/example/audio/largeHall.js @@ -1,3 +1,16 @@ +// +// largeHall.js +// examples +// +// Created by Freidrica on 4/1/16. +// Copyright 2016 High Fidelity, Inc. +// +// This entity script invokes reverb upon entering an entity acting as a trigger zone + +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// (function() { var _this = this; ​ From 048d745af90710f3685798cc91a2c35c9cd8e185 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Fri, 1 Apr 2016 17:53:02 -0700 Subject: [PATCH 4/9] update --- examples/example/audio/largeHall.js | 4 ++-- examples/example/audio/smallRoom.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/example/audio/largeHall.js b/examples/example/audio/largeHall.js index 8a37aa5f4a..fc69aeb8b8 100644 --- a/examples/example/audio/largeHall.js +++ b/examples/example/audio/largeHall.js @@ -15,7 +15,7 @@ var _this = this; ​ Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); -print("EBL PRELOADING NEW VERSION ") + print("EBL PRELOADING NEW VERSION ") var audioOptions = new AudioEffectOptions({ bandwidth: 7000, preDelay: 80, @@ -123,7 +123,7 @@ var parameters = [ _this.leaveEntity = function(entityID) { print('EBL I am outsidee'); - panel.destroy(); + panel.destroy(); AudioDevice.setReverb(false); print("Reverb is OFF."); ​ diff --git a/examples/example/audio/smallRoom.js b/examples/example/audio/smallRoom.js index 72bf3fb5e6..3deffa6c6c 100644 --- a/examples/example/audio/smallRoom.js +++ b/examples/example/audio/smallRoom.js @@ -1,3 +1,17 @@ +// +// smallRoom.js +// examples +// +// Created by Freidrica on 4/1/16. +// Copyright 2016 High Fidelity, Inc. +// +// This entity script invokes reverb upon entering an entity acting as a trigger zone + +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + (function() { var _this = this; ​ From 9cac249122bd0d0889c6b9122a51b7b33cdb33b2 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 6 Apr 2016 10:36:38 -0700 Subject: [PATCH 5/9] f1 --- examples/example/audio/largeHall.js | 24 ----- examples/example/audio/smallRoom.js | 152 +++++++--------------------- 2 files changed, 35 insertions(+), 141 deletions(-) diff --git a/examples/example/audio/largeHall.js b/examples/example/audio/largeHall.js index fc69aeb8b8..02f0592388 100644 --- a/examples/example/audio/largeHall.js +++ b/examples/example/audio/largeHall.js @@ -44,30 +44,6 @@ ​ var panel = new Panel(10, 160); ​ -var parameters = [ -// { name: "bandwidth", min: 1000, max: 12000, units: " Hz" }, -// { name: "preDelay", min: 0, max: 333, units: " ms" }, -// { name: "lateDelay", min: 0, max: 166, units: " ms" }, -// { name: "reverbTime", min: 0.1, max: 10, units: " seconds" }, -// { name: "earlyDiffusion", min: 0, max: 100, units: " percent" }, -// { name: "lateDiffusion", min: 0, max: 100, units: " percent" }, -// { name: "roomSize", min: 0, max: 100, units: " percent" }, -// { name: "density", min: 0, max: 100, units: " percent" }, -// { name: "bassMult", min: 0.1, max: 4, units: " ratio" }, -// { name: "bassFreq", min: 10, max: 500, units: " Hz" }, -// { name: "highGain", min: -24, max: 0, units: " dB" }, -// { name: "highFreq", min: 1000, max: 12000, units: " Hz" }, -// { name: "modRate", min: 0.1, max: 10, units: " Hz" }, -// { name: "modDepth", min: 0, max: 100, units: " percent" }, -// { name: "earlyGain", min: -96, max: 24, units: " dB" }, -// { name: "lateGain", min: -96, max: 24, units: " dB" }, -// { name: "earlyMixLeft", min: 0, max: 100, units: " percent" }, -// { name: "earlyMixRight", min: 0, max: 100, units: " percent" }, -// { name: "lateMixLeft", min: 0, max: 100, units: " percent" }, -// { name: "lateMixRight", min: 0, max: 100, units: " percent" }, -// { name: "wetDryMix", min: 0, max: 100, units: " percent" }, -] -​ ​ function setter(name) { return function(value) { diff --git a/examples/example/audio/smallRoom.js b/examples/example/audio/smallRoom.js index 3deffa6c6c..4e728278a0 100644 --- a/examples/example/audio/smallRoom.js +++ b/examples/example/audio/smallRoom.js @@ -13,122 +13,40 @@ // (function() { - var _this = this; -​ - Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); -print("EBL PRELOADING NEW VERSION ") - var audioOptions = new AudioEffectOptions({ - bandwidth: 7000, - preDelay: 20, - lateDelay: 0, - reverbTime: 1.5, - earlyDiffusion: 100, - lateDiffusion: 100, - roomSize: 50, - density: 100, - bassMult: 1.5, - bassFreq: 250, - highGain: -12, - highFreq: 3000, - modRate: 2.3, - modDepth: 50, - earlyGain: -24, - lateGain: -24, - earlyMixLeft: 20, - earlyMixRight: 20, - lateMixLeft: 90, - lateMixRight: 90, - wetDryMix: 70, -}); -​ -​ -​ - var panel = new Panel(10, 160); -​ -var parameters = [ -// { name: "bandwidth", min: 1000, max: 12000, units: " Hz" }, -// { name: "preDelay", min: 0, max: 333, units: " ms" }, -// { name: "lateDelay", min: 0, max: 166, units: " ms" }, -// { name: "reverbTime", min: 0.1, max: 10, units: " seconds" }, -// { name: "earlyDiffusion", min: 0, max: 100, units: " percent" }, -// { name: "lateDiffusion", min: 0, max: 100, units: " percent" }, -// { name: "roomSize", min: 0, max: 100, units: " percent" }, -// { name: "density", min: 0, max: 100, units: " percent" }, -// { name: "bassMult", min: 0.1, max: 4, units: " ratio" }, -// { name: "bassFreq", min: 10, max: 500, units: " Hz" }, -// { name: "highGain", min: -24, max: 0, units: " dB" }, -// { name: "highFreq", min: 1000, max: 12000, units: " Hz" }, -// { name: "modRate", min: 0.1, max: 10, units: " Hz" }, -// { name: "modDepth", min: 0, max: 100, units: " percent" }, -// { name: "earlyGain", min: -96, max: 24, units: " dB" }, -// { name: "lateGain", min: -96, max: 24, units: " dB" }, -// { name: "earlyMixLeft", min: 0, max: 100, units: " percent" }, -// { name: "earlyMixRight", min: 0, max: 100, units: " percent" }, -// { name: "lateMixLeft", min: 0, max: 100, units: " percent" }, -// { name: "lateMixRight", min: 0, max: 100, units: " percent" }, -// { name: "wetDryMix", min: 0, max: 100, units: " percent" }, -] -​ -​ - function setter(name) { - return function(value) { - audioOptions[name] = value; - AudioDevice.setReverbOptions(audioOptions); + var _this = this; + Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); + var audioOptions = new AudioEffectOptions({ + bandwidth: 7000, + preDelay: 20, + lateDelay: 0, + reverbTime: 1.5, + earlyDiffusion: 100, + lateDiffusion: 100, + roomSize: 50, + density: 100, + bassMult: 1.5, + bassFreq: 250, + highGain: -12, + highFreq: 3000, + modRate: 2.3, + modDepth: 50, + earlyGain: -24, + lateGain: -24, + earlyMixLeft: 20, + earlyMixRight: 20, + lateMixLeft: 90, + lateMixRight: 90, + wetDryMix: 70 + }); + + var panel = new Panel(10, 160); + + function setter(name) { + return function(value) { + audioOptions[name] = value; + AudioDevice.setReverbOptions(audioOptions); + } } - } -​ - function getter(name) { - return function() { - return audioOptions[name]; - } - } -​ - function displayer(units) { - return function(value) { - return (value).toFixed(1) + units; - } - } -​ - - function scriptEnding() { - panel.destroy(); - AudioDevice.setReverb(false); - print("Reverb is OFF."); - } -​ - _this.enterEntity = function(entityID) { - print('EBL I am insiude'); - // create a slider for each parameter - for (var i = 0; i < parameters.length; i++) { - var p = parameters[i]; - panel.newSlider(p.name, p.min, p.max, setter(p.name), getter(p.name), displayer(p.units)); - } -​ - Controller.mouseMoveEvent.connect(function panelMouseMoveEvent(event) { - return panel.mouseMoveEvent(event); - }); - Controller.mousePressEvent.connect(function panelMousePressEvent(event) { - return panel.mousePressEvent(event); - }); - Controller.mouseReleaseEvent.connect(function(event) { - return panel.mouseReleaseEvent(event); - }); -​ - AudioDevice.setReverbOptions(audioOptions); - AudioDevice.setReverb(true); - print("Reverb is ON."); -​ -​ - // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); - }; - - _this.leaveEntity = function(entityID) { - print('EBL I am outsidee'); - panel.destroy(); - AudioDevice.setReverb(false); - print("Reverb is OFF."); -​ -​ - // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); - }; + + }); \ No newline at end of file From ce290a19930c3bda02fc663d7cd6719811d605e2 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 6 Apr 2016 10:38:59 -0700 Subject: [PATCH 6/9] got rid of illegal character --- examples/example/audio/smallRoom.js | 59 +++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/examples/example/audio/smallRoom.js b/examples/example/audio/smallRoom.js index 4e728278a0..b63adc8bb9 100644 --- a/examples/example/audio/smallRoom.js +++ b/examples/example/audio/smallRoom.js @@ -15,6 +15,7 @@ (function() { var _this = this; Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); + print("EBL PRELOADING NEW VERSION ") var audioOptions = new AudioEffectOptions({ bandwidth: 7000, preDelay: 20, @@ -36,17 +37,61 @@ earlyMixRight: 20, lateMixLeft: 90, lateMixRight: 90, - wetDryMix: 70 + wetDryMix: 70, }); - var panel = new Panel(10, 160); - function setter(name) { - return function(value) { - audioOptions[name] = value; - AudioDevice.setReverbOptions(audioOptions); + function setter(name) { + return function(value) { + audioOptions[name] = value; + AudioDevice.setReverbOptions(audioOptions); + } } - } + function getter(name) { + return function() { + return audioOptions[name]; + } + } + function displayer(units) { + return function(value) { + return (value).toFixed(1) + units; + } + } + + function scriptEnding() { + panel.destroy(); + AudioDevice.setReverb(false); + print("Reverb is OFF."); + } + _this.enterEntity = function(entityID) { + print('EBL I am insiude'); + // create a slider for each parameter + for (var i = 0; i < parameters.length; i++) { + var p = parameters[i]; + panel.newSlider(p.name, p.min, p.max, setter(p.name), getter(p.name), displayer(p.units)); + } + Controller.mouseMoveEvent.connect(function panelMouseMoveEvent(event) { + return panel.mouseMoveEvent(event); + }); + Controller.mousePressEvent.connect(function panelMousePressEvent(event) { + return panel.mousePressEvent(event); + }); + Controller.mouseReleaseEvent.connect(function(event) { + return panel.mouseReleaseEvent(event); + }); + AudioDevice.setReverbOptions(audioOptions); + AudioDevice.setReverb(true); + print("Reverb is ON."); + // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); + }; + + _this.leaveEntity = function(entityID) { + print('EBL I am outsidee'); + panel.destroy(); + AudioDevice.setReverb(false); + print("Reverb is OFF."); + // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); + }; }); \ No newline at end of file From 21f6d7bee350542308b73f006251961660d855fc Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 6 Apr 2016 10:50:58 -0700 Subject: [PATCH 7/9] fixed largeroom illegal characters --- examples/example/audio/largeHall.js | 169 +++++++++++++--------------- 1 file changed, 78 insertions(+), 91 deletions(-) diff --git a/examples/example/audio/largeHall.js b/examples/example/audio/largeHall.js index 02f0592388..73abc6da6d 100644 --- a/examples/example/audio/largeHall.js +++ b/examples/example/audio/largeHall.js @@ -12,98 +12,85 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // (function() { - var _this = this; -​ - Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); - print("EBL PRELOADING NEW VERSION ") - var audioOptions = new AudioEffectOptions({ - bandwidth: 7000, - preDelay: 80, - lateDelay: 0, - reverbTime: 3, - earlyDiffusion: 100, - lateDiffusion: 100, - roomSize: 50, - density: 100, - bassMult: 1.5, - bassFreq: 250, - highGain: -12, - highFreq: 3000, - modRate: 2.3, - modDepth: 50, - earlyGain: -12, - lateGain: -12, - earlyMixLeft: 20, - earlyMixRight: 20, - lateMixLeft: 90, - lateMixRight: 90, - wetDryMix: 90, -}); -​ -​ -​ - var panel = new Panel(10, 160); -​ -​ - function setter(name) { - return function(value) { - audioOptions[name] = value; - AudioDevice.setReverbOptions(audioOptions); + var _this = this; + Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); + print("EBL PRELOADING NEW VERSION ") + var audioOptions = new AudioEffectOptions({ + bandwidth: 7000, + preDelay: 80, + lateDelay: 0, + reverbTime: 3, + earlyDiffusion: 100, + lateDiffusion: 100, + roomSize: 50, + density: 100, + bassMult: 1.5, + bassFreq: 250, + highGain: -12, + highFreq: 3000, + modRate: 2.3, + modDepth: 50, + earlyGain: -12, + lateGain: -12, + earlyMixLeft: 20, + earlyMixRight: 20, + lateMixLeft: 90, + lateMixRight: 90, + wetDryMix: 90, + }); + var panel = new Panel(10, 160); + + function setter(name) { + return function(value) { + audioOptions[name] = value; + AudioDevice.setReverbOptions(audioOptions); + } } - } -​ - function getter(name) { - return function() { - return audioOptions[name]; + + function getter(name) { + return function() { + return audioOptions[name]; + } } - } -​ - function displayer(units) { - return function(value) { - return (value).toFixed(1) + units; + + function displayer(units) { + return function(value) { + return (value).toFixed(1) + units; + } } - } -​ - - function scriptEnding() { - panel.destroy(); - AudioDevice.setReverb(false); - print("Reverb is OFF."); - } -​ - _this.enterEntity = function(entityID) { - print('EBL I am insiude'); - // create a slider for each parameter - for (var i = 0; i < parameters.length; i++) { - var p = parameters[i]; - panel.newSlider(p.name, p.min, p.max, setter(p.name), getter(p.name), displayer(p.units)); - } -​ - Controller.mouseMoveEvent.connect(function panelMouseMoveEvent(event) { - return panel.mouseMoveEvent(event); - }); - Controller.mousePressEvent.connect(function panelMousePressEvent(event) { - return panel.mousePressEvent(event); - }); - Controller.mouseReleaseEvent.connect(function(event) { - return panel.mouseReleaseEvent(event); - }); -​ - AudioDevice.setReverbOptions(audioOptions); - AudioDevice.setReverb(true); - print("Reverb is ON."); -​ -​ - // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); - }; - - _this.leaveEntity = function(entityID) { - print('EBL I am outsidee'); - panel.destroy(); - AudioDevice.setReverb(false); - print("Reverb is OFF."); -​ -​ - // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); - }; + + function scriptEnding() { + panel.destroy(); + AudioDevice.setReverb(false); + print("Reverb is OFF."); + } + _this.enterEntity = function(entityID) { + print('EBL I am insiude'); + // create a slider for each parameter + for (var i = 0; i < parameters.length; i++) { + var p = parameters[i]; + panel.newSlider(p.name, p.min, p.max, setter(p.name), getter(p.name), displayer(p.units)); + } + Controller.mouseMoveEvent.connect(function panelMouseMoveEvent(event) { + return panel.mouseMoveEvent(event); + }); + Controller.mousePressEvent.connect(function panelMousePressEvent(event) { + return panel.mousePressEvent(event); + }); + Controller.mouseReleaseEvent.connect(function(event) { + return panel.mouseReleaseEvent(event); + }); + AudioDevice.setReverbOptions(audioOptions); + AudioDevice.setReverb(true); + print("Reverb is ON."); + // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); + }; + + _this.leaveEntity = function(entityID) { + print('EBL I am outsidee'); + panel.destroy(); + AudioDevice.setReverb(false); + print("Reverb is OFF."); + // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); + }; }); \ No newline at end of file From 2be2f940eabceeb5d3e0eb9ef5353a864786e90e Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 6 Apr 2016 10:59:18 -0700 Subject: [PATCH 8/9] remove panel --- examples/example/audio/largeHall.js | 19 +------------------ examples/example/audio/smallRoom.js | 19 ------------------- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/examples/example/audio/largeHall.js b/examples/example/audio/largeHall.js index 73abc6da6d..a1a2db84b7 100644 --- a/examples/example/audio/largeHall.js +++ b/examples/example/audio/largeHall.js @@ -13,7 +13,6 @@ // (function() { var _this = this; - Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); print("EBL PRELOADING NEW VERSION ") var audioOptions = new AudioEffectOptions({ bandwidth: 7000, @@ -38,7 +37,6 @@ lateMixRight: 90, wetDryMix: 90, }); - var panel = new Panel(10, 160); function setter(name) { return function(value) { @@ -60,30 +58,15 @@ } function scriptEnding() { - panel.destroy(); AudioDevice.setReverb(false); print("Reverb is OFF."); } _this.enterEntity = function(entityID) { print('EBL I am insiude'); - // create a slider for each parameter - for (var i = 0; i < parameters.length; i++) { - var p = parameters[i]; - panel.newSlider(p.name, p.min, p.max, setter(p.name), getter(p.name), displayer(p.units)); - } - Controller.mouseMoveEvent.connect(function panelMouseMoveEvent(event) { - return panel.mouseMoveEvent(event); - }); - Controller.mousePressEvent.connect(function panelMousePressEvent(event) { - return panel.mousePressEvent(event); - }); - Controller.mouseReleaseEvent.connect(function(event) { - return panel.mouseReleaseEvent(event); - }); + AudioDevice.setReverbOptions(audioOptions); AudioDevice.setReverb(true); print("Reverb is ON."); - // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); }; _this.leaveEntity = function(entityID) { diff --git a/examples/example/audio/smallRoom.js b/examples/example/audio/smallRoom.js index b63adc8bb9..59811c4f52 100644 --- a/examples/example/audio/smallRoom.js +++ b/examples/example/audio/smallRoom.js @@ -14,7 +14,6 @@ (function() { var _this = this; - Script.include("http://public.highfidelity.io/scripts/utilities/tools/cookies.js"); print("EBL PRELOADING NEW VERSION ") var audioOptions = new AudioEffectOptions({ bandwidth: 7000, @@ -39,7 +38,6 @@ lateMixRight: 90, wetDryMix: 70, }); - var panel = new Panel(10, 160); function setter(name) { return function(value) { @@ -61,37 +59,20 @@ } function scriptEnding() { - panel.destroy(); AudioDevice.setReverb(false); print("Reverb is OFF."); } _this.enterEntity = function(entityID) { print('EBL I am insiude'); // create a slider for each parameter - for (var i = 0; i < parameters.length; i++) { - var p = parameters[i]; - panel.newSlider(p.name, p.min, p.max, setter(p.name), getter(p.name), displayer(p.units)); - } - Controller.mouseMoveEvent.connect(function panelMouseMoveEvent(event) { - return panel.mouseMoveEvent(event); - }); - Controller.mousePressEvent.connect(function panelMousePressEvent(event) { - return panel.mousePressEvent(event); - }); - Controller.mouseReleaseEvent.connect(function(event) { - return panel.mouseReleaseEvent(event); - }); AudioDevice.setReverbOptions(audioOptions); AudioDevice.setReverb(true); print("Reverb is ON."); - // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); }; _this.leaveEntity = function(entityID) { print('EBL I am outsidee'); - panel.destroy(); AudioDevice.setReverb(false); print("Reverb is OFF."); - // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); }; }); \ No newline at end of file From 0e08b15db7088c04c545cb048aa87eda9673f773 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 6 Apr 2016 11:30:29 -0700 Subject: [PATCH 9/9] spacing fix attempt --- examples/example/audio/largeHall.js | 1 - examples/example/audio/smallRoom.js | 36 ++++++++++++++--------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/examples/example/audio/largeHall.js b/examples/example/audio/largeHall.js index a1a2db84b7..3c710a8eaa 100644 --- a/examples/example/audio/largeHall.js +++ b/examples/example/audio/largeHall.js @@ -71,7 +71,6 @@ _this.leaveEntity = function(entityID) { print('EBL I am outsidee'); - panel.destroy(); AudioDevice.setReverb(false); print("Reverb is OFF."); // Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome'); diff --git a/examples/example/audio/smallRoom.js b/examples/example/audio/smallRoom.js index 59811c4f52..e692c8810d 100644 --- a/examples/example/audio/smallRoom.js +++ b/examples/example/audio/smallRoom.js @@ -39,29 +39,29 @@ wetDryMix: 70, }); - function setter(name) { - return function(value) { - audioOptions[name] = value; - AudioDevice.setReverbOptions(audioOptions); - } + function setter(name) { + return function(value) { + audioOptions[name] = value; + AudioDevice.setReverbOptions(audioOptions); } + } - function getter(name) { - return function() { - return audioOptions[name]; - } + function getter(name) { + return function() { + return audioOptions[name]; } + } - function displayer(units) { - return function(value) { - return (value).toFixed(1) + units; - } + function displayer(units) { + return function(value) { + return (value).toFixed(1) + units; } + } - function scriptEnding() { - AudioDevice.setReverb(false); - print("Reverb is OFF."); - } + function scriptEnding() { + AudioDevice.setReverb(false); + print("Reverb is OFF."); + } _this.enterEntity = function(entityID) { print('EBL I am insiude'); // create a slider for each parameter @@ -71,7 +71,7 @@ }; _this.leaveEntity = function(entityID) { - print('EBL I am outsidee'); + print('EBL I am outside'); AudioDevice.setReverb(false); print("Reverb is OFF."); };