Audacity 3.2.0
TimeAndPitchInterface.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 TimeAndPitchInterface.h
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#pragma once
12
13#include <functional>
14#include <memory>
15#include <optional>
16#include <vector>
17
18class TIME_AND_PITCH_API TimeAndPitchSource
19{
20public:
22 virtual void Pull(float* const*, size_t samplesPerChannel) = 0;
23};
24
25class TIME_AND_PITCH_API TimeAndPitchInterface
26{
27public:
28 static bool IsPassThroughMode(double stretchRatio);
29
30 // Limit the pitch shift range to +/- one octave. When
31 // https://github.com/audacity/audacity/issues/5904 is addressed, we may
32 // alleviate this restriction.
33 static constexpr auto MaxCents = 1200;
34 static constexpr auto MinCents = -1200;
35
37 {
38 double timeRatio = 1.0;
39 double pitchRatio = 1.0;
40 bool preserveFormants = false;
41 };
42
43 virtual void GetSamples(float* const*, size_t) = 0;
44 virtual void OnCentShiftChange(int cents) = 0;
45 virtual void OnFormantPreservationChange(bool preserve) = 0;
46
48};
virtual void OnFormantPreservationChange(bool preserve)=0
virtual void OnCentShiftChange(int cents)=0
virtual ~TimeAndPitchInterface()
virtual void GetSamples(float *const *, size_t)=0
virtual void Pull(float *const *, size_t samplesPerChannel)=0
virtual ~TimeAndPitchSource()