changeset 22:c7a07eefaeea

started work on audio AI
author Robert McIntyre <rlm@mit.edu>
date Sun, 30 Oct 2011 01:19:11 -0700
parents d924d7d29063
children b643413c3aba
files src/com/aurellem/capture/Main.java src/com/aurellem/capture/examples/AdvancedAudio.java src/com/aurellem/capture/examples/Basic.java
diffstat 3 files changed, 7 insertions(+), 122 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/src/com/aurellem/capture/Main.java	Sat Oct 29 16:23:57 2011 -0700
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,112 +0,0 @@
     1.4 -/**
     1.5 - * @(#)Main.java  1.2  2009-08-29
     1.6 - *
     1.7 - * Copyright (c) 2008-2009 Werner Randelshofer, Immensee, Switzerland.
     1.8 - * All rights reserved.
     1.9 - *
    1.10 - * You may not use, copy or modify this file, except in compliance with the
    1.11 - * license agreement you entered into with Werner Randelshofer.
    1.12 - * For details see accompanying license terms.
    1.13 - */
    1.14 -package com.aurellem.capture;
    1.15 -
    1.16 -import java.awt.*;
    1.17 -import java.awt.image.BufferedImage;
    1.18 -import java.awt.image.IndexColorModel;
    1.19 -import java.io.*;
    1.20 -import java.util.Random;
    1.21 -
    1.22 -import ca.randelshofer.AVIOutputStream;
    1.23 -
    1.24 -
    1.25 -/**
    1.26 - * Main.
    1.27 - *
    1.28 - * @author Werner Randelshofer
    1.29 - * @version 1.1 2009-08-29 Added raw output.
    1.30 - * <br>1.0 2008-00-15 Created.
    1.31 - */
    1.32 -public class Main {
    1.33 -
    1.34 -    /**
    1.35 -     * @param args the command line arguments
    1.36 -     */
    1.37 -    public static void main(String[] args) {
    1.38 -        try {
    1.39 -            test(new File("/home/r/avidemo-jpg.avi"), AVIOutputStream.VideoFormat.JPG, 24, 1f);
    1.40 -            test(new File("/home/r/avidemo-png.avi"), AVIOutputStream.VideoFormat.PNG, 24, 1f);
    1.41 -            test(new File("/home/r/avidemo-raw.avi"), AVIOutputStream.VideoFormat.RAW, 24, 1f);
    1.42 -            test(new File("/home/r/avidemo-rle8.avi"), AVIOutputStream.VideoFormat.RLE, 8, 1f);
    1.43 -            test(new File("avidemo-rle4.avi"), AVIOutputStream.VideoFormat.RLE, 4, 1f);
    1.44 -
    1.45 -        } catch (IOException ex) {
    1.46 -            ex.printStackTrace();
    1.47 -        }
    1.48 -    }
    1.49 -
    1.50 -    private static void test(File file, AVIOutputStream.VideoFormat format, int depth, float quality) throws IOException {
    1.51 -        System.out.println("Writing " + file);
    1.52 -        AVIOutputStream out = null;
    1.53 -        Graphics2D g = null;
    1.54 -        try {
    1.55 -            out = new AVIOutputStream(file, format, depth);
    1.56 -            out.setVideoCompressionQuality(quality);
    1.57 -
    1.58 -            out.setTimeScale(1);
    1.59 -            out.setFrameRate(30);
    1.60 -
    1.61 -            Random rnd = new Random(0); // use seed 0 to get reproducable output
    1.62 -            BufferedImage img;
    1.63 -            switch (depth) {
    1.64 -                case 24:
    1.65 -                default: {
    1.66 -                    img = new BufferedImage(320, 160, BufferedImage.TYPE_INT_RGB);
    1.67 -                    break;
    1.68 -                }
    1.69 -                case 8: {
    1.70 -                    byte[] red = new byte[256];
    1.71 -                    byte[] green = new byte[256];
    1.72 -                    byte[] blue = new byte[256];
    1.73 -                    for (int i = 0; i < 255; i++) {
    1.74 -                        red[i] = (byte) rnd.nextInt(256);
    1.75 -                        green[i] = (byte) rnd.nextInt(256);
    1.76 -                        blue[i] = (byte) rnd.nextInt(256);
    1.77 -                    }
    1.78 -                    rnd.setSeed(0); // set back to 0 for reproducable output
    1.79 -                    img = new BufferedImage(320, 160, BufferedImage.TYPE_BYTE_INDEXED, new IndexColorModel(8, 256, red, green, blue));
    1.80 -                    break;
    1.81 -                }
    1.82 -                case 4: {
    1.83 -                    byte[] red = new byte[16];
    1.84 -                    byte[] green = new byte[16];
    1.85 -                    byte[] blue = new byte[16];
    1.86 -                    for (int i = 0; i < 15; i++) {
    1.87 -                        red[i] = (byte) rnd.nextInt(16);
    1.88 -                        green[i] = (byte) rnd.nextInt(16);
    1.89 -                        blue[i] = (byte) rnd.nextInt(16);
    1.90 -                    }
    1.91 -                    rnd.setSeed(0); // set back to 0 for reproducable output
    1.92 -                    img = new BufferedImage(320, 160, BufferedImage.TYPE_BYTE_BINARY, new IndexColorModel(4, 16, red, green, blue));
    1.93 -                    break;
    1.94 -                }
    1.95 -            }
    1.96 -            g = img.createGraphics();
    1.97 -            g.setBackground(Color.WHITE);
    1.98 -            g.clearRect(0, 0, img.getWidth(), img.getHeight());
    1.99 -
   1.100 -            for (int i = 0; i < 100; i++) {
   1.101 -                g.setColor(new Color(rnd.nextInt()));
   1.102 -                g.fillRect(rnd.nextInt(img.getWidth() - 30), rnd.nextInt(img.getHeight() - 30), 30, 30);
   1.103 -                out.writeFrame(img);
   1.104 -            }
   1.105 -
   1.106 -        } finally {
   1.107 -            if (g != null) {
   1.108 -                g.dispose();
   1.109 -            }
   1.110 -            if (out != null) {
   1.111 -                out.close();
   1.112 -            }
   1.113 -        }
   1.114 -    }
   1.115 -}
     2.1 --- a/src/com/aurellem/capture/examples/AdvancedAudio.java	Sat Oct 29 16:23:57 2011 -0700
     2.2 +++ b/src/com/aurellem/capture/examples/AdvancedAudio.java	Sun Oct 30 01:19:11 2011 -0700
     2.3 @@ -77,9 +77,9 @@
     2.4  	 private Geometry bell;
     2.5  	 
     2.6  	 private Spatial ear1;
     2.7 -	 private Spatial ear2;
     2.8 -	 private Spatial ear3;
     2.9 -	 private Spatial ear4;
    2.10 +	 //private Spatial ear2;
    2.11 +	 //private Spatial ear3;
    2.12 +	 //private Spatial ear4;
    2.13  	 
    2.14  	 
    2.15  	 private Vector3f[] path = new Vector3f[]{
    2.16 @@ -146,9 +146,9 @@
    2.17  		 rootNode.addLight(light);
    2.18  
    2.19  		 ear1 = makeEar(rootNode, new Vector3f(0, 0 ,20));
    2.20 -		 ear2 = makeEar(rootNode, new Vector3f(0, 0 ,-20));
    2.21 -		 ear3 = makeEar(rootNode, new Vector3f(20, 0 ,0));
    2.22 -		 ear4 = makeEar(rootNode, new Vector3f(-20, 0 ,0));
    2.23 +		 //ear2 = makeEar(rootNode, new Vector3f(0, 0 ,-20));
    2.24 +		 //ear3 = makeEar(rootNode, new Vector3f(20, 0 ,0));
    2.25 +		 //ear4 = makeEar(rootNode, new Vector3f(-20, 0 ,0));
    2.26  
    2.27  		 MotionPath track = new MotionPath();
    2.28  		 
    2.29 @@ -237,7 +237,7 @@
    2.30  	   * hears it's surroundings and reacts to them.
    2.31  	   */
    2.32  	  public void process(ByteBuffer audioSamples, int numSamples) {
    2.33 -		  System.out.println("I'm DANCING <3");
    2.34 +		  //System.out.println("I'm DANCING <3");
    2.35  		  entity.scale(this.scale);
    2.36  		  if (this.scale == 2f){this.scale = 0.5f;}
    2.37  		  else {this.scale = 2;}
     3.1 --- a/src/com/aurellem/capture/examples/Basic.java	Sat Oct 29 16:23:57 2011 -0700
     3.2 +++ b/src/com/aurellem/capture/examples/Basic.java	Sun Oct 30 01:19:11 2011 -0700
     3.3 @@ -3,9 +3,6 @@
     3.4  import java.io.File;
     3.5  import java.io.IOException;
     3.6  
     3.7 -import jme3test.helloworld.HelloAudio;
     3.8 -import jme3test.helloworld.HelloJME3;
     3.9 -import jme3test.niftygui.TestNiftyExamples;
    3.10  import jme3test.water.TestPostWater;
    3.11  
    3.12  import com.aurellem.capture.Capture;