annotate src/com/aurellem/capture/audio/CompositeSoundProcessor.java @ 27:5249c8a9603c

changed SoundProcessors to use AudioFormat
author Robert McIntyre <rlm@mit.edu>
date Sun, 30 Oct 2011 08:10:26 -0700
parents 4de7988407ef
children
rev   line source
rlm@19 1 package com.aurellem.capture.audio;
rlm@19 2
rlm@19 3 import java.nio.ByteBuffer;
rlm@19 4
rlm@27 5 import javax.sound.sampled.AudioFormat;
rlm@27 6
rlm@19 7 /**
rlm@19 8 * Method of Combination for sound processors. This SoundProcessor will
rlm@19 9 * run the methods of each of its constituent SoundProcessors in the order
rlm@19 10 * in which it was constructed.
rlm@19 11 *
rlm@19 12 * @author Robert McIntyre
rlm@19 13 *
rlm@19 14 */
rlm@19 15 public class CompositeSoundProcessor implements SoundProcessor{
rlm@19 16
rlm@19 17 SoundProcessor[] processors;
rlm@19 18
rlm@19 19 public CompositeSoundProcessor(SoundProcessor...processors){
rlm@19 20 this.processors = processors;
rlm@19 21 }
rlm@19 22
rlm@27 23 public void process(ByteBuffer audioSamples, AudioFormat format, int numSamples) {
rlm@19 24 for (SoundProcessor sp : processors){
rlm@27 25 sp.process(audioSamples, format, numSamples);
rlm@19 26 }
rlm@19 27 }
rlm@19 28
rlm@19 29 public void cleanup() {
rlm@19 30 for (SoundProcessor sp : processors){
rlm@27 31 sp.cleanup();
rlm@19 32 }
rlm@19 33 }
rlm@27 34
rlm@19 35 }