[page:Object3D] → [page:Audio] →

[name]

지정 오디오 오브젝트를 생성합니다.

[link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API]를 사용합니다.

코드 예제

// create an AudioListener and add it to the camera const listener = new THREE.AudioListener(); camera.add( listener ); // create the PositionalAudio object (passing in the listener) const sound = new THREE.PositionalAudio( listener ); // load a sound and set it as the PositionalAudio object's buffer const audioLoader = new THREE.AudioLoader(); audioLoader.load( 'sounds/song.ogg', function( buffer ) { sound.setBuffer( buffer ); sound.setRefDistance( 20 ); sound.play(); }); // create an object for the sound to play from const sphere = new THREE.SphereGeometry( 20, 32, 16 ); const material = new THREE.MeshPhongMaterial( { color: 0xff2200 } ); const mesh = new THREE.Mesh( sphere, material ); scene.add( mesh ); // finally add the sound to the mesh mesh.add( sound );

예제

[example:webaudio_orientation webaudio / orientation ]
[example:webaudio_sandbox webaudio / sandbox ]
[example:webaudio_timing webaudio / timing ]

생성자

[name]( [param:AudioListener listener] )

리스너 — (필수) [page:AudioListener AudioListener] 인스턴스.

프로퍼티

상속받은 프로퍼티는 [page:Audio Audio] 클래스를 참고하세요.

[property:PannerNode panner]

PositionalAudio의 [link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode PannerNode].

메서드

상속받은 메서드는 [page:Audio Audio] 클래스를 참고하세요.

[method:PannerNode getOutput]()

[page:PositionalAudio.panner panner]를 리턴합니다.

[method:Float getRefDistance]()

[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/refDistance panner.refDistance]의 값을 리턴합니다.

[method:this setRefDistance]( [param:Float value] )

[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/refDistance panner.refDistance]의 값을 설정합니다.

[method:Float getRolloffFactor]()

[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/rolloffFactor panner.rolloffFactor]의 값을 리턴합니다.

[method:this setRolloffFactor]( [param:Float value] )

[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/rolloffFactor panner.rolloffFactor]의 값을 설정합니다.

[method:String getDistanceModel]()

[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/distanceModel panner.distanceModel]의 값을 리턴합니다.

[method:this setDistanceModel]( [param:String value] )

[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/distanceModel panner.distanceModel]의 값을 설정합니다.

[method:Float getMaxDistance]()

[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/maxDistance panner.maxDistance]의 값을 리턴합니다.

[method:this setMaxDistance]( [param:Float value] )

[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/maxDistance panner.maxDistance]의 값을 리턴합니다.

[method:this setDirectionalCone]( [param:Float coneInnerAngle], [param:Float coneOuterAngle], [param:Float coneOuterGain] )

이 메서드는 전방향 사운드를 [link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode directional sound]로 변환하기 위해 사용할 수 있습니다.

소스 코드

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]