# HG changeset patch # User Robert McIntyre # Date 1319962751 25200 # Node ID c7a07eefaeea4b8cd7b96e0477d61158921f11ff # Parent d924d7d2906369693290df620adc5b936e802702 started work on audio AI diff -r d924d7d29063 -r c7a07eefaeea src/com/aurellem/capture/Main.java --- a/src/com/aurellem/capture/Main.java Sat Oct 29 16:23:57 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/** - * @(#)Main.java 1.2 2009-08-29 - * - * Copyright (c) 2008-2009 Werner Randelshofer, Immensee, Switzerland. - * All rights reserved. - * - * You may not use, copy or modify this file, except in compliance with the - * license agreement you entered into with Werner Randelshofer. - * For details see accompanying license terms. - */ -package com.aurellem.capture; - -import java.awt.*; -import java.awt.image.BufferedImage; -import java.awt.image.IndexColorModel; -import java.io.*; -import java.util.Random; - -import ca.randelshofer.AVIOutputStream; - - -/** - * Main. - * - * @author Werner Randelshofer - * @version 1.1 2009-08-29 Added raw output. - *
1.0 2008-00-15 Created. - */ -public class Main { - - /** - * @param args the command line arguments - */ - public static void main(String[] args) { - try { - test(new File("/home/r/avidemo-jpg.avi"), AVIOutputStream.VideoFormat.JPG, 24, 1f); - test(new File("/home/r/avidemo-png.avi"), AVIOutputStream.VideoFormat.PNG, 24, 1f); - test(new File("/home/r/avidemo-raw.avi"), AVIOutputStream.VideoFormat.RAW, 24, 1f); - test(new File("/home/r/avidemo-rle8.avi"), AVIOutputStream.VideoFormat.RLE, 8, 1f); - test(new File("avidemo-rle4.avi"), AVIOutputStream.VideoFormat.RLE, 4, 1f); - - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - private static void test(File file, AVIOutputStream.VideoFormat format, int depth, float quality) throws IOException { - System.out.println("Writing " + file); - AVIOutputStream out = null; - Graphics2D g = null; - try { - out = new AVIOutputStream(file, format, depth); - out.setVideoCompressionQuality(quality); - - out.setTimeScale(1); - out.setFrameRate(30); - - Random rnd = new Random(0); // use seed 0 to get reproducable output - BufferedImage img; - switch (depth) { - case 24: - default: { - img = new BufferedImage(320, 160, BufferedImage.TYPE_INT_RGB); - break; - } - case 8: { - byte[] red = new byte[256]; - byte[] green = new byte[256]; - byte[] blue = new byte[256]; - for (int i = 0; i < 255; i++) { - red[i] = (byte) rnd.nextInt(256); - green[i] = (byte) rnd.nextInt(256); - blue[i] = (byte) rnd.nextInt(256); - } - rnd.setSeed(0); // set back to 0 for reproducable output - img = new BufferedImage(320, 160, BufferedImage.TYPE_BYTE_INDEXED, new IndexColorModel(8, 256, red, green, blue)); - break; - } - case 4: { - byte[] red = new byte[16]; - byte[] green = new byte[16]; - byte[] blue = new byte[16]; - for (int i = 0; i < 15; i++) { - red[i] = (byte) rnd.nextInt(16); - green[i] = (byte) rnd.nextInt(16); - blue[i] = (byte) rnd.nextInt(16); - } - rnd.setSeed(0); // set back to 0 for reproducable output - img = new BufferedImage(320, 160, BufferedImage.TYPE_BYTE_BINARY, new IndexColorModel(4, 16, red, green, blue)); - break; - } - } - g = img.createGraphics(); - g.setBackground(Color.WHITE); - g.clearRect(0, 0, img.getWidth(), img.getHeight()); - - for (int i = 0; i < 100; i++) { - g.setColor(new Color(rnd.nextInt())); - g.fillRect(rnd.nextInt(img.getWidth() - 30), rnd.nextInt(img.getHeight() - 30), 30, 30); - out.writeFrame(img); - } - - } finally { - if (g != null) { - g.dispose(); - } - if (out != null) { - out.close(); - } - } - } -} diff -r d924d7d29063 -r c7a07eefaeea src/com/aurellem/capture/examples/AdvancedAudio.java --- a/src/com/aurellem/capture/examples/AdvancedAudio.java Sat Oct 29 16:23:57 2011 -0700 +++ b/src/com/aurellem/capture/examples/AdvancedAudio.java Sun Oct 30 01:19:11 2011 -0700 @@ -77,9 +77,9 @@ private Geometry bell; private Spatial ear1; - private Spatial ear2; - private Spatial ear3; - private Spatial ear4; + //private Spatial ear2; + //private Spatial ear3; + //private Spatial ear4; private Vector3f[] path = new Vector3f[]{ @@ -146,9 +146,9 @@ rootNode.addLight(light); ear1 = makeEar(rootNode, new Vector3f(0, 0 ,20)); - ear2 = makeEar(rootNode, new Vector3f(0, 0 ,-20)); - ear3 = makeEar(rootNode, new Vector3f(20, 0 ,0)); - ear4 = makeEar(rootNode, new Vector3f(-20, 0 ,0)); + //ear2 = makeEar(rootNode, new Vector3f(0, 0 ,-20)); + //ear3 = makeEar(rootNode, new Vector3f(20, 0 ,0)); + //ear4 = makeEar(rootNode, new Vector3f(-20, 0 ,0)); MotionPath track = new MotionPath(); @@ -237,7 +237,7 @@ * hears it's surroundings and reacts to them. */ public void process(ByteBuffer audioSamples, int numSamples) { - System.out.println("I'm DANCING <3"); + //System.out.println("I'm DANCING <3"); entity.scale(this.scale); if (this.scale == 2f){this.scale = 0.5f;} else {this.scale = 2;} diff -r d924d7d29063 -r c7a07eefaeea src/com/aurellem/capture/examples/Basic.java --- a/src/com/aurellem/capture/examples/Basic.java Sat Oct 29 16:23:57 2011 -0700 +++ b/src/com/aurellem/capture/examples/Basic.java Sun Oct 30 01:19:11 2011 -0700 @@ -3,9 +3,6 @@ import java.io.File; import java.io.IOException; -import jme3test.helloworld.HelloAudio; -import jme3test.helloworld.HelloJME3; -import jme3test.niftygui.TestNiftyExamples; import jme3test.water.TestPostWater; import com.aurellem.capture.Capture;