Audacity 3.2.0
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
18#include "ShuttleAutomation.h"
19
20class wxSlider;
21class wxStaticText;
22class wxTextCtrl;
23class NumericTextCtrl;
24class ShuttleGui;
25
27 static constexpr wchar_t DefaultSequence[] = L"audacity";
28 static constexpr double DefaultDutyCycle = 55.0;
29 static constexpr double DefaultAmplitude = 0.8;
30
31 wxString dtmfSequence{DefaultSequence}; // dtmf tone string
32 size_t dtmfNTones = dtmfSequence.length(); // total number of tones to generate
33 double dtmfTone{}; // duration of a single tone in ms
34 double dtmfSilence{}; // duration of silence between tones in ms
35 double dtmfDutyCycle{DefaultDutyCycle}; // ratio of dtmfTone/(dtmfTone+dtmfSilence)
36 double dtmfAmplitude{DefaultAmplitude}; // amplitude of dtmf tone sequence, restricted to (0-1)
37
39};
40
41class EffectDtmf final
42 : public EffectWithSettings<DtmfSettings, StatelessPerTrackEffect>
43{
44public:
46
47 EffectDtmf();
48 virtual ~EffectDtmf();
49
50 // ComponentInterface implementation
51
52 ComponentInterfaceSymbol GetSymbol() const override;
53 TranslatableString GetDescription() const override;
54 ManualPageID ManualPage() const override;
55
56 // EffectDefinitionInterface implementation
57
58 EffectType GetType() const override;
59
60 // Effect implementation
61
62 std::unique_ptr<EffectEditor> MakeEditor(
63 ShuttleGui & S, EffectInstance &instance,
64 EffectSettingsAccess &access, const EffectOutputs *pOutputs)
65 const override;
66
67 struct Instance;
68 std::shared_ptr<EffectInstance> MakeInstance() const override;
69
70private:
71 // EffectDtmf implementation
72
73 static bool MakeDtmfTone(float *buffer, size_t len, float fs,
74 wxChar tone, sampleCount last,
75 sampleCount total, float amplitude);
76
77public:
78 struct Editor;
79
80private:
81 const EffectParameterMethods& Parameters() const override;
82
84 L"Sequence", DtmfSettings::DefaultSequence, L"", L"", L""};
86 L"Duty Cycle", DtmfSettings::DefaultDutyCycle, 0.0, 100.0, 10.0 };
88 L"Amplitude", DtmfSettings::DefaultAmplitude, 0.001, 1.0, 1 };
89};
90
91#endif
EffectType
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:69
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
An effect that generates DTMF tones.
Definition: DtmfGen.h:43
EffectDtmf()
Definition: DtmfGen.cpp:90
const EffectParameterMethods & Parameters() const override
Definition: DtmfGen.cpp:36
virtual ~EffectDtmf()
Definition: DtmfGen.cpp:94
TranslatableString GetDescription() const override
Definition: DtmfGen.cpp:105
static constexpr EffectParameter Amplitude
Definition: DtmfGen.h:87
std::unique_ptr< EffectEditor > MakeEditor(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
Called only from PopulateUI, to add controls to effect panel.
Definition: DtmfGen.cpp:414
static const ComponentInterfaceSymbol Symbol
Definition: DtmfGen.h:45
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
Definition: DtmfGen.cpp:110
EffectType GetType() const override
Type determines how it behaves.
Definition: DtmfGen.cpp:117
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
Definition: DtmfGen.cpp:425
static bool MakeDtmfTone(float *buffer, size_t len, float fs, wxChar tone, sampleCount last, sampleCount total, float amplitude)
Definition: DtmfGen.cpp:518
ComponentInterfaceSymbol GetSymbol() const override
Definition: DtmfGen.cpp:100
static constexpr EffectParameter DutyCycle
Definition: DtmfGen.h:85
Performs effect computation.
Hold values to send to effect output meters.
Interface for manipulations of an Effect's settings.
A WaveTrack contains WaveClip(s). A WaveClip contains a Sequence. A Sequence is primarily an interfac...
Definition: Sequence.h:53
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:630
Holds a msgid for the translation catalog; may also bind format arguments.
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
static constexpr double DefaultDutyCycle
Definition: DtmfGen.h:28
double dtmfSilence
Definition: DtmfGen.h:34
static constexpr double DefaultAmplitude
Definition: DtmfGen.h:29
wxString dtmfSequence
Definition: DtmfGen.h:31
size_t dtmfNTones
Definition: DtmfGen.h:32
double dtmfTone
Definition: DtmfGen.h:33
double dtmfDutyCycle
Definition: DtmfGen.h:35
void Recalculate(EffectSettings &settings)
Definition: DtmfGen.cpp:470
double dtmfAmplitude
Definition: DtmfGen.h:36
static constexpr wchar_t DefaultSequence[]
Definition: DtmfGen.h:27
Temporary state of the computation.
Definition: DtmfGen.cpp:126
Externalized state of a plug-in.