Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
ToneGenBase Class Reference

An Effect that can generate a sine, square or sawtooth wave. An extended mode of ToneGenBase supports 'chirps' where the frequency changes smoothly during the tone. More...

#include <ToneGenBase.h>

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

Public Member Functions

 ToneGenBase (bool isChirp)
 
virtual ~ToneGenBase ()
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
unsigned GetAudioOutCount () const override
 How many output buffers to allocate at once. More...
 
bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap) override
 
size_t ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
 Called for destructive effect computation. More...
 
- Public Member Functions inherited from StatefulPerTrackEffect
 ~StatefulPerTrackEffect () override
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
size_t SetBlockSize (size_t maxBlockSize) override
 
size_t GetBlockSize () const override
 
bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr) override
 
bool ProcessFinalize () noexcept override
 
virtual size_t ProcessBlock (EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen)=0
 Called for destructive effect computation. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (MessagePackage &package)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
virtual unsigned GetAudioInCount () const
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const
 How many output buffers to allocate at once. More...
 
virtual sampleCount GetLatency () const
 
virtual bool NeedsDither () const
 
virtual bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr)
 
virtual bool ProcessFinalize () noexcept
 
- Public Member Functions inherited from PerTrackEffect
 ~PerTrackEffect () override
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatID GetSelectionFormat ()
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings, InstanceFinder finder={})
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
bool IsLinearEffect () const
 
bool PreviewsFullSelection () const
 
void SetTracks (TrackList *pTracks)
 
double GetDefaultDuration ()
 
virtual std::any BeginPreview (const EffectSettings &settings)
 Called when Preview() starts, to allow temporary effect state changes. More...
 
bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void CountWaveTracks ()
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual bool HasOptions () const =0
 
virtual bool CanExportPresets () const =0
 Whether the effect supports export of presets to files, and importing too. More...
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual EffectSettings MakeSettings () const
 
virtual bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const
 Update one settings object from another. More...
 
virtual std::unique_ptr< EffectOutputsMakeOutputs () const
 Produce an object to hold values to send to effect output meters. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Static Public Member Functions

static ToneGenBaseFetchParameters (ToneGenBase &e, EffectSettings &)
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
- Static Public Member Functions inherited from EffectBase
static std::optional< InstancePointerFindInstance (EffectPlugin &plugin)
 
static InstanceFinder DefaultInstanceFinder (EffectPlugin &plugin)
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 

Protected Types

enum  kWaveforms {
  kSine , kSquare , kSawtooth , kSquareNoAlias ,
  kTriangle , nWaveforms
}
 
enum  kInterpolations { kLinear , kLogarithmic , nInterpolations }
 

Protected Attributes

double mSampleRate {}
 
const bool mChirp
 
int mWaveform
 
int mInterpolation
 
double mFrequency0
 
double mFrequency1
 
double mAmplitude0
 
double mAmplitude1
 
- Protected Attributes inherited from PerTrackEffect
sampleCount mSampleCnt {}
 
- Protected Attributes inherited from EffectBase
double mF0 {}
 
double mF1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 

Static Protected Attributes

static const EnumValueSymbol kWaveStrings [nWaveforms]
 
static const EnumValueSymbol kInterStrings [nInterpolations]
 
static constexpr EffectParameter StartFreq
 
static constexpr EffectParameter EndFreq
 
static constexpr EffectParameter StartAmp
 
static constexpr EffectParameter EndAmp
 
static constexpr EffectParameter Frequency
 
static constexpr EffectParameter Amplitude
 
static constexpr EnumParameter Waveform
 
static constexpr EnumParameter Interp
 

Private Member Functions

void PostSet ()
 
const EffectParameterMethodsParameters () const override
 

Private Attributes

sampleCount mSample
 
double mPositionInCycles
 
double mLogFrequency [2]
 

Additional Inherited Members

- Public Types inherited from StatefulEffectBase
using MessagePackage = EffectInstance::MessagePackage
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
using InstancePointer = std::shared_ptr< EffectInstanceEx >
 
using InstanceFinder = std::function< std::optional< InstancePointer >(EffectSettings &settings) >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , After_3_1 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Public Attributes inherited from EffectBase
std::shared_ptr< TrackListmTracks {}
 
int mNumTracks {}
 
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
double mT0 {}
 
double mT1 {}
 
bool mIsPreview { false }
 
- Static Public Attributes inherited from EffectPlugin
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 
- Protected Member Functions inherited from PerTrackEffect
bool DoPass1 () const
 
bool DoPass2 () const
 
bool Process (EffectInstance &instance, EffectSettings &settings) const
 
std::shared_ptr< EffectOutputTracksMakeOutputTracks ()
 
void DestroyOutputTracks () const
 
- Protected Member Functions inherited from Effect
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, sampleCount *start, sampleCount *len)
 
- Protected Member Functions inherited from EffectBase
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 

Detailed Description

An Effect that can generate a sine, square or sawtooth wave. An extended mode of ToneGenBase supports 'chirps' where the frequency changes smoothly during the tone.

Definition at line 21 of file ToneGenBase.h.

Member Enumeration Documentation

◆ kInterpolations

Enumerator
kLinear 
kLogarithmic 
nInterpolations 

Definition at line 83 of file ToneGenBase.h.

84 {
85 kLinear,
88 };

◆ kWaveforms

enum ToneGenBase::kWaveforms
protected
Enumerator
kSine 
kSquare 
kSawtooth 
kSquareNoAlias 
kTriangle 
nWaveforms 

Definition at line 71 of file ToneGenBase.h.

Constructor & Destructor Documentation

◆ ToneGenBase()

ToneGenBase::ToneGenBase ( bool  isChirp)

Definition at line 60 of file ToneGenBase.cpp.

61 : mChirp { isChirp }
62{
63 Parameters().Reset(*this);
64
65 wxASSERT(nWaveforms == WXSIZEOF(kWaveStrings));
66 wxASSERT(nInterpolations == WXSIZEOF(kInterStrings));
67
68 // Chirp varies over time so must use selected duration.
69 // TODO: When previewing, calculate only the first 'preview length'.
70 if (isChirp)
72 else
74}
void SetLinearEffectFlag(bool linearEffectFlag)
Definition: EffectBase.cpp:210
virtual void Reset(Effect &effect) const =0
static const EnumValueSymbol kInterStrings[nInterpolations]
Definition: ToneGenBase.h:90
const bool mChirp
Definition: ToneGenBase.h:45
const EffectParameterMethods & Parameters() const override
Definition: ToneGenBase.cpp:40
static const EnumValueSymbol kWaveStrings[nWaveforms]
Definition: ToneGenBase.h:81

References kInterStrings, kWaveStrings, nInterpolations, nWaveforms, Parameters(), EffectParameterMethods::Reset(), and EffectBase::SetLinearEffectFlag().

Referenced by Parameters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~ToneGenBase()

ToneGenBase::~ToneGenBase ( )
virtual

Definition at line 76 of file ToneGenBase.cpp.

77{
78}

Member Function Documentation

◆ FetchParameters()

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

Definition at line 24 of file ToneGenBase.h.

25 {
26 return &e;
27 }

◆ GetAudioOutCount()

unsigned ToneGenBase::GetAudioOutCount ( ) const
overridevirtual

How many output buffers to allocate at once.

The result is not necessarily well defined before RealtimeInitialize Default implementation returns 0

Reimplemented from StatefulEffectBase.

Definition at line 87 of file ToneGenBase.cpp.

88{
89 return 1;
90}

◆ GetType()

EffectType ToneGenBase::GetType ( ) const
overridevirtual

Type determines how it behaves.

Implements EffectDefinitionInterface.

Definition at line 82 of file ToneGenBase.cpp.

83{
84 return EffectTypeGenerate;
85}
@ EffectTypeGenerate

References EffectTypeGenerate.

◆ Parameters()

const EffectParameterMethods & ToneGenBase::Parameters ( ) const
overrideprivatevirtual

Reimplemented from Effect.

Definition at line 40 of file ToneGenBase.cpp.

41{
42 static const auto postSet = [](ToneGenBase&, EffectSettings&, ToneGenBase& e,
43 bool updating) {
44 if (updating)
45 e.PostSet();
46 return true;
47 };
48 static CapturedParameters<
50 chirpParameters { postSet };
51 static CapturedParameters<
53 toneParameters { postSet };
54 if (mChirp)
55 return chirpParameters;
56 else
57 return toneParameters;
58}
Generates EffectParameterMethods overrides from variadic template arguments.
An Effect that can generate a sine, square or sawtooth wave. An extended mode of ToneGenBase supports...
Definition: ToneGenBase.h:22
static constexpr EffectParameter StartAmp
Definition: ToneGenBase.h:99
static constexpr EffectParameter StartFreq
Definition: ToneGenBase.h:93
static constexpr EffectParameter Frequency
Definition: ToneGenBase.h:105
static constexpr EnumParameter Interp
Definition: ToneGenBase.h:119
static constexpr EffectParameter EndAmp
Definition: ToneGenBase.h:102
static constexpr EnumParameter Waveform
Definition: ToneGenBase.h:111
static constexpr EffectParameter Amplitude
Definition: ToneGenBase.h:108
ToneGenBase(bool isChirp)
Definition: ToneGenBase.cpp:60
static constexpr EffectParameter EndFreq
Definition: ToneGenBase.h:96
Externalized state of a plug-in.

References Amplitude, EndAmp, EndFreq, Frequency, Interp, mChirp, StartAmp, StartFreq, ToneGenBase(), and Waveform.

Referenced by ToneGenBase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PostSet()

void ToneGenBase::PostSet ( )
private

Definition at line 213 of file ToneGenBase.cpp.

214{
215 if (!mChirp)
216 {
219 }
220 // double freqMax =
221 // (FindProject()
222 // ? ProjectRate::Get( *FindProject() ).GetRate()
223 // : 44100.0)
224 // / 2.0;
225 // mFrequency1 = std::clamp<double>(mFrequency1, EndFreq.min, freqMax);
226}
double mAmplitude1
Definition: ToneGenBase.h:61
double mFrequency0
Definition: ToneGenBase.h:58
double mFrequency1
Definition: ToneGenBase.h:59
double mAmplitude0
Definition: ToneGenBase.h:60

References mAmplitude0, mAmplitude1, mChirp, mFrequency0, and mFrequency1.

◆ ProcessBlock()

size_t ToneGenBase::ProcessBlock ( EffectSettings settings,
const float *const *  inBlock,
float *const *  outBlock,
size_t  blockLen 
)
overridevirtual

Called for destructive effect computation.

Implements StatefulPerTrackEffect.

Definition at line 101 of file ToneGenBase.cpp.

104{
105 float* buffer = outBlock[0];
106 double throwaway = 0; // passed to modf but never used
107 double f = 0.0;
108 double a, b;
109 int k;
110
111 double frequencyQuantum;
112 double BlendedFrequency;
113 double BlendedAmplitude;
114 double BlendedLogFrequency = 0.0;
115
116 // calculate delta, and reposition from where we left
117 auto doubleSampleCount = mSampleCnt.as_double();
118 auto doubleSample = mSample.as_double();
119 double amplitudeQuantum = (mAmplitude1 - mAmplitude0) / doubleSampleCount;
120 BlendedAmplitude = mAmplitude0 + amplitudeQuantum * doubleSample;
121
122 // precalculations:
123 double pre2PI = 2.0 * M_PI;
124 double pre4divPI = 4.0 / M_PI;
125
126 // initial setup should calculate deltas
128 {
129 // this for log interpolation
130 mLogFrequency[0] = log10(mFrequency0);
131 mLogFrequency[1] = log10(mFrequency1);
132 // calculate delta, and reposition from where we left
133 frequencyQuantum =
134 (mLogFrequency[1] - mLogFrequency[0]) / doubleSampleCount;
135 BlendedLogFrequency = mLogFrequency[0] + frequencyQuantum * doubleSample;
136 BlendedFrequency = pow(10.0, BlendedLogFrequency);
137 }
138 else
139 {
140 // this for regular case, linear interpolation
141 frequencyQuantum = (mFrequency1 - mFrequency0) / doubleSampleCount;
142 BlendedFrequency = mFrequency0 + frequencyQuantum * doubleSample;
143 }
144
145 // synth loop
146 for (decltype(blockLen) i = 0; i < blockLen; i++)
147 {
148 switch (mWaveform)
149 {
150 case kSine:
151 f = sin(pre2PI * mPositionInCycles / mSampleRate);
152 break;
153 case kSquare:
154 f = (modf(mPositionInCycles / mSampleRate, &throwaway) < 0.5) ? 1.0 :
155 -1.0;
156 break;
157 case kSawtooth:
158 f = (2.0 * modf(mPositionInCycles / mSampleRate + 0.5, &throwaway)) -
159 1.0;
160 break;
161 case kTriangle:
162 f = modf(mPositionInCycles / mSampleRate, &throwaway);
163 if (f < 0.25)
164 {
165 f *= 4.0;
166 }
167 else if (f > 0.75)
168 {
169 f = (f - 1.0) * 4.0;
170 }
171 else
172 { /* f >= 0.25 || f <= 0.75 */
173 f = (0.5 - f) * 4.0;
174 }
175 break;
176 case kSquareNoAlias: // Good down to 110Hz @ 44100Hz sampling.
177 // do fundamental (k=1) outside loop
178 b = (1.0 + cos((pre2PI * BlendedFrequency) / mSampleRate)) /
179 pre4divPI; // scaling
180 f = pre4divPI * sin(pre2PI * mPositionInCycles / mSampleRate);
181 for (k = 3; (k < 200) && (k * BlendedFrequency < mSampleRate / 2.0);
182 k += 2)
183 {
184 // Hann Window in freq domain
185 a = 1.0 + cos((pre2PI * k * BlendedFrequency) / mSampleRate);
186 // calc harmonic, apply window, scale to amplitude of fundamental
187 f +=
188 a * sin(pre2PI * mPositionInCycles / mSampleRate * k) / (b * k);
189 }
190 }
191 // insert value in buffer
192 buffer[i] = (float)(BlendedAmplitude * f);
193 // update freq,amplitude
194 mPositionInCycles += BlendedFrequency;
195 BlendedAmplitude += amplitudeQuantum;
197 {
198 BlendedLogFrequency += frequencyQuantum;
199 BlendedFrequency = pow(10.0, BlendedLogFrequency);
200 }
201 else
202 {
203 BlendedFrequency += frequencyQuantum;
204 }
205 }
206
207 // update external placeholder
208 mSample += blockLen;
209
210 return blockLen;
211}
#define M_PI
Definition: Distortion.cpp:22
sampleCount mSampleCnt
double mLogFrequency[2]
Definition: ToneGenBase.h:64
sampleCount mSample
Definition: ToneGenBase.h:50
double mSampleRate
Definition: ToneGenBase.h:44
int mInterpolation
Definition: ToneGenBase.h:57
double mPositionInCycles
Definition: ToneGenBase.h:51
double as_double() const
Definition: SampleCount.h:46

References sampleCount::as_double(), kLogarithmic, kSawtooth, kSine, kSquare, kSquareNoAlias, kTriangle, M_PI, mAmplitude0, mAmplitude1, mFrequency0, mFrequency1, mInterpolation, mLogFrequency, mPositionInCycles, mSample, PerTrackEffect::mSampleCnt, mSampleRate, and mWaveform.

Here is the call graph for this function:

◆ ProcessInitialize()

bool ToneGenBase::ProcessInitialize ( EffectSettings settings,
double  sampleRate,
ChannelNames  chanMap 
)
overridevirtual

Called at start of destructive processing, for each (mono/stereo) track Default implementation does nothing, returns true

Parameters
chanMapnull or array terminated with ChannelNameEOL. Do not retain the pointer
Postcondition
GetAudioInCount() and GetAudioOutCount() are well defined

Reimplemented from StatefulEffectBase.

Definition at line 92 of file ToneGenBase.cpp.

94{
97 mSample = 0;
98 return true;
99}

References mPositionInCycles, mSample, mSampleRate, and anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.

Member Data Documentation

◆ Amplitude

constexpr EffectParameter ToneGenBase::Amplitude
staticconstexprprotected
Initial value:
{
&ToneGenBase::mAmplitude0, L"Amplitude", 0.8, 0.0, 1.0, 1
}

Definition at line 108 of file ToneGenBase.h.

Referenced by Parameters(), and EffectToneGen::PopulateOrExchange().

◆ EndAmp

constexpr EffectParameter ToneGenBase::EndAmp
staticconstexprprotected
Initial value:
{
&ToneGenBase::mAmplitude1, L"EndAmp", 0.1, 0.0, 1.0, 1
}

Definition at line 102 of file ToneGenBase.h.

Referenced by Parameters(), and EffectToneGen::PopulateOrExchange().

◆ EndFreq

constexpr EffectParameter ToneGenBase::EndFreq
staticconstexprprotected
Initial value:
{
&ToneGenBase::mFrequency1, L"EndFreq", 1320.0, 1.0, DBL_MAX, 1
}

Definition at line 96 of file ToneGenBase.h.

Referenced by Parameters(), and EffectToneGen::PopulateOrExchange().

◆ Frequency

constexpr EffectParameter ToneGenBase::Frequency
staticconstexprprotected
Initial value:
{
&ToneGenBase::mFrequency0, L"Frequency", 440.0, 1.0, DBL_MAX, 1
}

Definition at line 105 of file ToneGenBase.h.

Referenced by Parameters(), and EffectToneGen::PopulateOrExchange().

◆ Interp

constexpr EnumParameter ToneGenBase::Interp
staticconstexprprotected
Initial value:

Definition at line 119 of file ToneGenBase.h.

Referenced by Parameters().

◆ kInterStrings

const EnumValueSymbol ToneGenBase::kInterStrings
staticprotected
Initial value:
= {
{ XO("Linear") },
{ XO("Logarithmic") }
}
XO("Cut/Copy/Paste")

Definition at line 90 of file ToneGenBase.h.

Referenced by EffectToneGen::PopulateOrExchange(), and ToneGenBase().

◆ kWaveStrings

const EnumValueSymbol ToneGenBase::kWaveStrings
staticprotected
Initial value:
= {
{ XO("Sine") },
{ XO("Square") },
{ XO("Sawtooth") },
{ XO("Square, no alias") },
{ XC("Triangle", "waveform") }
}
#define XC(s, c)
Definition: Internat.h:37

Definition at line 81 of file ToneGenBase.h.

Referenced by EffectToneGen::PopulateOrExchange(), and ToneGenBase().

◆ mAmplitude0

double ToneGenBase::mAmplitude0
protected

◆ mAmplitude1

double ToneGenBase::mAmplitude1
protected

◆ mChirp

const bool ToneGenBase::mChirp
protected

◆ mFrequency0

double ToneGenBase::mFrequency0
protected

◆ mFrequency1

double ToneGenBase::mFrequency1
protected

◆ mInterpolation

int ToneGenBase::mInterpolation
protected

Definition at line 57 of file ToneGenBase.h.

Referenced by EffectToneGen::PopulateOrExchange(), and ProcessBlock().

◆ mLogFrequency

double ToneGenBase::mLogFrequency[2]
private

Definition at line 64 of file ToneGenBase.h.

Referenced by ProcessBlock().

◆ mPositionInCycles

double ToneGenBase::mPositionInCycles
private

Definition at line 51 of file ToneGenBase.h.

Referenced by ProcessBlock(), and ProcessInitialize().

◆ mSample

sampleCount ToneGenBase::mSample
private

Definition at line 50 of file ToneGenBase.h.

Referenced by ProcessBlock(), and ProcessInitialize().

◆ mSampleRate

double ToneGenBase::mSampleRate {}
protected

Definition at line 44 of file ToneGenBase.h.

Referenced by ProcessBlock(), and ProcessInitialize().

◆ mWaveform

int ToneGenBase::mWaveform
protected

Definition at line 56 of file ToneGenBase.h.

Referenced by EffectToneGen::PopulateOrExchange(), and ProcessBlock().

◆ StartAmp

constexpr EffectParameter ToneGenBase::StartAmp
staticconstexprprotected
Initial value:
{
&ToneGenBase::mAmplitude0, L"StartAmp", 0.8, 0.0, 1.0, 1
}

Definition at line 99 of file ToneGenBase.h.

Referenced by Parameters(), and EffectToneGen::PopulateOrExchange().

◆ StartFreq

constexpr EffectParameter ToneGenBase::StartFreq
staticconstexprprotected
Initial value:
{
&ToneGenBase::mFrequency0, L"StartFreq", 440.0, 1.0, DBL_MAX, 1
}

Definition at line 93 of file ToneGenBase.h.

Referenced by Parameters(), and EffectToneGen::PopulateOrExchange().

◆ Waveform

constexpr EnumParameter ToneGenBase::Waveform
staticconstexprprotected
Initial value:
L"Waveform",
0,
0,
1,

Definition at line 111 of file ToneGenBase.h.

Referenced by Parameters().


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