diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/com/aurellem/capture/audio/CompositeSoundProcessor.java	Sat Oct 29 15:16:06 2011 -0700
     1.3 @@ -0,0 +1,32 @@
     1.4 +package com.aurellem.capture.audio;
     1.5 +
     1.6 +import java.nio.ByteBuffer;
     1.7 +
     1.8 +/**
     1.9 + * Method of Combination for sound processors.  This SoundProcessor will 
    1.10 + * run the methods of each of its constituent SoundProcessors in the order 
    1.11 + * in which it was constructed.
    1.12 + * 
    1.13 + * @author Robert McIntyre
    1.14 + *
    1.15 + */
    1.16 +public class CompositeSoundProcessor implements SoundProcessor{
    1.17 +
    1.18 +	SoundProcessor[] processors;
    1.19 +	
    1.20 +	public CompositeSoundProcessor(SoundProcessor...processors){
    1.21 +		this.processors = processors;
    1.22 +	}
    1.23 +	
    1.24 +	public void process(ByteBuffer audioSamples, int numSamples) {
    1.25 +		for (SoundProcessor sp : processors){
    1.26 +			sp.process(audioSamples, numSamples);
    1.27 +		}
    1.28 +	}
    1.29 +	
    1.30 +	public void cleanup() {
    1.31 +		for (SoundProcessor sp : processors){
    1.32 +			sp.cleanup();
    1.33 +		}
    1.34 +	}
    1.35 +}