Mercurial > jmeCapture
changeset 30:be37291c62b8
propagated AudioFormat to other classes.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 30 Oct 2011 10:11:21 -0700 |
parents | 9f58273090df |
children | b67ffa8aa0b9 |
files | src/com/aurellem/capture/audio/AudioSendRenderer.java src/com/aurellem/capture/audio/CompositeSoundProcessor.java src/com/aurellem/capture/audio/SoundProcessor.java src/com/aurellem/capture/audio/WaveFileWriter.java src/com/aurellem/capture/examples/AdvancedAudio.java |
diffstat | 5 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/src/com/aurellem/capture/audio/AudioSendRenderer.java Sun Oct 30 10:06:38 2011 -0700 1.2 +++ b/src/com/aurellem/capture/audio/AudioSendRenderer.java Sun Oct 30 10:11:21 2011 -0700 1.3 @@ -184,7 +184,7 @@ 1.4 audioSend.getSamples(buffer, samplesToGet, i); 1.5 SoundProcessor sp = 1.6 this.soundProcessorMap.get(this.listeners.get(i)); 1.7 - if (null != sp){sp.process(buffer, samplesToGet*outFormat.getFrameSize());} 1.8 + if (null != sp){sp.process(buffer, samplesToGet*outFormat.getFrameSize(), outFormat);} 1.9 } 1.10 1.11 }
2.1 --- a/src/com/aurellem/capture/audio/CompositeSoundProcessor.java Sun Oct 30 10:06:38 2011 -0700 2.2 +++ b/src/com/aurellem/capture/audio/CompositeSoundProcessor.java Sun Oct 30 10:11:21 2011 -0700 2.3 @@ -2,6 +2,8 @@ 2.4 2.5 import java.nio.ByteBuffer; 2.6 2.7 +import javax.sound.sampled.AudioFormat; 2.8 + 2.9 /** 2.10 * Method of Combination for sound processors. This SoundProcessor will 2.11 * run the methods of each of its constituent SoundProcessors in the order 2.12 @@ -18,9 +20,9 @@ 2.13 this.processors = processors; 2.14 } 2.15 2.16 - public void process(ByteBuffer audioSamples, int numSamples) { 2.17 + public void process(ByteBuffer audioSamples, int numSamples, AudioFormat format) { 2.18 for (SoundProcessor sp : processors){ 2.19 - sp.process(audioSamples, numSamples); 2.20 + sp.process(audioSamples, numSamples, format); 2.21 } 2.22 } 2.23
3.1 --- a/src/com/aurellem/capture/audio/SoundProcessor.java Sun Oct 30 10:06:38 2011 -0700 3.2 +++ b/src/com/aurellem/capture/audio/SoundProcessor.java Sun Oct 30 10:11:21 2011 -0700 3.3 @@ -2,10 +2,12 @@ 3.4 3.5 import java.nio.ByteBuffer; 3.6 3.7 +import javax.sound.sampled.AudioFormat; 3.8 + 3.9 public interface SoundProcessor { 3.10 3.11 void cleanup(); 3.12 3.13 - void process(ByteBuffer audioSamples, int numSamples); 3.14 + void process(ByteBuffer audioSamples, int numSamples, AudioFormat format); 3.15 3.16 }
4.1 --- a/src/com/aurellem/capture/audio/WaveFileWriter.java Sun Oct 30 10:06:38 2011 -0700 4.2 +++ b/src/com/aurellem/capture/audio/WaveFileWriter.java Sun Oct 30 10:11:21 2011 -0700 4.3 @@ -31,7 +31,7 @@ 4.4 } 4.5 4.6 4.7 - public void process(ByteBuffer audioSamples, int numSamples) { 4.8 + public void process(ByteBuffer audioSamples, int numSamples, AudioFormat format) { 4.9 byte[] data = new byte[numSamples]; 4.10 audioSamples.get(data, 0, numSamples); 4.11 try {wao.write(data, 0, numSamples);}
5.1 --- a/src/com/aurellem/capture/examples/AdvancedAudio.java Sun Oct 30 10:06:38 2011 -0700 5.2 +++ b/src/com/aurellem/capture/examples/AdvancedAudio.java Sun Oct 30 10:11:21 2011 -0700 5.3 @@ -3,6 +3,8 @@ 5.4 import java.io.File; 5.5 import java.nio.ByteBuffer; 5.6 5.7 +import javax.sound.sampled.AudioFormat; 5.8 + 5.9 import com.aurellem.capture.IsoTimer; 5.10 import com.aurellem.capture.audio.MultiListener; 5.11 import com.aurellem.capture.audio.SoundProcessor; 5.12 @@ -235,7 +237,7 @@ 5.13 * Dance to the beat! This is the brain of an AI entity that 5.14 * hears it's surroundings and reacts to them. 5.15 */ 5.16 - public void process(ByteBuffer audioSamples, int numSamples) { 5.17 + public void process(ByteBuffer audioSamples, int numSamples, AudioFormat format) { 5.18 //System.out.println("I'm DANCING <3"); 5.19 entity.scale(this.scale); 5.20 if (this.scale == 2f){this.scale = 0.5f;}