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"
24
25// forward declaration of a class defined in SoundTouch.h
26// which is not included here
27namespace soundtouch { class SoundTouch; }
28
29
30class TimeWarper;
31class LabelTrack;
32class NoteTrack;
33class WaveChannel;
34class WaveTrack;
35
36class EffectSoundTouch /* not final */ :
37 public StatefulEffect,
39{
40public:
41
42 // EffectSoundTouch implementation
43
44#ifdef USE_MIDI
45 double mSemitones; // pitch change for NoteTracks
46 EffectSoundTouch();
47#endif
48 ~EffectSoundTouch() override;
49
50protected:
51 // Effect implementation
52
53 using InitFunction = std::function< void(soundtouch::SoundTouch *soundtouch) >;
54 bool ProcessWithTimeWarper(InitFunction initer,
55 const TimeWarper &warper,
56 bool preserveLength);
57
58private:
59 bool ProcessLabelTrack(LabelTrack *track, const TimeWarper &warper);
60#ifdef USE_MIDI
61 bool ProcessNoteTrack(NoteTrack *track, const TimeWarper &warper);
62#endif
63 bool ProcessOne(soundtouch::SoundTouch *pSoundTouch,
65 const TimeWarper &warper);
66 bool ProcessStereo(soundtouch::SoundTouch *pSoundTouch,
67 WaveTrack &orig, WaveTrack &out,
69 const TimeWarper &warper);
70 bool ProcessStereoResults(soundtouch::SoundTouch *pSoundTouch,
71 const size_t outputCount,
72 WaveChannel &outputLeftTrack,
73 WaveChannel &outputRightTrack);
77 void Finalize(WaveTrack &orig, WaveTrack &out, const TimeWarper &warper);
78
79 bool mPreserveLength;
80
81 int mCurTrackNum;
82
83 double m_maxNewLength;
84};
85
86#endif
87
88#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