auditory.sampled
Class AbstractBufferedSoundBinaryOp

java.lang.Object
  extended by auditory.sampled.AbstractBufferedSoundOp
      extended by auditory.sampled.AbstractBufferedSoundBinaryOp
All Implemented Interfaces:
BufferedSoundBinaryOp
Direct Known Subclasses:
AddOp, MultiplyOp

public abstract class AbstractBufferedSoundBinaryOp
extends AbstractBufferedSoundOp
implements BufferedSoundBinaryOp

An abstract class that implements the BufferedSoundBinaryOp interface. This method can be extended by classes that want to implement the BufferedSoundBinaryOp interface.

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Constructor Summary
AbstractBufferedSoundBinaryOp()
           
 
Method Summary
abstract  void applyFilter(double[] source1, double[] source2, double[] destination)
          Apply the filter (sample-by-sample).
 void applyFilter(java.util.Iterator<double[]> source1, java.util.Iterator<double[]> source2, java.util.Iterator<double[]> destination)
          Apply the filter to all of the channels
protected  void checkArguments(BufferedSound a, BufferedSound b)
          Check to see if two BufferedSound objects are compatible.
 BufferedSound filter(BufferedSound src1, BufferedSound src2, BufferedSound dest)
          A two-source/one-destination filter.
 
Methods inherited from class auditory.sampled.AbstractBufferedSoundOp
createCompatibleDestinationSound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBufferedSoundBinaryOp

public AbstractBufferedSoundBinaryOp()
Method Detail

applyFilter

public abstract void applyFilter(double[] source1,
                                 double[] source2,
                                 double[] destination)
Apply the filter (sample-by-sample). This method must be implemented by concrete children

Parameters:
source1 - The signal from source1
source2 - The signal from source2
destination - The destination signals

applyFilter

public void applyFilter(java.util.Iterator<double[]> source1,
                        java.util.Iterator<double[]> source2,
                        java.util.Iterator<double[]> destination)
Apply the filter to all of the channels

Parameters:
source1 - The signals from source1
source2 - The signals from source2
destination - The destination signals

checkArguments

protected void checkArguments(BufferedSound a,
                              BufferedSound b)
                       throws java.lang.IllegalArgumentException
Check to see if two BufferedSound objects are compatible.

Overrides:
checkArguments in class AbstractBufferedSoundOp
Throws:
java.lang.IllegalArgumentException - If they are not compatible

filter

public BufferedSound filter(BufferedSound src1,
                            BufferedSound src2,
                            BufferedSound dest)
                     throws java.lang.IllegalArgumentException
A two-source/one-destination filter. If the destination is null, a BufferedSound with an appropriate AudioFormat and length is created and returned.

Specified by:
filter in interface BufferedSoundBinaryOp
Parameters:
src1 - One operand (i.e., one sound to operate on)
src2 - The other operand (i.e., other sound to operate on)
dest - An empty sound to hold the result (or null)
Throws:
java.lang.IllegalArgumentException - if the sounds don't match


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers