Audacity  3.0.3
ToneGen.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ToneGen.h
6 
7  Steve Jolly
8 
9  This class implements a tone generator effect.
10 
11 **********************************************************************/
12 
13 #ifndef __AUDACITY_EFFECT_TONEGEN__
14 #define __AUDACITY_EFFECT_TONEGEN__
15 
16 #include "Effect.h"
17 
18 class NumericTextCtrl;
19 class ShuttleGui;
20 
21 class EffectToneGen : public Effect
22 {
23 public:
24  EffectToneGen(bool isChirp);
25  virtual ~EffectToneGen();
26 
27  // ComponentInterface implementation
28 
31  ManualPageID ManualPage() override;
32 
33  // EffectDefinitionInterface implementation
34 
35  EffectType GetType() override;
36 
37  // EffectClientInterface implementation
38 
39  unsigned GetAudioOutCount() override;
40  bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
41  size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
42  bool DefineParams( ShuttleParams & S ) override;
43  bool GetAutomationParameters(CommandParameters & parms) override;
44  bool SetAutomationParameters(CommandParameters & parms) override;
45 
46  // Effect implementation
47 
48  void PopulateOrExchange(ShuttleGui & S) override;
49  bool TransferDataFromWindow() override;
50  bool TransferDataToWindow() override;
51 
52 private:
53  // EffectToneGen implementation
54 
55  void OnControlUpdate(wxCommandEvent & evt);
56 
57 private:
58  bool mChirp;
59 
60  // mSample is an external placeholder to remember the last "buffer"
61  // position so we use it to reinitialize from where we left
64 
65  // If we made these static variables,
66  // Tone and Chirp would share the same parameters.
67  int mWaveform;
69  double mFrequency[2];
70  double mAmplitude[2];
71  double mLogFrequency[2];
72 
74 
75  DECLARE_EVENT_TABLE()
76 };
77 
78 class EffectChirp final : public EffectToneGen
79 {
80 public:
82 
83  EffectChirp() : EffectToneGen{ true } {}
84 };
85 
86 
87 class EffectTone final : public EffectToneGen
88 {
89 public:
91 
92  EffectTone() : EffectToneGen{ false } {}
93 };
94 
95 #endif
EffectToneGen::mSample
sampleCount mSample
Definition: ToneGen.h:62
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
EffectToneGen::OnControlUpdate
void OnControlUpdate(wxCommandEvent &evt)
Definition: ToneGen.cpp:517
Effect.h
EffectToneGen::GetDescription
TranslatableString GetDescription() override
Definition: ToneGen.cpp:137
EffectToneGen::ProcessInitialize
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap=NULL) override
Definition: ToneGen.cpp:165
Effect
Base class for many of the effects in Audacity.
Definition: Effect.h:72
EffectToneGen::GetType
EffectType GetType() override
Definition: ToneGen.cpp:153
EffectTone::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: ToneGen.h:90
EffectToneGen::mChirp
bool mChirp
Definition: ToneGen.h:58
EffectToneGen::EffectToneGen
EffectToneGen(bool isChirp)
Definition: ToneGen.cpp:102
EffectToneGen::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: ToneGen.cpp:320
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:62
EffectToneGen::mToneDurationT
NumericTextCtrl * mToneDurationT
Definition: ToneGen.h:73
EffectChirp
Definition: ToneGen.h:79
NumericTextCtrl
Definition: NumericTextCtrl.h:172
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectToneGen::~EffectToneGen
virtual ~EffectToneGen()
Definition: ToneGen.cpp:124
EffectToneGen::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: ToneGen.cpp:274
EffectChirp::EffectChirp
EffectChirp()
Definition: ToneGen.h:83
EffectToneGen::mWaveform
int mWaveform
Definition: ToneGen.h:67
EffectToneGen::mLogFrequency
double mLogFrequency[2]
Definition: ToneGen.h:71
EffectChirp::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: ToneGen.h:81
EffectTone::EffectTone
EffectTone()
Definition: ToneGen.h:92
EffectToneGen::mFrequency
double mFrequency[2]
Definition: ToneGen.h:69
EffectToneGen::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: ToneGen.cpp:360
ChannelNames
enum ChannelName * ChannelNames
EffectToneGen::TransferDataToWindow
bool TransferDataToWindow() override
Definition: ToneGen.cpp:485
EffectToneGen::mInterpolation
int mInterpolation
Definition: ToneGen.h:68
EffectToneGen::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: ToneGen.cpp:130
EffectToneGen
An Effect that can generate a sine, square or sawtooth wave. An extended mode of EffectToneGen suppor...
Definition: ToneGen.h:22
EffectToneGen::mPositionInCycles
double mPositionInCycles
Definition: ToneGen.h:63
TaggedIdentifier< ManualPageIDTag >
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
EffectToneGen::GetAudioOutCount
unsigned GetAudioOutCount() override
Definition: ToneGen.cpp:160
EffectToneGen::ProcessBlock
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override
Definition: ToneGen.cpp:173
EffectToneGen::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: ToneGen.cpp:497
EffectToneGen::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: ToneGen.cpp:299
EffectType
EffectType
Definition: EffectInterface.h:55
EffectToneGen::mAmplitude
double mAmplitude[2]
Definition: ToneGen.h:70
EffectTone
Definition: ToneGen.h:88
EffectToneGen::ManualPage
ManualPageID ManualPage() override
Definition: ToneGen.cpp:144
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631