|
@@ -20,6 +20,7 @@ function Audio( listener ) {
|
|
|
this.autoplay = false;
|
|
|
|
|
|
this.buffer = null;
|
|
|
+ this.detune = 0;
|
|
|
this.loop = false;
|
|
|
this.startTime = 0;
|
|
|
this.offset = 0;
|
|
@@ -94,6 +95,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
var source = this.context.createBufferSource();
|
|
|
|
|
|
source.buffer = this.buffer;
|
|
|
+ source.detune.value = this.detune;
|
|
|
source.loop = this.loop;
|
|
|
source.onended = this.onEnded.bind( this );
|
|
|
source.playbackRate.setValueAtTime( this.playbackRate, this.startTime );
|
|
@@ -222,6 +224,26 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ setDetune: function ( value ) {
|
|
|
+
|
|
|
+ this.detune = value;
|
|
|
+
|
|
|
+ if ( this.isPlaying === true ) {
|
|
|
+
|
|
|
+ this.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ getDetune: function () {
|
|
|
+
|
|
|
+ return this.detune;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
getFilter: function () {
|
|
|
|
|
|
return this.getFilters()[ 0 ];
|
|
@@ -247,7 +269,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
if ( this.isPlaying === true ) {
|
|
|
|
|
|
- this.source.playbackRate.setValueAtTime( this.playbackRate, this.context.currentTime );
|
|
|
+ this.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );
|
|
|
|
|
|
}
|
|
|
|