Skip to content

Commit

Permalink
aframevr#5364 : Sound : Code review changes applied.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathannJacobs committed Oct 19, 2023
1 parent 61a5455 commit 6d48043
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module.exports.Component = registerComponent('sound', {
this.pool = new THREE.Group();
this.loaded = false;
this.mustPlay = false;
this.processSound = undefined; // Saved callback for the mustPlay mechanic

// Don't pass evt because playSound takes a function as parameter.
this.playSoundBound = function () { self.playSound(); };
Expand Down Expand Up @@ -67,7 +66,9 @@ module.exports.Component = registerComponent('sound', {
if(data.loopStart != 0 && data.loopEnd == 0){
sound.setLoopEnd(sound.buffer.duration);
}
else sound.setLoopEnd(data.loopEnd);
else {
sound.setLoopEnd(data.loopEnd);
}

sound.setVolume(data.volume);
sound.isPaused = false;
Expand Down Expand Up @@ -219,9 +220,7 @@ module.exports.Component = registerComponent('sound', {
if (!this.loaded) {
warn('Sound not loaded yet. It will be played once it finished loading');
this.mustPlay = true;
if(processSound){
this.processSound = processSound;
}
this.processSound = processSound;
return;
}

Expand Down

0 comments on commit 6d48043

Please sign in to comment.