comparison src/com/aurellem/capture/audio/WaveFileWriter.java @ 26:95648b0c12bc

code reformating
author Robert McIntyre <rlm@mit.edu>
date Sun, 30 Oct 2011 04:43:39 -0700
parents 25fcf5fda505
children 5249c8a9603c be37291c62b8
comparison
equal deleted inserted replaced
25:25fcf5fda505 26:95648b0c12bc
19 private WaveAudioOutputStream wao; 19 private WaveAudioOutputStream wao;
20 20
21 public WaveFileWriter(File targetFile) throws FileNotFoundException{ 21 public WaveFileWriter(File targetFile) throws FileNotFoundException{
22 wao = new WaveAudioOutputStream(new AudioFormat(44100.0f, 32, 1, true, false), 22 wao = new WaveAudioOutputStream(new AudioFormat(44100.0f, 32, 1, true, false),
23 AudioSystem.NOT_SPECIFIED, 23 AudioSystem.NOT_SPECIFIED,
24 (TDataOutputStream) new TNonSeekableDataOutputStream(new FileOutputStream(targetFile))); 24 (TDataOutputStream) new TNonSeekableDataOutputStream(
25 new FileOutputStream(targetFile)));
25 } 26 }
26 27
27 public void cleanup() { 28 public void cleanup() {
28 try {wao.close();} 29 try {wao.close();}
29 catch (IOException e) {e.printStackTrace();} 30 catch (IOException e) {e.printStackTrace();}
31 32
32 33
33 public void process(ByteBuffer audioSamples, int numSamples) { 34 public void process(ByteBuffer audioSamples, int numSamples) {
34 byte[] data = new byte[numSamples]; 35 byte[] data = new byte[numSamples];
35 audioSamples.get(data, 0, numSamples); 36 audioSamples.get(data, 0, numSamples);
36
37 try {wao.write(data, 0, numSamples);} 37 try {wao.write(data, 0, numSamples);}
38 catch (IOException e) {e.printStackTrace();} 38 catch (IOException e) {e.printStackTrace();}
39 } 39 }
40 } 40 }