Audacity 3.2.0
SoundTouchBase.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 SoundTouchBase.h
6
7 Dominic Mazzoni, Vaughan Johnson
8
9 This abstract class contains all of the common code for an
10 effect that uses SoundTouch to do its processing (ChangeTempo
11 and ChangePitch).
12
13**********************************************************************/
14
15#if USE_SOUNDTOUCH
16
17#ifndef __AUDACITY_EFFECT_SOUNDTOUCH__
18#define __AUDACITY_EFFECT_SOUNDTOUCH__
19
20#include "StatefulEffect.h"
21
22// forward declaration of a class defined in SoundTouch.h
23// which is not included here
24namespace soundtouch { class SoundTouch; }
25
26
27class TimeWarper;
28class LabelTrack;
29class NoteTrack;
30class WaveChannel;
31class WaveTrack;
32
33class BUILTIN_EFFECTS_API SoundTouchBase /* not final */ : public StatefulEffect
34{
35public:
36
37 // SoundTouchBase implementation
38
39#ifdef USE_MIDI
40 double mSemitones; // pitch change for NoteTracks
41 SoundTouchBase();
42#endif
43 ~SoundTouchBase() override;
44
45protected:
46 // Effect implementation
47
48 using InitFunction = std::function< void(soundtouch::SoundTouch *soundtouch) >;
49 bool ProcessWithTimeWarper(InitFunction initer,
50 const TimeWarper &warper,
51 bool preserveLength);
52
53private:
54 bool ProcessLabelTrack(LabelTrack *track, const TimeWarper &warper);
55#ifdef USE_MIDI
56 bool ProcessNoteTrack(NoteTrack *track, const TimeWarper &warper);
57#endif
58 bool ProcessOne(soundtouch::SoundTouch *pSoundTouch,
60 const TimeWarper &warper);
61 bool ProcessStereo(soundtouch::SoundTouch *pSoundTouch,
62 WaveTrack &orig, WaveTrack &out,
64 const TimeWarper &warper);
65 bool ProcessStereoResults(soundtouch::SoundTouch *pSoundTouch,
66 const size_t outputCount,
67 WaveChannel &outputLeftTrack,
68 WaveChannel &outputRightTrack);
72 void Finalize(WaveTrack &orig, WaveTrack &out, const TimeWarper &warper);
73
74 bool mPreserveLength;
75
76 int mCurTrackNum;
77
78 double m_maxNewLength;
79};
80
81#endif
82
83#endif
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:98
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:78
Transforms one point in time to another point. For example, a time stretching effect might use one to...
Definition: TimeWarper.h:62
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
const char * end(const char *str) noexcept
Definition: StringUtils.h:106