Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ChangeTempoBase Class Reference

#include <ChangeTempoBase.h>

Inheritance diagram for ChangeTempoBase:
[legend]
Collaboration diagram for ChangeTempoBase:
[legend]

Public Member Functions

 ChangeTempoBase ()
 
virtual ~ChangeTempoBase ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
ManualPageID ManualPage () const override
 
EffectType GetType () const override
 
bool SupportsAutomation () const override
 
bool Init () override
 
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 
bool Process (EffectInstance &instance, EffectSettings &settings) override
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 

Static Public Member Functions

static ChangeTempoBaseFetchParameters (ChangeTempoBase &e, EffectSettings &)
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Change Tempo") }
 

Protected Member Functions

const EffectParameterMethodsParameters () const override
 

Protected Attributes

bool mUseSBSMS
 
double m_PercentChange
 
double m_FromBPM
 
double m_ToBPM
 
double m_FromLength
 
double m_ToLength
 
bool m_bLoopDetect
 

Static Protected Attributes

static constexpr EffectParameter Percentage
 
static constexpr EffectParameter UseSBSMS
 

Detailed Description

Definition at line 6 of file ChangeTempoBase.h.

Constructor & Destructor Documentation

◆ ChangeTempoBase()

ChangeTempoBase::ChangeTempoBase ( )

Definition at line 33 of file ChangeTempoBase.cpp.

34{
35 // mUseSBSMS always defaults to false and its value is used only if USE_SBSMS
36 // is defined
37 Parameters().Reset(*this);
38 m_FromBPM = 0.0; // indicates not yet set
39 m_ToBPM = 0.0; // indicates not yet set
40 m_FromLength = 0.0;
41 m_ToLength = 0.0;
42
43 m_bLoopDetect = false;
44
45 SetLinearEffectFlag(true);
46}
const EffectParameterMethods & Parameters() const override
virtual void Reset(Effect &effect) const =0

References m_bLoopDetect, m_FromBPM, m_FromLength, m_ToBPM, m_ToLength, Parameters(), and EffectParameterMethods::Reset().

Here is the call graph for this function:

◆ ~ChangeTempoBase()

ChangeTempoBase::~ChangeTempoBase ( )
virtual

Definition at line 48 of file ChangeTempoBase.cpp.

49{
50}

Member Function Documentation

◆ CalcPreviewInputLength()

double ChangeTempoBase::CalcPreviewInputLength ( const EffectSettings settings,
double  previewLength 
) const
override

Definition at line 83 of file ChangeTempoBase.cpp.

85{
86 return previewLength * (100.0 + m_PercentChange) / 100.0;
87}

References m_PercentChange.

◆ CheckWhetherSkipEffect()

bool ChangeTempoBase::CheckWhetherSkipEffect ( const EffectSettings settings) const
override

Definition at line 89 of file ChangeTempoBase.cpp.

90{
91 return (m_PercentChange == 0.0);
92}

References m_PercentChange.

◆ FetchParameters()

static ChangeTempoBase * ChangeTempoBase::FetchParameters ( ChangeTempoBase e,
EffectSettings  
)
inlinestatic

Definition at line 10 of file ChangeTempoBase.h.

11 {
12 return &e;
13 }

◆ GetDescription()

TranslatableString ChangeTempoBase::GetDescription ( ) const
override

Definition at line 59 of file ChangeTempoBase.cpp.

60{
61 return XO("Changes the tempo of a selection without changing its pitch");
62}
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol ChangeTempoBase::GetSymbol ( ) const
override

Definition at line 54 of file ChangeTempoBase.cpp.

55{
56 return Symbol;
57}
static const ComponentInterfaceSymbol Symbol

References Symbol.

◆ GetType()

EffectType ChangeTempoBase::GetType ( ) const
override

Definition at line 71 of file ChangeTempoBase.cpp.

72{
73 return EffectTypeProcess;
74}
@ EffectTypeProcess

References EffectTypeProcess.

◆ Init()

bool ChangeTempoBase::Init ( )
override

Definition at line 94 of file ChangeTempoBase.cpp.

95{
96 // The selection might have changed since the last time ChangeTempoBase
97 // was invoked, so recalculate the Length parameters.
98 m_FromLength = mT1 - mT0;
99 m_ToLength = (m_FromLength * 100.0) / (100.0 + m_PercentChange);
100
101 return true;
102}

References m_FromLength, m_PercentChange, and m_ToLength.

◆ ManualPage()

ManualPageID ChangeTempoBase::ManualPage ( ) const
override

Definition at line 64 of file ChangeTempoBase.cpp.

65{
66 return L"Change_Tempo";
67}

◆ Parameters()

const EffectParameterMethods & ChangeTempoBase::Parameters ( ) const
overrideprotected

Definition at line 25 of file ChangeTempoBase.cpp.

26{
28 return parameters;
29}
Generates EffectParameterMethods overrides from variadic template arguments.

Referenced by ChangeTempoBase().

Here is the caller graph for this function:

◆ Process()

bool ChangeTempoBase::Process ( EffectInstance instance,
EffectSettings settings 
)
override

Already processing; don't make a dialog

Definition at line 104 of file ChangeTempoBase.cpp.

105{
106 bool success = false;
107
108#if USE_SBSMS
109 if (mUseSBSMS)
110 {
111 double tempoRatio = 1.0 + m_PercentChange / 100.0;
112 SBSMSBase proxy;
113 proxy.mProxyEffectName = XO("High Quality Tempo Change");
114 proxy.setParameters(tempoRatio, 1.0);
116 success = Delegate(proxy, settings);
117 }
118 else
119#endif
120 {
121 auto initer = [&](soundtouch::SoundTouch* soundtouch) {
122 soundtouch->setTempoChange(m_PercentChange);
123 };
124 double mT1Dashed = mT0 + (mT1 - mT0) / (m_PercentChange / 100.0 + 1.0);
125 RegionTimeWarper warper {
126 mT0, mT1, std::make_unique<LinearTimeWarper>(mT0, mT0, mT1, mT1Dashed)
127 };
128 success = SoundTouchBase::ProcessWithTimeWarper(initer, warper, false);
129 }
130
131 if (success)
132 mT1 = mT0 + (mT1 - mT0) / (m_PercentChange / 100 + 1.);
133
134 return success;
135}
static Settings & settings()
Definition: TrackInfo.cpp:51
No change before the specified region; during the region, warp according to the given warper; after t...
Definition: TimeWarper.h:192
void setParameters(double rateStart, double rateEnd, double pitchStart, double pitchEnd, SlideType rateSlideType, SlideType pitchSlideType, bool bLinkRatePitch, bool bRateReferenceInput, bool bPitchReferenceInput)
Definition: SBSMSBase.cpp:149
TranslatableString mProxyEffectName
Definition: SBSMSBase.h:41

References m_PercentChange, SBSMSBase::mProxyEffectName, mUseSBSMS, SBSMSBase::setParameters(), settings(), and XO().

Here is the call graph for this function:

◆ SupportsAutomation()

bool ChangeTempoBase::SupportsAutomation ( ) const
override

Definition at line 76 of file ChangeTempoBase.cpp.

77{
78 return true;
79}

Member Data Documentation

◆ m_bLoopDetect

bool ChangeTempoBase::m_bLoopDetect
protected

Definition at line 49 of file ChangeTempoBase.h.

Referenced by ChangeTempoBase().

◆ m_FromBPM

double ChangeTempoBase::m_FromBPM
protected

Definition at line 44 of file ChangeTempoBase.h.

Referenced by ChangeTempoBase().

◆ m_FromLength

double ChangeTempoBase::m_FromLength
protected

Definition at line 46 of file ChangeTempoBase.h.

Referenced by ChangeTempoBase(), and Init().

◆ m_PercentChange

double ChangeTempoBase::m_PercentChange
protected

Definition at line 42 of file ChangeTempoBase.h.

Referenced by CalcPreviewInputLength(), CheckWhetherSkipEffect(), Init(), and Process().

◆ m_ToBPM

double ChangeTempoBase::m_ToBPM
protected

Definition at line 45 of file ChangeTempoBase.h.

Referenced by ChangeTempoBase().

◆ m_ToLength

double ChangeTempoBase::m_ToLength
protected

Definition at line 47 of file ChangeTempoBase.h.

Referenced by ChangeTempoBase(), and Init().

◆ mUseSBSMS

bool ChangeTempoBase::mUseSBSMS
protected

Definition at line 41 of file ChangeTempoBase.h.

Referenced by Process().

◆ Percentage

constexpr EffectParameter ChangeTempoBase::Percentage
staticconstexprprotected
Initial value:
{
&ChangeTempoBase::m_PercentChange, L"Percentage", 0.0, -95.0, 3000.0, 1
}

Definition at line 51 of file ChangeTempoBase.h.

◆ Symbol

const ComponentInterfaceSymbol ChangeTempoBase::Symbol { XO("Change Tempo") }
static

Definition at line 14 of file ChangeTempoBase.h.

Referenced by GetSymbol().

◆ UseSBSMS

constexpr EffectParameter ChangeTempoBase::UseSBSMS
staticconstexprprotected
Initial value:
{
&ChangeTempoBase::mUseSBSMS, L"SBSMS", false, false, true, 1
}

Definition at line 54 of file ChangeTempoBase.h.


The documentation for this class was generated from the following files: