How to use the AudioListener function from three

Find comprehensive JavaScript three.AudioListener code examples handpicked from public code repositorys.

12
13
14
15
16
17
18
19
20
import { Scene, Material } from './scene/scene';
import { buildKDTree, traverseKDTree, restNodeCount } from './scene/BVH';
import { WSAENETDOWN } from 'constants';

const THREE = require('three');
var listener = new THREE.AudioListener();

// create a global audio source
var sound = new THREE.Audio( listener );
fork icon3
star icon4
watch icon0

+ 11 other calls in file

199
200
201
202
203
204
205
206
207
208
  logComponent = <Log position={[0, -0.15, -1]} />
}

// music and sound
const SOUND_FX_GAIN = 2
const [cameraAudioListener] = useState(() => new THREE.AudioListener())
const [atmosphereAudioFilter] = useState(() => {
  const audioContext = THREE.AudioContext.getContext()
  let biquadFilter = audioContext.createBiquadFilter()
  biquadFilter.type = 'highpass'
fork icon263
star icon0
watch icon1

84
85
86
87
88
89
90
91
92
93
/******************/
/* Helper Functions */
/******************/
function loadMusic(index)
{  
  listener = new THREE.AudioListener();
  var audLoad = new THREE.Audio(listener);
  visElements.sound = audLoad;

  audioLoader = new THREE.AudioLoader();
fork icon16
star icon0
watch icon2

25
26
27
28
29
30
31
32
33
34
const THREE = __importStar(require("three"));
const core_1 = require("@cuboid3/core");
class AudioManager {
    constructor() {
        this.basePath = '/public/audio/';
        this.listener = new THREE.AudioListener();
        this.audioLoader = new THREE.AudioLoader();
        this.loadedSounds = new Map();
        core_1.EventHandler.subscribe('attachAudioListener', (mesh) => {
            mesh.add(this.listener);
fork icon0
star icon2
watch icon0

40
41
42
43
44
45
46
47
48
49
const tex = assets.get('tex-id');
tex.minFilter = THREE.LinearFilter;

const audioBuffer = assets.get('audio-boing');
// a global audio source
const audioListener = new THREE.AudioListener();
// add the listener to the camera
app.camera.add(audioListener);
const boingSound = new THREE.Audio(audioListener);
boingSound.setBuffer(audioBuffer);
fork icon1
star icon1
watch icon0

128
129
130
131
132
133
134
135
136
  vertexShader: _vertex2["default"],
  fragmentShader: _fragment2["default"]
});
this.fireworks = new Three.Points(this.fireworkGeometry, this.fireworksMaterial); // 创建音频

this.linstener = new Three.AudioListener();
this.linstener1 = new Three.AudioListener();
this.sound = new Three.Audio(this.linstener);
this.sendSound = new Three.Audio(this.linstener1); // 创建音频加载器
fork icon0
star icon0
watch icon0

+ 7 other calls in file

2
3
4
5
6
7
8
9
10
11
12
13
export class Sound {
  constructor(fname, scene, playbackRate = 1.0, volume = 1.0) {
    const camera = this.getCamera(scene)


    // create an AudioListener and add it to the camera
    const listener = new THREE.AudioListener();
    camera.add( listener );


    // create a global audio source
    const sound = new THREE.Audio( listener );
fork icon0
star icon0
watch icon0

13
14
15
16
17
18
19
20
21
22
23
24
G.set('renderer', new THREE.WebGLRenderer({
    antialias: true
}));
G.set('camera', new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 5000));


G.set('listener', new THREE.AudioListener());
G.get('camera').add(G.get('listener'));


G.set('socket', window.io());

fork icon0
star icon0
watch icon0

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)