Skip to content

Commit

Permalink
Adds jsDoc for AudioModule #358
Browse files Browse the repository at this point in the history
  • Loading branch information
hirako2000 committed Dec 2, 2017
1 parent c02ab0c commit 848770d
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/modules/extra/AudioModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ import {
AudioLoader
} from 'three';

/**
* @class PositionalAudioModule
* @category modules/extra
* @param {Object} [params={loop: true}] - The parameters object.
* @memberof module:modules/extra
* @example <caption>How to create and apply a PositionalAudioModule</caption>
* const fogModule = const audioModule = new AudioModule({
* loop: true
* });
*
* new Sphere({
* ...,
* modules: [
* audioModule
* ]
* };
*/
export default class PositionalAudioModule {
constructor(params = {}) {
this.params = Object.assign({
Expand All @@ -17,10 +34,22 @@ export default class PositionalAudioModule {
this.positionalAudio.setLoop(this.params.loop);
}

/**
* @method addListener
* @description Adds the listener of this audio source, usually the camera, origin of the user perspective
* @param {Object} object The listener object
* @memberof module:modules/extra.PositionalAudioModule
*/
addListener(object) {
object.native.add(this.audioListener);
};
}

/**
* @method play
* @description Plays the given sound
* @param {String} path The path to the sound file
* @memberof module:modules/extra.PositionalAudioModule
*/
play(path) {
const sound = this.positionalAudio;

Expand All @@ -29,7 +58,7 @@ export default class PositionalAudioModule {
sound.setRefDistance(50);
sound.play();
});
};
}

bridge = {
mesh(mesh, self) {
Expand Down

0 comments on commit 848770d

Please sign in to comment.