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
3.0
rem..om 12 years ago
parent 76de5e345e
commit 9f2582e4dd
  1. 8
      sdk/jme3-core/src/com/jme3/gde/core/scene/FakeApplication.java
  2. 4
      sdk/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java

@ -36,6 +36,7 @@ import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AppState; import com.jme3.app.state.AppState;
import com.jme3.app.state.AppStateManager; import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioContext;
import com.jme3.audio.AudioRenderer; import com.jme3.audio.AudioRenderer;
import com.jme3.audio.Listener; import com.jme3.audio.Listener;
import com.jme3.gde.core.appstates.AppStateManagerNode; import com.jme3.gde.core.appstates.AppStateManagerNode;
@ -101,6 +102,10 @@ public class FakeApplication extends SimpleApplication {
this.cam = cam; this.cam = cam;
this.appStateManager = new FakeAppStateManager(this); this.appStateManager = new FakeAppStateManager(this);
} }
public void setAudioRenderer(AudioRenderer audioRenderer){
this.audioRenderer = audioRenderer;
}
@Override @Override
public void createCanvas() { public void createCanvas() {
@ -487,6 +492,7 @@ public class FakeApplication extends SimpleApplication {
public boolean updateFake(final float tpf) { public boolean updateFake(final float tpf) {
Future fut = fakeAppThread.submit(new Callable<Void>() { Future fut = fakeAppThread.submit(new Callable<Void>() {
public Void call() throws Exception { public Void call() throws Exception {
AudioContext.setAudioRenderer(audioRenderer);
appStateManager.update(tpf); appStateManager.update(tpf);
return null; return null;
} }
@ -534,7 +540,7 @@ public class FakeApplication extends SimpleApplication {
public boolean updateExternalLogicalState(final Node externalNode, final float tpf) { public boolean updateExternalLogicalState(final Node externalNode, final float tpf) {
Future fut = fakeAppThread.submit(new Callable<Void>() { Future fut = fakeAppThread.submit(new Callable<Void>() {
public Void call() throws Exception { public Void call() throws Exception {
externalNode.updateLogicalState(tpf); externalNode.updateLogicalState(tpf);
return null; return null;
} }

@ -27,6 +27,7 @@ package com.jme3.gde.core.scene;
import com.jme3.app.Application; import com.jme3.app.Application;
import com.jme3.app.StatsView; import com.jme3.app.StatsView;
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import com.jme3.audio.AudioContext;
import com.jme3.bullet.BulletAppState; import com.jme3.bullet.BulletAppState;
import com.jme3.font.BitmapFont; import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText; import com.jme3.font.BitmapText;
@ -223,7 +224,8 @@ public class SceneApplication extends Application implements LookupProvider {
try { try {
super.initialize(); super.initialize();
thread = Thread.currentThread(); thread = Thread.currentThread();
fakeApp.startFakeApp(); fakeApp.setAudioRenderer(audioRenderer);
fakeApp.startFakeApp();
{ {
overlayView = getRenderManager().createMainView("Overlay", cam); overlayView = getRenderManager().createMainView("Overlay", cam);
overlayView.setClearFlags(false, true, false); overlayView.setClearFlags(false, true, false);

Loading…
Cancel
Save