1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
5 An audio time-stretching and pitch-shifting library.
6 Copyright 2007-2008 Chris Cannam.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
15 #ifndef _RUBBERBAND_PITCH_SHIFTER_H_
16 #define _RUBBERBAND_PITCH_SHIFTER_H_
20 #include "RingBuffer.h"
22 namespace RubberBand {
23 class RubberBandStretcher;
26 class RubberBandPitchShifter
29 static const LADSPA_Descriptor *getDescriptor(unsigned long index);
32 RubberBandPitchShifter(int sampleRate, size_t channels);
33 ~RubberBandPitchShifter();
45 PortCountMono = OutputPort1 + 1,
48 PortCountStereo = OutputPort2 + 1
51 static const char *const portNamesMono[PortCountMono];
52 static const LADSPA_PortDescriptor portsMono[PortCountMono];
53 static const LADSPA_PortRangeHint hintsMono[PortCountMono];
55 static const char *const portNamesStereo[PortCountStereo];
56 static const LADSPA_PortDescriptor portsStereo[PortCountStereo];
57 static const LADSPA_PortRangeHint hintsStereo[PortCountStereo];
59 static const LADSPA_Properties properties;
61 static const LADSPA_Descriptor ladspaDescriptorMono;
62 static const LADSPA_Descriptor ladspaDescriptorStereo;
64 static LADSPA_Handle instantiate(const LADSPA_Descriptor *, unsigned long);
65 static void connectPort(LADSPA_Handle, unsigned long, LADSPA_Data *);
66 static void activate(LADSPA_Handle);
67 static void run(LADSPA_Handle, unsigned long);
68 static void deactivate(LADSPA_Handle);
69 static void cleanup(LADSPA_Handle);
72 void runImpl(unsigned long);
73 void runImpl(unsigned long, unsigned long offset);
75 void updateCrispness();
90 int m_currentCrispness;
91 bool m_currentFormant;
98 RubberBand::RubberBandStretcher *m_stretcher;
99 RubberBand::RingBuffer<float> *m_outputBuffer[2];