Mercurial > jmeCapture
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:6dc62c7866c2 | 14:e299cd89074d |
---|---|
1 package com.aurellem.capture.examples; | |
2 | |
3 import java.io.File; | |
4 import java.io.IOException; | |
5 | |
6 import jme3test.helloworld.HelloAudio; | |
7 import jme3test.helloworld.HelloJME3; | |
8 import jme3test.niftygui.TestNiftyExamples; | |
9 import jme3test.water.TestPostWater; | |
10 | |
11 import com.aurellem.capture.Capture; | |
12 import com.aurellem.capture.IsoTimer; | |
13 import com.jme3.app.SimpleApplication; | |
14 | |
15 | |
16 /** | |
17 * | |
18 * Demonstrates how to use basic Audio/Video capture with a jMonkeyEngine | |
19 * application. You can use these techniques to make high quality cutscenes | |
20 * or demo videos, even on very slow laptops. | |
21 * | |
22 * @author Robert McIntyre | |
23 * | |
24 */ | |
25 | |
26 public class Basic { | |
27 | |
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); | |
34 | |
35 Capture.captureVideo(app, video); | |
36 app.start(); | |
37 } | |
38 | |
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); | |
45 | |
46 Capture.captureVideo(app, video); | |
47 app.start(); | |
48 } | |
49 | |
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); | |
56 | |
57 // you will not hear the audio while it is being captured. | |
58 Capture.captureAudio(app, audio); | |
59 | |
60 app.start(); | |
61 } | |
62 | |
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"); | |
66 | |
67 SimpleApplication app = new TestPostWater(); | |
68 app.setTimer(new IsoTimer(60)); | |
69 app.setShowSettings(false); | |
70 | |
71 Capture.captureVideo(app, video); | |
72 Capture.captureAudio(app, audio); | |
73 | |
74 app.start(); | |
75 } | |
76 | |
77 | |
78 public static void main(String[] ignore) throws IOException{ | |
79 basicVideo(); | |
80 basicVideoGUI(); | |
81 basicAudio(); | |
82 basicAudioVideo(); | |
83 } | |
84 } |