Audacity 3.2.0
SoundTouchEffect.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 SoundTouchEffect.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
16
17#if USE_SOUNDTOUCH
18
19#ifndef __AUDACITY_EFFECT_SOUNDTOUCH__
20#define __AUDACITY_EFFECT_SOUNDTOUCH__
21
22#include "StatefulEffect.h"
23
24// forward declaration of a class defined in SoundTouch.h
25// which is not included here
26namespace soundtouch { class SoundTouch; }
27
28
29class TimeWarper;
30class LabelTrack;
31class NoteTrack;
32class WaveChannel;
33class WaveTrack;
34
35class EffectSoundTouch /* not final */ : public StatefulEffect
36{
37public:
38
39 // EffectSoundTouch implementation
40
41#ifdef USE_MIDI
42 double mSemitones; // pitch change for NoteTracks
43 EffectSoundTouch();
44#endif
45 ~EffectSoundTouch() override;
46
47protected:
48 // Effect implementation
49
50 using InitFunction = std::function< void(soundtouch::SoundTouch *soundtouch) >;
51 bool ProcessWithTimeWarper(InitFunction initer,
52 const TimeWarper &warper,
53 bool preserveLength);
54
55private:
56 bool ProcessLabelTrack(LabelTrack *track, const TimeWarper &warper);
57#ifdef USE_MIDI
58 bool ProcessNoteTrack(NoteTrack *track, const TimeWarper &warper);
59#endif
60 bool ProcessOne(soundtouch::SoundTouch *pSoundTouch,
62 const TimeWarper &warper);
63 bool ProcessStereo(soundtouch::SoundTouch *pSoundTouch,
64 WaveTrack &orig, WaveTrack &out,
66 const TimeWarper &warper);
67 bool ProcessStereoResults(soundtouch::SoundTouch *pSoundTouch,
68 const size_t outputCount,
69 WaveChannel &outputLeftTrack,
70 WaveChannel &outputRightTrack);
74 void Finalize(WaveTrack &orig, WaveTrack &out, const TimeWarper &warper);
75
76 bool mPreserveLength;
77
78 int mCurTrackNum;
79
80 double m_maxNewLength;
81};
82
83#endif
84
85#endif
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:95
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