DspAlgorithm
JavaScript is disabled on your browser.

br.usp.ime.dspbenchmarking.algorithms

Class DspAlgorithm

  • java.lang.Object
    • br.usp.ime.dspbenchmarking.algorithms.DspAlgorithm
  • Direct Known Subclasses:
    DoubleDCT_1DAlgorithm, DoubleDHT_1DAlgorithm, DoubleDST_1DAlgorithm, DoubleFFT_1DAlgorithm, FftAlgorithm, FFTWAlgorithm, FFTWMultithreadAlgorithm, Loopback, PhaseVocoder, PitchShifting, Reverb, StressAlgorithm


    public abstract class DspAlgorithm
    extends java.lang.Object
    An abstract representation of a DSP algorithm. It stores the current DSP block size and the sample rate of the signal it is working over. All DSP algorithms should have a perform() method that works over a buffer containing the signal samples and actually modifies/analyses/synthesises the signal. To add a new DSP algorithm, do the following: 1. Create a class extending DspAlgorithm. 2. Write the perform method for the new algorithm inside the new class, also adding whatever is needed for the algorithm to work. 3. Instantiate the new algorithm and add it to the `algorithms` vector in DspThread's constructor. 4. If you want the new algorithm to be available to the user on the GUI, add the new algorithm name to the `algorithm_array` array in `res/values/strings.xml` (that array populates the pulldown menu on the GUI). 5. Include the new algorithm in the tests by modifying AllTestsAlgorithm.
    • Constructor Summary

      Constructors 
      Constructor and Description
      DspAlgorithm(int sRate, int bSize)
      The constructor just saves the sample rate and block size of the current algorithm.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      abstract java.lang.String getAlgorithmName() 
      int getBlockSize() 
      double getParameter1() 
      int getSampleRate() 
      abstract void perform(double[] buffer)
      This method should be implemented by all DSP algorithms.
      void setBlockSize(int bSize)
      Set the block size.
      void setParams(double param1)
      Set a parameter to control the algorithm.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • blockSize

        protected int blockSize
      • sampleRate

        protected int sampleRate
      • parameter1

        protected double parameter1
    • Constructor Detail

      • DspAlgorithm

        public DspAlgorithm(int sRate,
                    int bSize)
        The constructor just saves the sample rate and block size of the current algorithm.
        Parameters:
        sRate -
        bSize -
    • Method Detail

      • perform

        public abstract void perform(double[] buffer)
        This method should be implemented by all DSP algorithms. It is the actual perform function that works over a buffer to modify the audio signal.
        Parameters:
        buffer -
      • setBlockSize

        public void setBlockSize(int bSize)
        Set the block size.
        Parameters:
        bSize -
      • getBlockSize

        public int getBlockSize()
        Returns:
        The current block size.
      • getSampleRate

        public int getSampleRate()
        Returns:
        The current sample rate.
      • setParams

        public void setParams(double param1)
        Set a parameter to control the algorithm.
        Parameters:
        param1 -
      • getParameter1

        public double getParameter1()
        Returns:
        The parameter that controls the algorithm.
      • getAlgorithmName

        public abstract java.lang.String getAlgorithmName()
        Returns:
        The name of the algorithm.