Skip to content

Commit

Permalink
aframevr#5364 : Sound : Automatically set the loop end to the end of …
Browse files Browse the repository at this point in the history
…the sound if a loop start was specified without an end
  • Loading branch information
JonathannJacobs committed Oct 19, 2023
1 parent f91140a commit 61a5455
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ module.exports.Component = registerComponent('sound', {
}
sound.setLoop(data.loop);
sound.setLoopStart(data.loopStart);
sound.setLoopEnd(data.loopEnd);

// With a loop start specified without a specified loop end, the end of the loop should be the end of the file
if(data.loopStart != 0 && data.loopEnd == 0){
sound.setLoopEnd(sound.buffer.duration);
}
else sound.setLoopEnd(data.loopEnd);

sound.setVolume(data.volume);
sound.isPaused = false;
}
Expand Down

0 comments on commit 61a5455

Please sign in to comment.