be.hogent.tarsos.sampled.pitch
Class AnnotationPublisher

java.lang.Object
  extended by be.hogent.tarsos.sampled.pitch.AnnotationPublisher

public final class AnnotationPublisher
extends java.lang.Object

This class is responsible for the extraction and delegation of annotations. It notifies listeners of annotations.


Nested Class Summary
static interface AnnotationPublisher.AnnotationFilter
          FILTERS
 class AnnotationPublisher.PitchClassFilter
           
 class AnnotationPublisher.SteadyStateFilter
           
 
Method Summary
 void addAnnotations(java.util.List<Annotation> annotations)
           
 void addListener(AnnotationListener listener)
          Adds an annotation listener.
 void alterSelection(double newMinProbability)
           
 void alterSelection(double startTime, double stopTime)
           
 void alterSelection(double startTime, double stopTime, double startPitch, double stopPitch)
           
 void applyPitchClassFilter(double[] pitchClasses, double maxCentsDifference)
           
 void applySteadyStateFilter(double maxCentsDifference, double minDuration)
           
 void clear()
          Remove all annotations from the listeners.
 void clearTree()
           
 void delegateAddAnnotations(double newMinProbability)
           
 void delegateAddAnnotations(double startTime, double stopTime)
          Adds annotations to listeners.
 void delegateAddAnnotations(double startTime, double stopTime, double startPitch, double stopPitch)
          Adds annotations to listeners.
 void delegateAddAnnotations(java.util.List<Annotation> annotations)
          Adds a list of annotations to listeners.
 void extractionFinished()
           
 void extractionStarted()
           
 AnnotationTree getAnnotationTree()
           
 java.util.List<Annotation> getCurrentlySelectedAnnotations()
           
 AnnotationSelection getCurrentSelection()
           
static AnnotationPublisher getInstance()
           
 void steadyStateAnnotationFilter(java.util.List<Annotation> annotations, double maxCentsDifference, double minDuration)
          Steady state filter: only keep annotations that are repeated for x seconds within y cents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addListener

public void addListener(AnnotationListener listener)
Adds an annotation listener.

Parameters:
listener - The listener to add.

addAnnotations

public void addAnnotations(java.util.List<Annotation> annotations)
Parameters:
annotations -

applySteadyStateFilter

public void applySteadyStateFilter(double maxCentsDifference,
                                   double minDuration)

applyPitchClassFilter

public void applyPitchClassFilter(double[] pitchClasses,
                                  double maxCentsDifference)

steadyStateAnnotationFilter

public void steadyStateAnnotationFilter(java.util.List<Annotation> annotations,
                                        double maxCentsDifference,
                                        double minDuration)
Steady state filter: only keep annotations that are repeated for x seconds within y cents.

Parameters:
annotations - The list of annotations to filter.
maxCentsDifference - The number of cents the next annotation may differ.
minDuration - The minimum duration of the 'note'.

getAnnotationTree

public AnnotationTree getAnnotationTree()

clear

public void clear()
Remove all annotations from the listeners.


clearTree

public void clearTree()

delegateAddAnnotations

public void delegateAddAnnotations(java.util.List<Annotation> annotations)
Adds a list of annotations to listeners.

Parameters:
annotations - The annotations to add to the listeners.

delegateAddAnnotations

public void delegateAddAnnotations(double startTime,
                                   double stopTime)
Adds annotations to listeners. The annotations are defined by a search on time.

Parameters:
startTime - The start time.
stopTime - The stop time.

delegateAddAnnotations

public void delegateAddAnnotations(double startTime,
                                   double stopTime,
                                   double startPitch,
                                   double stopPitch)
Adds annotations to listeners. The annotations are defined by a search on time and pitch.

Parameters:
startTime - The start time.
stopTime - The stop time.
startPitch - The start pitch.
stopPitch - The stop pitch.

delegateAddAnnotations

public void delegateAddAnnotations(double newMinProbability)

alterSelection

public void alterSelection(double startTime,
                           double stopTime,
                           double startPitch,
                           double stopPitch)

alterSelection

public void alterSelection(double startTime,
                           double stopTime)

alterSelection

public void alterSelection(double newMinProbability)

extractionFinished

public void extractionFinished()

extractionStarted

public void extractionStarted()

getCurrentSelection

public AnnotationSelection getCurrentSelection()

getCurrentlySelectedAnnotations

public java.util.List<Annotation> getCurrentlySelectedAnnotations()

getInstance

public static AnnotationPublisher getInstance()
Returns:
The single instance of the annotation publisher.