view src/com/aurellem/capture/audio/CompositeSoundProcessor.java @ 19:4de7988407ef

added CompositeSoundProcessor for combining SoundProcessors
author Robert McIntyre <rlm@mit.edu>
date Sat, 29 Oct 2011 15:16:06 -0700
parents
children 5249c8a9603c be37291c62b8
line wrap: on
line source
1 package com.aurellem.capture.audio;
3 import java.nio.ByteBuffer;
5 /**
6 * Method of Combination for sound processors. This SoundProcessor will
7 * run the methods of each of its constituent SoundProcessors in the order
8 * in which it was constructed.
9 *
10 * @author Robert McIntyre
11 *
12 */
13 public class CompositeSoundProcessor implements SoundProcessor{
15 SoundProcessor[] processors;
17 public CompositeSoundProcessor(SoundProcessor...processors){
18 this.processors = processors;
19 }
21 public void process(ByteBuffer audioSamples, int numSamples) {
22 for (SoundProcessor sp : processors){
23 sp.process(audioSamples, numSamples);
24 }
25 }
27 public void cleanup() {
28 for (SoundProcessor sp : processors){
29 sp.cleanup();
30 }
31 }
32 }