private Format roundedMetricPrefixFormat = new RoundedMetricPrefixFormat()
public void startRecording() throws Exception { GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); this.screenRecorder = new ScreenRecorder(gc, new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,DepthKey, 24, FrameRateKey, Rational.valueOf(15),QualityKey, 1.0f,KeyFrameIntervalKey, 15 * 60),new Format(MediaTypeKey,MediaType.VIDEO, EncodingKey, "black",FrameRateKey, Rational.valueOf(30)),null); this.screenRecorder.start(); } public void stopRecording() throws Exception { this.screenRecorder.stop(); }
@BeforeSuite public void startRecording() throws Exception { GraphicsConfiguration gc = GraphicsEnvironment .getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); this.screenRecorder = new ScreenRecorder(gc, new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey, 24, FrameRateKey, Rational.valueOf(15), QualityKey, 1.0f, KeyFrameIntervalKey, 15 * 60), new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black", FrameRateKey, Rational.valueOf(30)), null); this.screenRecorder.start(); } @AfterSuite public void stopRecording() throws Exception { this.screenRecorder.stop(); }
Format format = new RGBFormat(); MediaLocator cameraLocator = null; // get device list Vector deviceList = CaptureDeviceManager.getDeviceList(format); // if devices available if(deviceList != null && deviceList.size() > 0) { // pick first CaptureDeviceInfo device = (CaptureDeviceInfo) deviceList.get(0); cameraLocator = device.getLocator(); }
int index; byte[] buffer = new byte[2048]; float[] floatBuffer = new float[1024]; FastYin detector = new FastYin(44100,1024); public void message(byte[] b){ for(int i = 0 ; i < b.length; i++){ buffer[index] = b[i]; index++ if(index==2048){ AudioFloatConverter converter = AudioFloatConverter.getConverter(new Format(16bits, little endian, mono,...)); //converts the byte buffer to float converter.toFloatArray(buffer,floatBuffer); float pitch = detector.getPitch(floatBuffer); //here you have your pitch info that you can use index = 0; } }
final Format format = new Format(0); Serializer ser = new Persister(format); ser.write(new Example(123, "Example message"), new File("out.xml"));
import java.text.Format; import java.text.ParseException; import java.text.SimpleDateFormat; public class FormattingDemo { private static Format createCompositeDateFormat(){ Format formattingFormat = new ParseAllFormat( new SimpleDateFormat( "dd.MM.yyyy" ) ); SimpleDateFormat shortFormat = new SimpleDateFormat( "dd.MM.yy" ); Format otherFormat = new ParseAllFormat( shortFormat ); CompositeFormat compositeFormat = new CompositeFormat(); compositeFormat.addFormat( otherFormat ); compositeFormat.addFormat( formattingFormat ); compositeFormat.setFormattingFormat( formattingFormat ); return compositeFormat; } public static void main( String[] args ) throws ParseException { Format dateFormat = createCompositeDateFormat(); System.out.println( dateFormat.parseObject( "27.01.2010" ) ); System.out.println( dateFormat.parseObject( "27.01.10" ) ); System.out.println( dateFormat.parseObject( "27.01.2012" ) ); System.out.println(dateFormat.format( dateFormat.parseObject( "27.01.2010" ) )); System.out.println(dateFormat.format( dateFormat.parseObject( "27.01.10" ) )); System.out.println(dateFormat.format( dateFormat.parseObject( "27.01.2012" ) )); } }
Format f = new Format("/buck/linetrace");