plectrum

Plectrum: instrument tuner for Android
Log | Files | Refs | README | LICENSE

AudioProcessor.java (1994B)


      1 /*
      2 *      _______                       _____   _____ _____  
      3 *     |__   __|                     |  __ \ / ____|  __ \ 
      4 *        | | __ _ _ __ ___  ___  ___| |  | | (___ | |__) |
      5 *        | |/ _` | '__/ __|/ _ \/ __| |  | |\___ \|  ___/ 
      6 *        | | (_| | |  \__ \ (_) \__ \ |__| |____) | |     
      7 *        |_|\__,_|_|  |___/\___/|___/_____/|_____/|_|     
      8 *                                                         
      9 * -------------------------------------------------------------
     10 *
     11 * TarsosDSP is developed by Joren Six at IPEM, University Ghent
     12 *  
     13 * -------------------------------------------------------------
     14 *
     15 *  Info: http://0110.be/tag/TarsosDSP
     16 *  Github: https://github.com/JorenSix/TarsosDSP
     17 *  Releases: http://0110.be/releases/TarsosDSP/
     18 *  
     19 *  TarsosDSP includes modified source code by various authors,
     20 *  for credits and info, see README.
     21 * 
     22 */
     23 
     24 
     25 package be.tarsos.dsp;
     26 
     27 /**
     28  * <p>
     29  * AudioProcessors are responsible for actual digital signal processing. The
     30  * interface is simple: a process method that works on an AudioEvent object. 
     31  * The AudioEvent contains a buffer with some floats and the same information in
     32  * raw bytes.
     33  * </p> 
     34  * <p>
     35  * AudioProcessors are meant to be chained e.g. execute an effect and
     36  * then play the sound. The chain of audio processor can be interrupted by returning
     37  * false in the process methods.
     38  * </p>
     39  * @author Joren Six
     40  */
     41 public interface AudioProcessor {
     42 
     43 	/**
     44 	 * Process the audio event. Do the actual signal processing on an
     45 	 * (optionally) overlapping buffer.
     46 	 * 
     47 	 * @param audioEvent
     48 	 *            The audio event that contains audio data.
     49 	 * @return False if the chain needs to stop here, true otherwise. This can
     50 	 *         be used to implement e.g. a silence detector.
     51 	 */
     52     boolean process(AudioEvent audioEvent);
     53 
     54     /**
     55      * Notify the AudioProcessor that no more data is available and processing
     56      * has finished. Can be used to deallocate resources or cleanup.
     57      */
     58     void processingFinished();
     59 }