未验证 提交 b9e5def7 编写于 作者: M Mr.doob 提交者: GitHub

Audio: Add setLoopStart() and setLoopEnd()

上级 32c2afbc
......@@ -22,6 +22,8 @@ function Audio( listener ) {
this.buffer = null;
this.detune = 0;
this.loop = false;
this.loopStart = 0;
this.loopEnd = 0;
this.startTime = 0;
this.offset = 0;
this.duration = undefined;
......@@ -108,6 +110,8 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
source.buffer = this.buffer;
source.loop = this.loop;
source.loopStart = this.loopStart;
source.loopEnd = this.loopEnd;
source.onended = this.onEnded.bind( this );
this.startTime = this.context.currentTime;
source.start( this.startTime, this.offset, this.duration );
......@@ -337,6 +341,22 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
return this;
},
setLoopStart: function ( value ) {
this.loopStart = value;
return this;
},
setLoopEnd: function ( value ) {
this.loopEnd = value;
return this;
},
getVolume: function () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册