mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 10:49:33 +02:00
Merge pull request #7548 from ericrius1/roomAudio
Add examples for entity scripts that set up audio reverb zones
This commit is contained in:
commit
89a7b5f731
2 changed files with 156 additions and 0 deletions
78
examples/example/audio/largeHall.js
Normal file
78
examples/example/audio/largeHall.js
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
//
|
||||||
|
// 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;
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
|
||||||
|
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() {
|
||||||
|
AudioDevice.setReverb(false);
|
||||||
|
print("Reverb is OFF.");
|
||||||
|
}
|
||||||
|
_this.enterEntity = function(entityID) {
|
||||||
|
print('EBL I am insiude');
|
||||||
|
|
||||||
|
AudioDevice.setReverbOptions(audioOptions);
|
||||||
|
AudioDevice.setReverb(true);
|
||||||
|
print("Reverb is ON.");
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.leaveEntity = function(entityID) {
|
||||||
|
print('EBL I am outsidee');
|
||||||
|
AudioDevice.setReverb(false);
|
||||||
|
print("Reverb is OFF.");
|
||||||
|
// Messages.sendMessage('PlayBackOnAssignment', 'BowShootingGameWelcome');
|
||||||
|
};
|
||||||
|
});
|
78
examples/example/audio/smallRoom.js
Normal file
78
examples/example/audio/smallRoom.js
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
//
|
||||||
|
// 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;
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
|
||||||
|
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() {
|
||||||
|
AudioDevice.setReverb(false);
|
||||||
|
print("Reverb is OFF.");
|
||||||
|
}
|
||||||
|
_this.enterEntity = function(entityID) {
|
||||||
|
print('EBL I am insiude');
|
||||||
|
// create a slider for each parameter
|
||||||
|
AudioDevice.setReverbOptions(audioOptions);
|
||||||
|
AudioDevice.setReverb(true);
|
||||||
|
print("Reverb is ON.");
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.leaveEntity = function(entityID) {
|
||||||
|
print('EBL I am outside');
|
||||||
|
AudioDevice.setReverb(false);
|
||||||
|
print("Reverb is OFF.");
|
||||||
|
};
|
||||||
|
});
|
Loading…
Reference in a new issue