Browse Source

Merge pull request #8135 from julien-moreau/master

Added support of metadata in Sound class.
David Catuhe 5 years ago
parent
commit
db57304f57
2 changed files with 14 additions and 1 deletions
  1. 4 0
      dist/preview release/what's new.md
  2. 10 1
      src/Audio/sound.ts

+ 4 - 0
dist/preview release/what's new.md

@@ -128,6 +128,10 @@
 - .HDR environment files will now give accurate PBR reflections ([CraigFeldpsar](https://github.com/craigfeldspar))
 - Reflection probes can now be used to give accurate shading with PBR ([CraigFeldpsar](https://github.com/craigfeldspar))
 
+### Audio
+
+- Added support of `metadata` in `Sound` class. ([julien-moreau](https://github.com/julien-moreau))
+
 ### Build
 
 - Fixed an issue with gulp webpack, webpack stream and the viewer ([RaananW](https://github.com/RaananW))

+ 10 - 1
src/Audio/sound.ts

@@ -140,6 +140,10 @@ export class Sound {
      * Back Compat
      **/
     public onended: () => any;
+    /**
+     * Gets or sets an object used to store user defined information for the sound.
+     */
+    public metadata: any = null;
 
     /**
      * Observable event when the current playing sound finishes.
@@ -1036,7 +1040,8 @@ export class Sound {
             distanceModel: this.distanceModel,
             playbackRate: this._playbackRate,
             panningModel: this._panningModel,
-            soundTrackId: this.soundTrackId
+            soundTrackId: this.soundTrackId,
+            metadata: this.metadata
         };
 
         if (this.spatialSound) {
@@ -1126,6 +1131,10 @@ export class Sound {
             }
         }
 
+        if (parsedSound.metadata) {
+            newSound.metadata = parsedSound.metadata;
+        }
+
         return newSound;
     }
 }