From 9f2582e4ddaa935b67cbdad13b25a8a45a3a660b Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Wed, 27 Feb 2013 22:28:20 +0000 Subject: [PATCH] SDK core : Initialized the audioRenderer for the FakeApplication thread so one can play sounds in the scene composer git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10451 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/com/jme3/gde/core/scene/FakeApplication.java | 8 +++++++- .../src/com/jme3/gde/core/scene/SceneApplication.java | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java index 8144802ea..9c5ab0e70 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java @@ -36,6 +36,7 @@ import com.jme3.app.SimpleApplication; import com.jme3.app.state.AppState; import com.jme3.app.state.AppStateManager; import com.jme3.asset.AssetManager; +import com.jme3.audio.AudioContext; import com.jme3.audio.AudioRenderer; import com.jme3.audio.Listener; import com.jme3.gde.core.appstates.AppStateManagerNode; @@ -101,6 +102,10 @@ public class FakeApplication extends SimpleApplication { this.cam = cam; this.appStateManager = new FakeAppStateManager(this); } + + public void setAudioRenderer(AudioRenderer audioRenderer){ + this.audioRenderer = audioRenderer; + } @Override public void createCanvas() { @@ -487,6 +492,7 @@ public class FakeApplication extends SimpleApplication { public boolean updateFake(final float tpf) { Future fut = fakeAppThread.submit(new Callable() { public Void call() throws Exception { + AudioContext.setAudioRenderer(audioRenderer); appStateManager.update(tpf); return null; } @@ -534,7 +540,7 @@ public class FakeApplication extends SimpleApplication { public boolean updateExternalLogicalState(final Node externalNode, final float tpf) { Future fut = fakeAppThread.submit(new Callable() { - public Void call() throws Exception { + public Void call() throws Exception { externalNode.updateLogicalState(tpf); return null; } diff --git a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java index e32bdee20..40d7ab102 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java @@ -27,6 +27,7 @@ package com.jme3.gde.core.scene; import com.jme3.app.Application; import com.jme3.app.StatsView; import com.jme3.asset.AssetManager; +import com.jme3.audio.AudioContext; import com.jme3.bullet.BulletAppState; import com.jme3.font.BitmapFont; import com.jme3.font.BitmapText; @@ -223,7 +224,8 @@ public class SceneApplication extends Application implements LookupProvider { try { super.initialize(); thread = Thread.currentThread(); - fakeApp.startFakeApp(); + fakeApp.setAudioRenderer(audioRenderer); + fakeApp.startFakeApp(); { overlayView = getRenderManager().createMainView("Overlay", cam); overlayView.setClearFlags(false, true, false);