Mercurial > jmeCapture
view src/com/aurellem/capture/examples/HelloAudioRecording.java @ 62:f5e52169f056
updated to work with new jme changes
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 14 Dec 2011 17:43:52 -0700 |
parents | afc437f637bd |
children |
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;8 import com.aurellem.capture.Capture;9 import com.aurellem.capture.IsoTimer;10 import com.jme3.app.Application;12 /** Recording audio from your Application is simple. If all you want13 * to do is record Audio, then follow the following steps.14 *15 * 1.) Set the Application's timer to an IsoTimer. The framerate is16 * irrelevant for sound, but must evenly divide 44,100Hz, which is17 * the frequency at which sound will be recorded. For example18 * IsoTimer(60) is ok, but IsoTimer(61) is not.19 *20 * 2.) Call Capture.captureAudio(yourApplication, target-file) before21 * calling yourApplication.start()22 *23 * That's it! If you have any comments/problems, please PM me on the24 * jMonkeyEngine forms. My username is bortreb.25 *26 * @author Robert McIntyre27 */28 public class HelloAudioRecording {30 public static void main(String[] ignore) throws IOException{31 Application app = new HelloAudio();32 File audio = File.createTempFile("JME-simple-audio", ".wav");33 app.setTimer(new IsoTimer(60));34 Capture.captureAudio(app, audio);35 app.start();36 System.out.println(audio.getCanonicalPath());37 }38 }