From fead899369c1df405f48809a79b93d1eb18fef1f Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sat, 10 Nov 2012 21:08:11 +0000 Subject: [PATCH] * Fixed issue 511 git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9984 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/niftygui/SoundHandleJme.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/engine/src/niftygui/com/jme3/niftygui/SoundHandleJme.java b/engine/src/niftygui/com/jme3/niftygui/SoundHandleJme.java index d05156b60..5f297d86e 100644 --- a/engine/src/niftygui/com/jme3/niftygui/SoundHandleJme.java +++ b/engine/src/niftygui/com/jme3/niftygui/SoundHandleJme.java @@ -45,8 +45,9 @@ public class SoundHandleJme implements SoundHandle { private float volume = 1; public SoundHandleJme(AudioRenderer ar, AudioNode node){ - if (ar == null || node == null) + if (ar == null || node == null) { throw new NullPointerException(); + } this.node = node; } @@ -58,12 +59,14 @@ public class SoundHandleJme implements SoundHandle { * @param fileName */ public SoundHandleJme(AudioRenderer ar, AssetManager am, String fileName){ - if (ar == null || am == null) + if (ar == null || am == null) { throw new NullPointerException(); + } this.am = am; - if (fileName == null) + if (fileName == null) { throw new NullPointerException(); + } this.fileName = fileName; } @@ -86,7 +89,11 @@ public class SoundHandleJme implements SoundHandle { public void stop() { if (node != null){ node.stop(); - node = null; + // Do not nullify the node for non-streaming nodes! + if (fileName != null) { + // Causes play() to reload the stream on the next playback + node = null; + } } }