blob: 37bdee08e8f3f3754561d1f12123111e3e5250c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
Scenery.sound = {}
Scenery.sound.max_distance = 1500
Scenery.sound.init = function(){
app.tube.on("move", Scenery.sound.move)
}
Scenery.sound.move = function(){
var vals = Scenery.map(function(scenery){
if ((scenery.type == "video" || scenery.type == "audio") && ! scenery.muted()) {
var distance = dist(cam.x, cam.z,
scenery.mx.x, scenery.mx.z)
var volume = 1 - (clamp( distance, 0, Scenery.sound.max_distance ) / Scenery.sound.max_distance)
scenery.setVolume(volume)
}
})
}
|