|
@@ -347,7 +347,7 @@
|
|
if (this._startOffset < 0) {
|
|
if (this._startOffset < 0) {
|
|
time = -this._startOffset;
|
|
time = -this._startOffset;
|
|
this._startOffset = 0;
|
|
this._startOffset = 0;
|
|
- }
|
|
|
|
|
|
+ }
|
|
var startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
|
|
var startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
|
|
if (!this._soundSource || !this._streamingSource) {
|
|
if (!this._soundSource || !this._streamingSource) {
|
|
if (this.spatialSound) {
|
|
if (this.spatialSound) {
|
|
@@ -536,7 +536,7 @@
|
|
// Can't clone a streaming sound
|
|
// Can't clone a streaming sound
|
|
else {
|
|
else {
|
|
return null;
|
|
return null;
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public getAudioBuffer() {
|
|
public getAudioBuffer() {
|
|
@@ -544,35 +544,35 @@
|
|
}
|
|
}
|
|
|
|
|
|
public serialize(): any {
|
|
public serialize(): any {
|
|
- var serializationObject: any = {
|
|
|
|
- name: this.name,
|
|
|
|
- url: this.name,
|
|
|
|
- autoplay: this.autoplay,
|
|
|
|
- loop: this.loop,
|
|
|
|
- volume: this._volume,
|
|
|
|
- spatialSound: this.spatialSound,
|
|
|
|
- maxDistance: this.maxDistance,
|
|
|
|
- rolloffFactor: this.rolloffFactor,
|
|
|
|
- refDistance: this.refDistance,
|
|
|
|
- distanceModel: this.distanceModel,
|
|
|
|
- playbackRate: this._playbackRate,
|
|
|
|
- panningModel: this._panningModel,
|
|
|
|
- soundTrackId: this.soundTrackId
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- if (this.spatialSound) {
|
|
|
|
- if (this._connectedMesh)
|
|
|
|
- serializationObject.connectedMeshId = this._connectedMesh.id;
|
|
|
|
-
|
|
|
|
- serializationObject.position = this._position.asArray();
|
|
|
|
- serializationObject.refDistance = this.refDistance;
|
|
|
|
- serializationObject.distanceModel = this.distanceModel;
|
|
|
|
-
|
|
|
|
- serializationObject.isDirectional = this._isDirectional;
|
|
|
|
- serializationObject.localDirectionToMesh = this._localDirection.asArray();
|
|
|
|
- serializationObject.coneInnerAngle = this._coneInnerAngle;
|
|
|
|
- serializationObject.coneOuterAngle = this._coneOuterAngle;
|
|
|
|
- serializationObject.coneOuterGain = this._coneOuterGain;
|
|
|
|
|
|
+ var serializationObject: any = {
|
|
|
|
+ name: this.name,
|
|
|
|
+ url: this.name,
|
|
|
|
+ autoplay: this.autoplay,
|
|
|
|
+ loop: this.loop,
|
|
|
|
+ volume: this._volume,
|
|
|
|
+ spatialSound: this.spatialSound,
|
|
|
|
+ maxDistance: this.maxDistance,
|
|
|
|
+ rolloffFactor: this.rolloffFactor,
|
|
|
|
+ refDistance: this.refDistance,
|
|
|
|
+ distanceModel: this.distanceModel,
|
|
|
|
+ playbackRate: this._playbackRate,
|
|
|
|
+ panningModel: this._panningModel,
|
|
|
|
+ soundTrackId: this.soundTrackId
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if (this.spatialSound) {
|
|
|
|
+ if (this._connectedMesh)
|
|
|
|
+ serializationObject.connectedMeshId = this._connectedMesh.id;
|
|
|
|
+
|
|
|
|
+ serializationObject.position = this._position.asArray();
|
|
|
|
+ serializationObject.refDistance = this.refDistance;
|
|
|
|
+ serializationObject.distanceModel = this.distanceModel;
|
|
|
|
+
|
|
|
|
+ serializationObject.isDirectional = this._isDirectional;
|
|
|
|
+ serializationObject.localDirectionToMesh = this._localDirection.asArray();
|
|
|
|
+ serializationObject.coneInnerAngle = this._coneInnerAngle;
|
|
|
|
+ serializationObject.coneOuterAngle = this._coneOuterAngle;
|
|
|
|
+ serializationObject.coneOuterGain = this._coneOuterGain;
|
|
}
|
|
}
|
|
|
|
|
|
return serializationObject;
|
|
return serializationObject;
|
|
@@ -581,7 +581,7 @@
|
|
public static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound {
|
|
public static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound {
|
|
var soundName = parsedSound.name;
|
|
var soundName = parsedSound.name;
|
|
var soundUrl;
|
|
var soundUrl;
|
|
-
|
|
|
|
|
|
+
|
|
if (parsedSound.url) {
|
|
if (parsedSound.url) {
|
|
soundUrl = rootUrl + parsedSound.url;
|
|
soundUrl = rootUrl + parsedSound.url;
|
|
}
|
|
}
|
|
@@ -637,7 +637,7 @@
|
|
newSound.attachToMesh(connectedMesh);
|
|
newSound.attachToMesh(connectedMesh);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return newSound;
|
|
return newSound;
|
|
}
|
|
}
|
|
}
|
|
}
|