Mercurial > jmeCapture
view src/com/aurellem/capture/examples/Basic.java @ 14:e299cd89074d
creating Advanced Audio documentation.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 27 Oct 2011 21:55:51 -0700 |
parents | |
children | be5ac56826be |
line wrap: on
line source
1 package com.aurellem.capture.examples;3 import java.io.File;4 import java.io.IOException;6 import jme3test.helloworld.HelloAudio;7 import jme3test.helloworld.HelloJME3;8 import jme3test.niftygui.TestNiftyExamples;9 import jme3test.water.TestPostWater;11 import com.aurellem.capture.Capture;12 import com.aurellem.capture.IsoTimer;13 import com.jme3.app.SimpleApplication;16 /**17 *18 * Demonstrates how to use basic Audio/Video capture with a jMonkeyEngine19 * application. You can use these techniques to make high quality cutscenes20 * or demo videos, even on very slow laptops.21 *22 * @author Robert McIntyre23 *24 */26 public class Basic {28 public static void basicVideo() throws IOException{29 File video = File.createTempFile("HelloJME3", ".avi");30 System.out.println("Saving video to: " + video.getCanonicalPath());31 SimpleApplication app = new HelloJME3();32 app.setTimer(new IsoTimer(60));33 app.setShowSettings(false);35 Capture.captureVideo(app, video);36 app.start();37 }39 public static void basicVideoGUI() throws IOException {40 File video = File.createTempFile("GUI", ".avi");41 System.out.println("Saving video to: " + video.getCanonicalPath());42 SimpleApplication app = new TestNiftyExamples();43 app.setTimer(new IsoTimer(60));44 app.setShowSettings(false);46 Capture.captureVideo(app, video);47 app.start();48 }50 public static void basicAudio() throws IOException{51 File audio = File.createTempFile("BasicAudio", ".wav");52 System.out.println("Saving audio to: " + audio.getCanonicalPath());53 SimpleApplication app = new HelloAudio();54 app.setTimer(new IsoTimer(60));55 app.setShowSettings(false);57 // you will not hear the audio while it is being captured.58 Capture.captureAudio(app, audio);60 app.start();61 }63 public static void basicAudioVideo() throws IOException{64 File video = new File("/home/r/tmp/basicVideo.avi");65 File audio = new File("/home/r/tmp/basicAudio.wav");67 SimpleApplication app = new TestPostWater();68 app.setTimer(new IsoTimer(60));69 app.setShowSettings(false);71 Capture.captureVideo(app, video);72 Capture.captureAudio(app, audio);74 app.start();75 }78 public static void main(String[] ignore) throws IOException{79 basicVideo();80 basicVideoGUI();81 basicAudio();82 basicAudioVideo();83 }84 }