Audacity 3.2.0
TranscriptionToolBar.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5
6 TranscriptionToolBar.h
7
8 Shane T. Mueller
9 Leland Lucius
10
11**********************************************************************/
12
13#ifndef __AUDACITY_TRANSCRIPTION_TOOLBAR__
14#define __AUDACITY_TRANSCRIPTION_TOOLBAR__
15
16#include "ToolBar.h"
17
18#include <wx/brush.h> // member variable
19
20class wxChoice;
21class wxCommandEvent;
22class wxImage;
23class wxKeyEvent;
24
25class AButton;
26class ASlider;
27class AudacityProject;
28class BoundedEnvelope;
29class sampleCount;
30class WaveTrack;
31
32#ifdef EXPERIMENTAL_VOICE_DETECTION
33class VoiceKey;
34//TTB 0-8 are button-ids, which also correspond to their
35//position in mButtons. 9 & 10 are ids for sliders, which aren't
36//in the button array.
37#endif
38
39enum
40{
43
44#ifdef EXPERIMENTAL_VOICE_DETECTION
45 TTB_StartOn,
46 TTB_EndOn,
47 TTB_StartOff,
48 TTB_EndOff,
49 TTB_SelectSound,
50 TTB_SelectSilence,
51 TTB_AutomateSelection,
52 TTB_MakeLabel,
53 TTB_Calibrate,
54 TTB_SensitivitySlider,
55 TTB_KeyType,
56#endif
57
59};
60
61class TranscriptionToolBar final : public ToolBar {
62
63 public:
64
65 static Identifier ID();
66
68 virtual ~TranscriptionToolBar();
69
70 bool ShownByDefault() const override;
71
72 DockID DefaultDockID() const override;
73
75 static const TranscriptionToolBar &Get( const AudacityProject &project );
76
77 void Create(wxWindow *parent) override;
78
79 void OnKeyEvent(wxKeyEvent & event);
80 void OnPlaySpeed(wxCommandEvent & event);
81 void OnSpeedSlider(wxCommandEvent & event);
82
83 void Populate() override;
84 void Repaint(wxDC * WXUNUSED(dc)) override {};
85 void EnableDisableButtons() override;
86 void UpdatePrefs() override;
87 int GetInitialWidth() override { return 191; }
88 int GetMinToolbarWidth() override { return 125; }
89
90 void OnFocus(wxFocusEvent &event);
91 void OnCaptureKey(wxCommandEvent &event);
92
93#ifdef EXPERIMENTAL_VOICE_DETECTION
94 void OnStartOn(wxCommandEvent & event);
95 void OnStartOff(wxCommandEvent & event);
96 void OnEndOn(wxCommandEvent & event);
97 void OnEndOff(wxCommandEvent & event);
98 void OnSelectSound(wxCommandEvent & event);
99 void OnSelectSilence(wxCommandEvent & event);
100 void OnCalibrate(wxCommandEvent & event);
101 void OnMakeLabel(wxCommandEvent & event);
102 void OnAutomateSelection(wxCommandEvent & event);
103 void OnSensitivitySlider(wxCommandEvent & event);
104
105 //void Populate() override;
106 //void Repaint(wxDC * WXUNUSED(dc)) override {}
107 //void EnableDisableButtons() override;
108
109 //void OnFocus(wxFocusEvent &event);
110 //void OnCaptureKey(wxCommandEvent &event);
111
112 double GetSensitivity();
113 void SetKeyType(wxCommandEvent & event);
114#endif
115
116 void PlayAtSpeed(bool looped, bool cutPreview);
117 void ShowPlaySpeedDialog();
118 void AdjustPlaySpeed(float adj);
119
120 void SetEnabled(bool enabled);
121 void SetPlaying(bool down, bool looped, bool cutPreview);
122
123 double GetPlaySpeed() const { return mPlaySpeed / 1000.0; }
124
125 private:
126
127 void SetPlaySpeed( double value );
128 static AButton *AddButton(
130 teBmps eFore, teBmps eDisabled,
131 int id,
134 teBmps eFore, teBmps eDisabled,
135 int id, unsigned altIdx);
136 void GetSamples(const WaveTrack *t, sampleCount *s0, sampleCount *slen);
137 void SetButton(bool newstate, AButton *button);
138 void RegenerateTooltips() override;
139
144
148
149#ifdef EXPERIMENTAL_VOICE_DETECTION
150 double mSensitivity;
151 std::unique_ptr<VoiceKey> mVk;
152 wxChoice *mKeyTypeChoice;
153#endif
154
157
158 std::shared_ptr<BoundedEnvelope> mEnvelope;
159
160 public:
161
162 DECLARE_CLASS(TranscriptionToolBar)
163 DECLARE_EVENT_TABLE()
164};
165
166#endif
167
wxImage(22, 22)
int teBmps
TranslatableString label
Definition: TagsEditor.cpp:165
const auto project
@ TTB_PlaySpeedSlider
@ TTBNumButtons
@ TTB_PlaySpeed
A wxButton with mouse-over behaviour.
Definition: AButton.h:104
ASlider is a custom slider, allowing for a slicker look and feel.
Definition: ASlider.h:260
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:74
DockID
Identifies one of the docking areas for toolbars.
Definition: ToolBar.h:92
A kind of ToolBar used to help with analysing voice recordings.
void Repaint(wxDC *WXUNUSED(dc)) override
void Create(wxWindow *parent) override
int GetInitialWidth() override
Resizable toolbars should implement these.
static Identifier ID()
void SetEnabled(bool enabled)
int GetMinToolbarWidth() override
static TranscriptionToolBar & Get(AudacityProject &project)
bool ShownByDefault() const override
Whether the toolbar should be shown by default. Default implementation returns true.
void OnCaptureKey(wxCommandEvent &event)
std::shared_ptr< BoundedEnvelope > mEnvelope
void GetSamples(const WaveTrack *t, sampleCount *s0, sampleCount *slen)
void SetButton(bool newstate, AButton *button)
static AButton * AddButton(TranscriptionToolBar *pBar, teBmps eFore, teBmps eDisabled, int id, const TranslatableString &label)
void OnPlaySpeed(wxCommandEvent &event)
void SetPlaySpeed(double value)
AButton * mButtons[TTBNumButtons]
void PlayAtSpeed(bool looped, bool cutPreview)
void SetPlaying(bool down, bool looped, bool cutPreview)
DockID DefaultDockID() const override
Which dock the toolbar defaults into. Default implementation chooses the top dock.
void OnFocus(wxFocusEvent &event)
void MakeAlternateImages(teBmps eFore, teBmps eDisabled, int id, unsigned altIdx)
void OnKeyEvent(wxKeyEvent &event)
TranscriptionToolBar(AudacityProject &project)
void EnableDisableButtons() override
void RegenerateTooltips() override
void OnSpeedSlider(wxCommandEvent &event)
Holds a msgid for the translation catalog; may also bind format arguments.
This implements a voice key, detecting either the next "ON" or "OFF" point.
Definition: VoiceKey.h:33
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19