Mercurial > jmeCapture
annotate 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 |
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@19 | 5 /** |
rlm@19 | 6 * Method of Combination for sound processors. This SoundProcessor will |
rlm@19 | 7 * run the methods of each of its constituent SoundProcessors in the order |
rlm@19 | 8 * in which it was constructed. |
rlm@19 | 9 * |
rlm@19 | 10 * @author Robert McIntyre |
rlm@19 | 11 * |
rlm@19 | 12 */ |
rlm@19 | 13 public class CompositeSoundProcessor implements SoundProcessor{ |
rlm@19 | 14 |
rlm@19 | 15 SoundProcessor[] processors; |
rlm@19 | 16 |
rlm@19 | 17 public CompositeSoundProcessor(SoundProcessor...processors){ |
rlm@19 | 18 this.processors = processors; |
rlm@19 | 19 } |
rlm@19 | 20 |
rlm@19 | 21 public void process(ByteBuffer audioSamples, int numSamples) { |
rlm@19 | 22 for (SoundProcessor sp : processors){ |
rlm@19 | 23 sp.process(audioSamples, numSamples); |
rlm@19 | 24 } |
rlm@19 | 25 } |
rlm@19 | 26 |
rlm@19 | 27 public void cleanup() { |
rlm@19 | 28 for (SoundProcessor sp : processors){ |
rlm@19 | 29 sp.cleanup(); |
rlm@19 | 30 } |
rlm@19 | 31 } |
rlm@19 | 32 } |