Audacity  3.0.3
DtmfGen.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  DtmfGen.h
6 
7  Salvo Ventura
8  Dec 2006
9 
10  An effect that generates DTMF tones
11 
12 **********************************************************************/
13 
14 #ifndef __AUDACITY_EFFECT_DTMF__
15 #define __AUDACITY_EFFECT_DTMF__
16 
17 #include "Effect.h"
18 
19 class wxSlider;
20 class wxStaticText;
21 class wxTextCtrl;
22 class NumericTextCtrl;
23 class ShuttleGui;
24 
25 class EffectDtmf final : public Effect
26 {
27 public:
29 
30  EffectDtmf();
31  virtual ~EffectDtmf();
32 
33  // ComponentInterface implementation
34 
37  ManualPageID ManualPage() override;
38 
39  // EffectDefinitionInterface implementation
40 
41  EffectType GetType() override;
42 
43  // EffectClientInterface implementation
44 
45  unsigned GetAudioOutCount() override;
46  bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
47  size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
48  bool DefineParams( ShuttleParams & S ) override;
49  bool GetAutomationParameters(CommandParameters & parms) override;
50  bool SetAutomationParameters(CommandParameters & parms) override;
51 
52  // Effect implementation
53 
54  bool Startup() override;
55  bool Init() override;
56  void PopulateOrExchange(ShuttleGui & S) override;
57  bool TransferDataFromWindow() override;
58  bool TransferDataToWindow() override;
59 
60 private:
61  // EffectDtmf implementation
62 
63  bool MakeDtmfTone(float *buffer, size_t len, float fs,
64  wxChar tone, sampleCount last,
65  sampleCount total, float amplitude);
66  void Recalculate();
67 
68  void UpdateUI();
69 
70  void OnSequence(wxCommandEvent & evt);
71  void OnAmplitude(wxCommandEvent & evt);
72  void OnDuration(wxCommandEvent & evt);
73  void OnDutyCycle(wxCommandEvent & evt);
74 
75 private:
76  sampleCount numSamplesSequence; // total number of samples to generate
77  sampleCount numSamplesTone; // number of samples in a tone block
78  sampleCount numSamplesSilence; // number of samples in a silence block
79  sampleCount diff; // number of extra samples to redistribute
80  sampleCount numRemaining; // number of samples left to produce in the current block
81  sampleCount curTonePos; // position in tone to start the wave
82  bool isTone; // true if block is tone, otherwise silence
83  int curSeqPos; // index into dtmf tone string
84 
85  wxString dtmfSequence; // dtmf tone string
86  int dtmfNTones; // total number of tones to generate
87  double dtmfTone; // duration of a single tone in ms
88  double dtmfSilence; // duration of silence between tones in ms
89  double dtmfDutyCycle; // ratio of dtmfTone/(dtmfTone+dtmfSilence)
90  double dtmfAmplitude; // amplitude of dtmf tone sequence, restricted to (0-1)
91 
92  wxTextCtrl *mDtmfSequenceT;
93  wxTextCtrl *mDtmfAmplitudeT;
94  wxSlider *mDtmfDutyCycleS;
96  wxStaticText *mDtmfToneT;
97  wxStaticText *mDtmfSilenceT;
98  wxStaticText *mDtmfDutyT;
99 
100  DECLARE_EVENT_TABLE()
101 };
102 
103 #endif
EffectDtmf::mDtmfSilenceT
wxStaticText * mDtmfSilenceT
Definition: DtmfGen.h:97
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
EffectDtmf::Init
bool Init() override
Definition: DtmfGen.cpp:321
CommandParameters
CommandParameters, derived from wxFileConfig, is essentially doing the same things as the Shuttle cla...
Definition: EffectAutomationParameters.h:67
EffectDtmf::isTone
bool isTone
Definition: DtmfGen.h:82
Effect.h
EffectDtmf::SetAutomationParameters
bool SetAutomationParameters(CommandParameters &parms) override
Definition: DtmfGen.cpp:264
Effect
Base class for many of the effects in Audacity.
Definition: Effect.h:72
EffectDtmf::dtmfNTones
int dtmfNTones
Definition: DtmfGen.h:86
EffectDtmf::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: DtmfGen.h:28
EffectDtmf::dtmfAmplitude
double dtmfAmplitude
Definition: DtmfGen.h:90
EffectDtmf::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition: DtmfGen.cpp:414
EffectDtmf::~EffectDtmf
virtual ~EffectDtmf()
Definition: DtmfGen.cpp:97
ShuttleParams
Shuttle that deals with parameters. This is a base class with lots of virtual functions that do nothi...
Definition: Shuttle.h:62
EffectDtmf::GetType
EffectType GetType() override
Definition: DtmfGen.cpp:120
EffectDtmf::numSamplesTone
sampleCount numSamplesTone
Definition: DtmfGen.h:77
EffectDtmf::mDtmfSequenceT
wxTextCtrl * mDtmfSequenceT
Definition: DtmfGen.h:92
NumericTextCtrl
Definition: NumericTextCtrl.h:172
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
EffectDtmf::mDtmfDurationT
NumericTextCtrl * mDtmfDurationT
Definition: DtmfGen.h:95
EffectDtmf::OnAmplitude
void OnAmplitude(wxCommandEvent &evt)
Definition: DtmfGen.cpp:620
EffectDtmf::dtmfSequence
wxString dtmfSequence
Definition: DtmfGen.h:85
EffectDtmf::curTonePos
sampleCount curTonePos
Definition: DtmfGen.h:81
EffectDtmf::GetDescription
TranslatableString GetDescription() override
Definition: DtmfGen.cpp:108
EffectDtmf::diff
sampleCount diff
Definition: DtmfGen.h:79
EffectDtmf::GetSymbol
ComponentInterfaceSymbol GetSymbol() override
Definition: DtmfGen.cpp:103
EffectDtmf::dtmfSilence
double dtmfSilence
Definition: DtmfGen.h:88
EffectDtmf::mDtmfAmplitudeT
wxTextCtrl * mDtmfAmplitudeT
Definition: DtmfGen.h:93
EffectDtmf::dtmfTone
double dtmfTone
Definition: DtmfGen.h:87
EffectDtmf::GetAutomationParameters
bool GetAutomationParameters(CommandParameters &parms) override
Definition: DtmfGen.cpp:255
EffectDtmf::GetAudioOutCount
unsigned GetAudioOutCount() override
Definition: DtmfGen.cpp:127
EffectDtmf::Recalculate
void Recalculate()
Definition: DtmfGen.cpp:433
EffectDtmf::ProcessInitialize
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap=NULL) override
Definition: DtmfGen.cpp:132
EffectDtmf::mDtmfDutyCycleS
wxSlider * mDtmfDutyCycleS
Definition: DtmfGen.h:94
ChannelNames
enum ChannelName * ChannelNames
EffectDtmf::MakeDtmfTone
bool MakeDtmfTone(float *buffer, size_t len, float fs, wxChar tone, sampleCount last, sampleCount total, float amplitude)
Definition: DtmfGen.cpp:475
EffectDtmf::EffectDtmf
EffectDtmf()
Definition: DtmfGen.cpp:88
EffectDtmf::TransferDataToWindow
bool TransferDataToWindow() override
Definition: DtmfGen.cpp:396
EffectDtmf::numRemaining
sampleCount numRemaining
Definition: DtmfGen.h:80
EffectDtmf::mDtmfToneT
wxStaticText * mDtmfToneT
Definition: DtmfGen.h:96
TaggedIdentifier< ManualPageIDTag >
sampleCount
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:18
EffectDtmf
An effect that generates DTMF tones.
Definition: DtmfGen.h:26
EffectDtmf::dtmfDutyCycle
double dtmfDutyCycle
Definition: DtmfGen.h:89
EffectDtmf::ProcessBlock
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override
Definition: DtmfGen.cpp:182
EffectDtmf::ManualPage
ManualPageID ManualPage() override
Definition: DtmfGen.cpp:113
EffectDtmf::curSeqPos
int curSeqPos
Definition: DtmfGen.h:83
EffectDtmf::OnDuration
void OnDuration(wxCommandEvent &evt)
Definition: DtmfGen.cpp:629
EffectDtmf::DefineParams
bool DefineParams(ShuttleParams &S) override
Definition: DtmfGen.cpp:248
EffectDtmf::numSamplesSequence
sampleCount numSamplesSequence
Definition: DtmfGen.h:76
EffectType
EffectType
Definition: EffectInterface.h:55
EffectDtmf::OnDutyCycle
void OnDutyCycle(wxCommandEvent &evt)
Definition: DtmfGen.cpp:636
EffectDtmf::mDtmfDutyT
wxStaticText * mDtmfDutyT
Definition: DtmfGen.h:98
EffectDtmf::numSamplesSilence
sampleCount numSamplesSilence
Definition: DtmfGen.h:78
EffectDtmf::OnSequence
void OnSequence(wxCommandEvent &evt)
Definition: DtmfGen.cpp:613
EffectDtmf::Startup
bool Startup() override
Definition: DtmfGen.cpp:292
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
EffectDtmf::UpdateUI
void UpdateUI()
Definition: DtmfGen.cpp:601
EffectDtmf::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S) override
Definition: DtmfGen.cpp:328