From 729daffb47398c1d4920417ba44937fe39d18330 Mon Sep 17 00:00:00 2001 From: jada Date: Mon, 6 Mar 2006 19:55:06 +0000 Subject: Partial fix to sound --- build.xml | 8 +++ .../j3d/examples/sound/AudioBehaviorMoveOne.java | 12 +++- .../j3d/examples/sound/MoveAppBoundingLeaf.java | 74 +++++++--------------- 3 files changed, 41 insertions(+), 53 deletions(-) diff --git a/build.xml b/build.xml index 6d4ca66..72c9ff0 100644 --- a/build.xml +++ b/build.xml @@ -285,6 +285,14 @@ + + + + + + + 0) { - filename[0] = new String(path + "/" + filename[0]); - } - else { - // fill in default file names if all three not given - filename[0] = new String(path + "/techno_machine.au"); - } - filenamesSet = true; - } setLayout(new BorderLayout()); GraphicsConfiguration config = @@ -331,16 +308,6 @@ public class MoveAppBoundingLeaf extends Applet { Canvas3D c = new Canvas3D(config); add("Center", c); - /* - * Change filenames into URLs - */ - String substr = filename[0].substring(0,4); - try { - url[0] = new URL(filename[0]); - } - catch (Exception e) { - return; - } /* * Create a simple scene and attach it to the virtual universe */ @@ -364,26 +331,31 @@ public class MoveAppBoundingLeaf extends Applet { // as well as an applet // public static void main(String[] args) { + if (args.length > 0) { - if ( (args[0].startsWith("file"+File.pathSeparator)) || - (args[0].startsWith("http"+File.pathSeparator)) ) { - path = args[0]; - } - else { - path = "file:" + args[0]; + try { + if ( (args[0].startsWith("file"+File.pathSeparator)) || + (args[0].startsWith("http"+File.pathSeparator)) ) { + url = new URL(args[0]); + } else if (args[0].charAt(0) != '/') { + url = new URL("file:./" + args[0]); + } else { + url = new URL("file:" + args[0]); + } + } catch (MalformedURLException e) { + System.err.println(e); + System.exit(1); } } - else { - path = "file:."; - } - if (args.length > 1) { - filename[0] = args[1]; - if (filename[0] != null) { - filenamesGiven++ ; + if (url == null) { + url = Resources.getResource("resources/audio/techno_machine.au"); + if (url == null) { + System.err.println("resources/audio/techno_machine.au not found"); + System.exit(1); } } - + new MainFrame(new MoveAppBoundingLeaf(), 256, 256); } } -- cgit v1.2.3