comparison 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
comparison
equal deleted inserted replaced
18:2543c95a0fd2 19:4de7988407ef
1 package com.aurellem.capture.audio;
2
3 import java.nio.ByteBuffer;
4
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{
14
15 SoundProcessor[] processors;
16
17 public CompositeSoundProcessor(SoundProcessor...processors){
18 this.processors = processors;
19 }
20
21 public void process(ByteBuffer audioSamples, int numSamples) {
22 for (SoundProcessor sp : processors){
23 sp.process(audioSamples, numSamples);
24 }
25 }
26
27 public void cleanup() {
28 for (SoundProcessor sp : processors){
29 sp.cleanup();
30 }
31 }
32 }