annotate 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
rev   line source
rlm@45 1 package com.aurellem.capture.examples;
rlm@45 2
rlm@45 3 import java.io.File;
rlm@45 4 import java.io.IOException;
rlm@45 5
rlm@45 6 import jme3test.helloworld.HelloAudio;
rlm@45 7
rlm@45 8 import com.aurellem.capture.Capture;
rlm@45 9 import com.aurellem.capture.IsoTimer;
rlm@45 10 import com.jme3.app.Application;
rlm@45 11
rlm@56 12 /** Recording audio from your Application is simple. If all you want
rlm@56 13 * to do is record Audio, then follow the following steps.
rlm@50 14 *
rlm@50 15 * 1.) Set the Application's timer to an IsoTimer. The framerate is
rlm@56 16 * irrelevant for sound, but must evenly divide 44,100Hz, which is
rlm@56 17 * the frequency at which sound will be recorded. For example
rlm@50 18 * IsoTimer(60) is ok, but IsoTimer(61) is not.
rlm@50 19 *
rlm@50 20 * 2.) Call Capture.captureAudio(yourApplication, target-file) before
rlm@50 21 * calling yourApplication.start()
rlm@50 22 *
rlm@50 23 * That's it! If you have any comments/problems, please PM me on the
rlm@50 24 * jMonkeyEngine forms. My username is bortreb.
rlm@50 25 *
rlm@50 26 * @author Robert McIntyre
rlm@50 27 */
rlm@46 28 public class HelloAudioRecording {
rlm@45 29
rlm@56 30 public static void main(String[] ignore) throws IOException{
rlm@56 31 Application app = new HelloAudio();
rlm@56 32 File audio = File.createTempFile("JME-simple-audio", ".wav");
rlm@56 33 app.setTimer(new IsoTimer(60));
rlm@56 34 Capture.captureAudio(app, audio);
rlm@56 35 app.start();
rlm@56 36 System.out.println(audio.getCanonicalPath());
rlm@56 37 }
rlm@45 38 }