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, PerTrackEffect>
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<EffectUIValidator> PopulateOrExchange(
63 ShuttleGui & S, EffectInstance &instance,
64 EffectSettingsAccess &access, const EffectOutputs *pOutputs) override;
65
66 struct Instance;
67 std::shared_ptr<EffectInstance> MakeInstance() const override;
68
69private:
70 // EffectDtmf implementation
71
72 static bool MakeDtmfTone(float *buffer, size_t len, float fs,
73 wxChar tone, sampleCount last,
74 sampleCount total, float amplitude);
75
76public:
77 struct Validator;
78
79private:
80 const EffectParameterMethods& Parameters() const override;
81
83 L"Sequence", DtmfSettings::DefaultSequence, L"", L"", L""};
85 L"Duty Cycle", DtmfSettings::DefaultDutyCycle, 0.0, 100.0, 10.0 };
87 L"Amplitude", DtmfSettings::DefaultAmplitude, 0.001, 1.0, 1 };
88};
89
90#endif
EffectType
#define S(N)
Definition: ToChars.cpp:64
static Settings & settings()
Definition: TrackInfo.cpp:87
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:89
const EffectParameterMethods & Parameters() const override
Definition: DtmfGen.cpp:35
virtual ~EffectDtmf()
Definition: DtmfGen.cpp:93
TranslatableString GetDescription() const override
Definition: DtmfGen.cpp:104
static constexpr EffectParameter Amplitude
Definition: DtmfGen.h:86
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:109
EffectType GetType() const override
Type determines how it behaves.
Definition: DtmfGen.cpp:116
std::shared_ptr< EffectInstance > MakeInstance() const override
Make an object maintaining short-term state of an Effect.
Definition: DtmfGen.cpp:426
static bool MakeDtmfTone(float *buffer, size_t len, float fs, wxChar tone, sampleCount last, sampleCount total, float amplitude)
Definition: DtmfGen.cpp:519
std::unique_ptr< EffectUIValidator > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Add controls to effect panel; always succeeds.
Definition: DtmfGen.cpp:415
ComponentInterfaceSymbol GetSymbol() const override
Definition: DtmfGen.cpp:99
static constexpr EffectParameter DutyCycle
Definition: DtmfGen.h:84
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:61
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
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:471
double dtmfAmplitude
Definition: DtmfGen.h:36
static constexpr wchar_t DefaultSequence[]
Definition: DtmfGen.h:27
Temporary state of the computation.
Definition: DtmfGen.cpp:125
Externalized state of a plug-in.