Audacity  2.2.2
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 <wx/arrstr.h>
17 #include <wx/string.h>
18 
19 #include "../widgets/NumericTextCtrl.h"
20 
21 #include "Effect.h"
22 
23 class ShuttleGui;
24 
25 #define CHIRP_PLUGIN_SYMBOL IdentInterfaceSymbol{ XO("Chirp") }
26 #define TONE_PLUGIN_SYMBOL IdentInterfaceSymbol{ XO("Tone") }
27 
28 class EffectToneGen final : public Effect
29 {
30 public:
31  EffectToneGen(bool isChirp);
32  virtual ~EffectToneGen();
33 
34  // IdentInterface implementation
35 
37  wxString GetDescription() override;
38  wxString ManualPage() override;
39 
40  // EffectDefinitionInterface implementation
41 
42  EffectType GetType() override;
43 
44  // EffectClientInterface implementation
45 
46  unsigned GetAudioOutCount() override;
47  bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
48  size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
49  bool DefineParams( ShuttleParams & S ) override;
50  bool GetAutomationParameters(CommandParameters & parms) override;
51  bool SetAutomationParameters(CommandParameters & parms) override;
52 
53  // Effect implementation
54 
55  void PopulateOrExchange(ShuttleGui & S) override;
56  bool TransferDataFromWindow() override;
57  bool TransferDataToWindow() override;
58 
59 private:
60  // EffectToneGen implementation
61 
62  void OnControlUpdate(wxCommandEvent & evt);
63 
64 private:
65  bool mChirp;
66 
67  // mSample is an external placeholder to remember the last "buffer"
68  // position so we use it to reinitialize from where we left
71 
72  // If we made these static variables,
73  // Tone and Chirp would share the same parameters.
74  int mWaveform;
76  double mFrequency[2];
77  double mAmplitude[2];
78  double mLogFrequency[2];
79 
81 
82  DECLARE_EVENT_TABLE()
83 };
84 
85 #endif
int mInterpolation
Definition: ToneGen.h:75
double mLogFrequency[2]
Definition: ToneGen.h:78
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S) override
Definition: ToneGen.cpp:330
bool TransferDataToWindow() override
Definition: ToneGen.cpp:443
double mFrequency[2]
Definition: ToneGen.h:76
wxString ManualPage() override
Definition: ToneGen.cpp:128
bool GetAutomationParameters(CommandParameters &parms) override
Definition: ToneGen.cpp:273
Base class for many of the effects in Audacity.
Definition: Effect.h:62
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override
Definition: ToneGen.cpp:157
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:60
double mPositionInCycles
Definition: ToneGen.h:70
unsigned GetAudioOutCount() override
Definition: ToneGen.cpp:144
sampleCount mSample
Definition: ToneGen.h:69
double mAmplitude[2]
Definition: ToneGen.h:77
bool TransferDataFromWindow() override
Definition: ToneGen.cpp:455
wxString GetDescription() override
Definition: ToneGen.cpp:121
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
IdentInterfaceSymbol pairs a persistent string identifier used internally with an optional...
enum ChannelName * ChannelNames
NumericTextCtrl * mToneDurationT
Definition: ToneGen.h:80
EffectType GetType() override
Definition: ToneGen.cpp:137
EffectToneGen(bool isChirp)
Definition: ToneGen.cpp:86
bool mChirp
Definition: ToneGen.h:65
bool SetAutomationParameters(CommandParameters &parms) override
Definition: ToneGen.cpp:294
void OnControlUpdate(wxCommandEvent &evt)
Definition: ToneGen.cpp:475
EffectType
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap=NULL) override
Definition: ToneGen.cpp:149
bool DefineParams(ShuttleParams &S) override
Definition: ToneGen.cpp:248
virtual ~EffectToneGen()
Definition: ToneGen.cpp:108
int mWaveform
Definition: ToneGen.h:74
IdentInterfaceSymbol GetSymbol() override
Definition: ToneGen.cpp:114
An Effect that can generate a sine, square or sawtooth wave. An extended mode of EffectToneGen suppor...
Definition: ToneGen.h:28