瀏覽代碼

* Added new constructor for AudioNode that accepts stream-cache parameter

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7519 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
Sha..rd 14 年之前
父節點
當前提交
c91d1d264a
共有 1 個文件被更改,包括 22 次插入2 次删除
  1. 22 2
      engine/src/core/com/jme3/audio/AudioNode.java

+ 22 - 2
engine/src/core/com/jme3/audio/AudioNode.java

@@ -104,6 +104,9 @@ public class AudioNode extends Node {
         Stopped,
     }
 
+    /**
+     * Serialization only. Do not use.
+     */
     public AudioNode() {
     }
 
@@ -139,12 +142,29 @@ public class AudioNode extends Node {
      * @param name The filename of the audio file
      * @param stream If true, the audio will be streamed gradually from disk, 
      *               otherwise, it will be buffered.
+     * @param streamCache If stream is also true, then this specifies if
+     * the stream cache is used. When enabled, the audio stream will
+     * be read entirely but not decoded, allowing features such as 
+     * seeking, looping and determining duration.
      */
-    public AudioNode(AudioRenderer audioRenderer, AssetManager assetManager, String name, boolean stream) {
+    public AudioNode(AudioRenderer audioRenderer, AssetManager assetManager, String name, boolean stream, boolean streamCache) {
         this(audioRenderer);
-        this.key = new AudioKey(name, stream);
+        this.key = new AudioKey(name, stream, streamCache);
         this.data = (AudioData) assetManager.loadAsset(key);
     }
+    
+    /**
+     * Creates a new <code>AudioNode</code> with the given audio file.
+     * 
+     * @param audioRenderer The audio renderer to use for playing. Cannot be null.
+     * @param assetManager The asset manager to use to load the audio file
+     * @param name The filename of the audio file
+     * @param stream If true, the audio will be streamed gradually from disk, 
+     *               otherwise, it will be buffered.
+     */
+    public AudioNode(AudioRenderer audioRenderer, AssetManager assetManager, String name, boolean stream) {
+        this(audioRenderer, assetManager, name, stream, false);
+    }
 
     /**
      * Creates a new <code>AudioNode</code> with the given audio file.