Audacity 3.2.0
PitchAndSpeedDialog.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/**********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 @file PitchAndSpeedDialog.h
7
8 Dmitry Vedenko
9
10 **********************************************************************/
11#pragma once
12
13#include "ClientData.h"
14#include "Observer.h"
15#include "WaveClip.h"
16#include "WaveTrack.h"
17#include "wxPanelWrapper.h"
18
20class AudacityProject;
21class ShuttleGui;
22class WaveClip;
23
25{
26 Pitch,
27 Speed
28};
29
31 public wxDialogWrapper,
32 public ClientData::Base
33{
34public:
36 static const PitchAndSpeedDialog& Get(const AudacityProject& project);
37 static void Destroy(AudacityProject& project);
38
40
42 const std::shared_ptr<WaveTrack>& track,
43 const WaveTrack::IntervalHolder& wideClip);
45 SetFocus(const std::optional<PitchAndSpeedDialogGroup>& group);
46 void TryRetarget(const TrackPanelMouseEvent& event);
47
49 {
50 int semis = 0;
51 int cents = 0;
52 bool operator==(const PitchShift& other) const
53 {
54 return semis == other.semis && cents == other.cents;
55 }
56 bool operator!=(const PitchShift& other) const
57 {
58 return !(*this == other);
59 }
60 };
61
62private:
63 bool Show(bool show) override
64 {
65 return wxDialogWrapper::Show(show);
66 }
67 void SetFocus() override
68 {
70 }
71
73 void SetSemitoneShift();
74 bool SetClipSpeed();
75 void UpdateDialog();
77
79 {
80 const std::shared_ptr<WaveTrack> track;
82 };
83
84 std::optional<StrongTarget> LockTarget();
85
87 const wxString mTitle;
93 double mClipSpeed = 100;
97 std::weak_ptr<WaveClip> mLeftClip;
98 std::weak_ptr<WaveClip> mRightClip;
99 std::weak_ptr<WaveTrack> mTrack;
101 bool mFirst = true;
104};
Utility ClientData::Site to register hooks into a host class that attach client data.
PitchAndSpeedDialogGroup
const auto project
std::shared_ptr< WaveClip > WaveClipHolder
Definition: WaveClip.h:43
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
void SetFocus() override
Observer::Subscription mClipSpeedChangeSubscription
static PitchAndSpeedDialog & Get(AudacityProject &project)
void TryRetarget(const TrackPanelMouseEvent &event)
std::optional< StrongTarget > LockTarget()
Observer::Subscription mClipDeletedSubscription
void UpdateHistory(const TranslatableString &desc)
static void Destroy(AudacityProject &project)
Observer::Subscription mAudioIOSubscription
Observer::Subscription mProjectCloseSubscription
bool Show(bool show) override
std::weak_ptr< WaveClip > mLeftClip
AudacityProject & mProject
PitchAndSpeedDialog & Retarget(const std::shared_ptr< WaveTrack > &track, const WaveTrack::IntervalHolder &wideClip)
std::weak_ptr< WaveTrack > mTrack
PitchAndSpeedDialog(AudacityProject &project)
std::weak_ptr< WaveClip > mRightClip
void PopulateOrExchange(ShuttleGui &s)
Observer::Subscription mClipCentShiftChangeSubscription
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:238
std::shared_ptr< Interval > IntervalHolder
Definition: WaveTrack.h:209
void SetFocus(const WindowPlacement &focus)
Set the window that accepts keyboard input.
Definition: BasicUI.h:392
IMPORT_EXPORT_API ExportResult Show(ExportTask exportTask)
const TranslatableString desc
Definition: ExportPCM.cpp:51
A convenient default parameter for class template Site.
Definition: ClientData.h:29
bool operator==(const PitchShift &other) const
bool operator!=(const PitchShift &other) const
const std::shared_ptr< WaveTrack > track