# HG changeset patch # User Robert McIntyre # Date 1322940147 21600 # Node ID 121b6d7e4d3f9d4a5c87a40ca21906088119c7f9 # Parent 6ecfef90e9eb3cac874d1e916870ed02b94b54af more friendly AppSettings handling diff -r 6ecfef90e9eb -r 121b6d7e4d3f src/com/aurellem/capture/AurellemSystemDelegate.java --- a/src/com/aurellem/capture/AurellemSystemDelegate.java Sat Dec 03 12:53:31 2011 -0600 +++ b/src/com/aurellem/capture/AurellemSystemDelegate.java Sat Dec 03 13:22:27 2011 -0600 @@ -7,8 +7,15 @@ public class AurellemSystemDelegate extends JmeDesktopSystem { + public static final String SEND = "Send"; + public AudioRenderer newAudioRenderer(AppSettings settings) { initialize(settings); - return new AudioSendRenderer(); + if (settings.getAudioRenderer() == SEND){ + return new AudioSendRenderer(); + } + else { + return super.newAudioRenderer(settings); + } } } \ No newline at end of file diff -r 6ecfef90e9eb -r 121b6d7e4d3f src/com/aurellem/capture/Capture.java --- a/src/com/aurellem/capture/Capture.java Sat Dec 03 12:53:31 2011 -0600 +++ b/src/com/aurellem/capture/Capture.java Sat Dec 03 13:22:27 2011 -0600 @@ -14,6 +14,7 @@ import com.jme3.audio.AudioRenderer; import com.jme3.renderer.ViewPort; import com.jme3.scene.Spatial; +import com.jme3.system.AppSettings; import com.jme3.system.JmeSystem; public class Capture { @@ -37,7 +38,7 @@ ViewPort viewPort = app.getRenderManager() - .createPostView("aurellem record", app.getCamera()); + .createPostView("aurellem video record", app.getCamera()); viewPort.setClearFlags(false, false, false); @@ -56,9 +57,15 @@ public static void captureAudio(final Application app, final File file) throws IOException{ - + AppSettings settings = null; + if (app.getContext() != null){settings = app.getContext().getSettings();} + if (settings == null){settings = new AppSettings(true);} + settings.setAudioRenderer("Send"); + app.setSettings(settings); + JmeSystem.setSystemDelegate(new AurellemSystemDelegate()); + final WaveFileWriter writer = new WaveFileWriter(file); Callable thunk = new Callable(){ @@ -73,6 +80,5 @@ }; app.enqueue(thunk); - } - + } } diff -r 6ecfef90e9eb -r 121b6d7e4d3f src/com/aurellem/capture/examples/Advanced.java --- a/src/com/aurellem/capture/examples/Advanced.java Sat Dec 03 12:53:31 2011 -0600 +++ b/src/com/aurellem/capture/examples/Advanced.java Sat Dec 03 13:22:27 2011 -0600 @@ -69,7 +69,7 @@ //Logger.getLogger("com.jme3").setLevel(Level.OFF); Advanced app = new Advanced(); AppSettings settings = new AppSettings(true); - settings.setAudioRenderer("Send"); + settings.setAudioRenderer(AurellemSystemDelegate.SEND); JmeSystem.setSystemDelegate(new AurellemSystemDelegate()); app.setSettings(settings); app.setShowSettings(false); @@ -164,7 +164,7 @@ motionControl = new MotionTrack(bell,track); // for now, use reflection to change the timer... - //motionControl.setTimer(new IsoTimer(60)); + // motionControl.setTimer(new IsoTimer(60)); try { Field timerField; timerField = AbstractCinematicEvent.class.getDeclaredField("timer");