diff src/com/aurellem/capture/hello/BasicAVRecord.java @ 12:d10f4d4ff15a

going to improve documentation
author Robert McIntyre <rlm@mit.edu>
date Thu, 27 Oct 2011 21:07:50 -0700
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/com/aurellem/capture/hello/BasicAVRecord.java	Thu Oct 27 21:07:50 2011 -0700
     1.3 @@ -0,0 +1,76 @@
     1.4 +package com.aurellem.capture.hello;
     1.5 +
     1.6 +import java.io.File;
     1.7 +import java.io.IOException;
     1.8 +
     1.9 +import jme3test.helloworld.HelloAudio;
    1.10 +import jme3test.helloworld.HelloJME3;
    1.11 +import jme3test.niftygui.TestNiftyExamples;
    1.12 +import jme3test.water.TestPostWater;
    1.13 +
    1.14 +import com.aurellem.capture.Capture;
    1.15 +import com.aurellem.capture.IsoTimer;
    1.16 +import com.jme3.app.SimpleApplication;
    1.17 +
    1.18 +
    1.19 +/**
    1.20 + * 
    1.21 + * Demonstrates how to use basic Audio/Video capture with a jMonkeyEngine 
    1.22 + * application.
    1.23 + * 
    1.24 + * @author Robert McIntyre
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +public class BasicAVRecord {
    1.29 +	
    1.30 +	public static void basicVideo() throws IOException{
    1.31 +		File video = File.createTempFile("HelloJME3", ".avi");
    1.32 +		System.out.println("Saving video to: " + video.getCanonicalPath());
    1.33 +		SimpleApplication app = new HelloJME3();
    1.34 +		app.setTimer(new IsoTimer(60));
    1.35 +		
    1.36 +		Capture.captureVideo(app, video);
    1.37 +		app.start();
    1.38 +	}
    1.39 +	
    1.40 +	public static void basicVideoGUI() throws IOException {
    1.41 +		File video = File.createTempFile("GUI", ".avi");
    1.42 +		System.out.println("Saving video to: " + video.getCanonicalPath());
    1.43 +		SimpleApplication app = new TestNiftyExamples();
    1.44 +		app.setTimer(new IsoTimer(60));
    1.45 +		
    1.46 +		Capture.captureVideo(app, video);
    1.47 +		app.start();
    1.48 +	}
    1.49 +	
    1.50 +	public static void basicAudio() throws IOException{
    1.51 +		File audio = File.createTempFile("BasicAudio", ".wav");
    1.52 +		System.out.println("Saving audio to: " + audio.getCanonicalPath());
    1.53 +		SimpleApplication app = new HelloAudio();
    1.54 +		app.setTimer(new IsoTimer(60));
    1.55 +		
    1.56 +		// you will not hear the audio while it is being captured.
    1.57 +		Capture.captureAudio(app, audio);
    1.58 +		
    1.59 +		app.start();
    1.60 +	}
    1.61 +	
    1.62 +	public static void basicAudioVideo() throws IOException{
    1.63 +		File video = new File("/home/r/tmp/basicVideo.avi");
    1.64 +		File audio = new File("/home/r/tmp/basicAudio.wav");
    1.65 +		
    1.66 +		SimpleApplication app = new TestPostWater();
    1.67 +		app.setTimer(new IsoTimer(60));
    1.68 +		
    1.69 +		Capture.captureVideo(app, video);
    1.70 +		Capture.captureAudio(app, audio);
    1.71 +		
    1.72 +		app.start();
    1.73 +	}
    1.74 +	
    1.75 +	
    1.76 +	public static void main(String[] ignore) throws IOException{
    1.77 +		basicAudio();
    1.78 +		}
    1.79 +}