From de34c4bc18951f4680d1be2428663586947bace3 Mon Sep 17 00:00:00 2001 From: Rohan Khayech Date: Wed, 9 Aug 2023 13:37:19 +0800 Subject: [PATCH] Added constructor with PitchDetector parameter to PitchProcessor. --- .../java/be/tarsos/dsp/pitch/PitchProcessor.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/main/java/be/tarsos/dsp/pitch/PitchProcessor.java b/core/src/main/java/be/tarsos/dsp/pitch/PitchProcessor.java index b9e9145..69af003 100644 --- a/core/src/main/java/be/tarsos/dsp/pitch/PitchProcessor.java +++ b/core/src/main/java/be/tarsos/dsp/pitch/PitchProcessor.java @@ -124,6 +124,20 @@ public PitchProcessor(PitchEstimationAlgorithm algorithm, float sampleRate, detector = algorithm.getDetector(sampleRate, bufferSize); this.handler = handler; } + + /** + * Initialize a new pitch processor. + * + * @param detector + * The pitch detector to use. + * + * @param handler + * The handler handles detected pitch. + */ + public PitchProcessor(PitchDetector detector, PitchDetectionHandler handler) { + this.detector = detector; + this.handler = handler; + } @Override public boolean process(AudioEvent audioEvent) {