Audacity 3.2.0
Public Member Functions | Private Types | Private Attributes | List of all members
AudacityMirProject Class Referencefinal

#include <AudacityMirProject.h>

Inheritance diagram for AudacityMirProject:
[legend]
Collaboration diagram for AudacityMirProject:
[legend]

Public Member Functions

 AudacityMirProject (AudacityProject &project)
 
 ~AudacityMirProject () override
 
bool ViewIsBeatsAndMeasures () const override
 
void ReconfigureMusicGrid (double newTempo, std::optional< MIR::TimeSignature > timeSignature) override
 
double GetTempo () const override
 
bool ShouldBeReconfigured (double newTempo, bool isSingleFileImport) override
 
void OnClipsSynchronized () override
 
- Public Member Functions inherited from MIR::ProjectInterface
virtual ~ProjectInterface ()=default
 
virtual bool ViewIsBeatsAndMeasures () const =0
 
virtual void ReconfigureMusicGrid (double newTempo, std::optional< MIR::TimeSignature > timeSignature)=0
 
virtual double GetTempo () const =0
 
virtual bool ShouldBeReconfigured (double newTempo, bool isSingleFileImport)=0
 
virtual void OnClipsSynchronized ()=0
 

Private Types

enum class  ModificationType { Automatic , Manual }
 

Private Attributes

AudacityProjectmProject
 
const double mProjectTempo
 
const bool mImportedOnEmptyProject
 
std::optional< ModificationTypemMostSignificantModification
 
bool mProjectWasModified = false
 

Detailed Description

Definition at line 17 of file AudacityMirProject.h.

Member Enumeration Documentation

◆ ModificationType

enum class AudacityMirProject::ModificationType
strongprivate
Enumerator
Automatic 
Manual 

Definition at line 36 of file AudacityMirProject.h.

37 {
38 Automatic,
39 Manual,
40 };

Constructor & Destructor Documentation

◆ AudacityMirProject()

AudacityMirProject::AudacityMirProject ( AudacityProject project)
explicit

Definition at line 33 of file AudacityMirProject.cpp.

34 : mProject { project }
36 .Any<WaveTrack>()
37 .empty() }
39{
40}
const auto project
AudacityProject & mProject
const double mProjectTempo
const bool mImportedOnEmptyProject
static ProjectTimeSignature & Get(AudacityProject &project)
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:950
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
A Track that contains audio waveform data.
Definition: WaveTrack.h:203

◆ ~AudacityMirProject()

AudacityMirProject::~AudacityMirProject ( )
override

Definition at line 42 of file AudacityMirProject.cpp.

43{
45 return;
46 assert(mMostSignificantModification.has_value());
47 auto& ph = ProjectHistory::Get(mProject);
49 ph.ModifyState(true);
51 ph.PushState(
52 XO("Configure Project from Music File"),
53 XO("Automatic Music Configuration"));
54}
XO("Cut/Copy/Paste")
std::optional< ModificationType > mMostSignificantModification
static ProjectHistory & Get(AudacityProject &project)

References Automatic, ProjectHistory::Get(), Manual, mMostSignificantModification, mProject, mProjectWasModified, and XO().

Here is the call graph for this function:

Member Function Documentation

◆ GetTempo()

double AudacityMirProject::GetTempo ( ) const
overridevirtual

Implements MIR::ProjectInterface.

Definition at line 79 of file AudacityMirProject.cpp.

80{
81 return mProjectTempo;
82}

References mProjectTempo.

◆ OnClipsSynchronized()

void AudacityMirProject::OnClipsSynchronized ( )
overridevirtual

◆ ReconfigureMusicGrid()

void AudacityMirProject::ReconfigureMusicGrid ( double  newTempo,
std::optional< MIR::TimeSignature timeSignature 
)
override

Definition at line 62 of file AudacityMirProject.cpp.

64{
67 auto& projTimeSignature = ProjectTimeSignature::Get(mProject);
68 projTimeSignature.SetTempo(newTempo);
69 if (timeSignature.has_value())
70 {
71 projTimeSignature.SetUpperTimeSignature(
72 MIR::GetNumerator(*timeSignature));
73 projTimeSignature.SetLowerTimeSignature(
74 MIR::GetDenominator(*timeSignature));
75 }
77}
void SetTimeDisplayMode(TimeDisplayMode rulerType)
static AdornedRulerPanel & Get(AudacityProject &project)
int GetNumerator(TimeSignature ts)
Definition: MirTypes.h:39
int GetDenominator(TimeSignature ts)
Definition: MirTypes.h:46

References BeatsAndMeasures, ProjectTimeSignature::Get(), AdornedRulerPanel::Get(), MIR::GetDenominator(), MIR::GetNumerator(), mProject, mProjectWasModified, and AdornedRulerPanel::SetTimeDisplayMode().

Here is the call graph for this function:

◆ ShouldBeReconfigured()

bool AudacityMirProject::ShouldBeReconfigured ( double  newTempo,
bool  isSingleFileImport 
)
overridevirtual

Implements MIR::ProjectInterface.

Definition at line 84 of file AudacityMirProject.cpp.

86{
88 if (policy == wxString("Ask"))
89 {
90 const auto displayedTempo = FormatTempo(newTempo);
91 const auto message =
92 isSingleFileImport ?
93 XO("Audacity detected this file to be %s bpm.\nWould you like to enable music view and set the project tempo to %s?")
94 .Format(displayedTempo, displayedTempo) :
95 XO("Audacity detected one or more files to be %s bpm.\nWould you like to enable music view and set the project tempo to %s?")
96 .Format(displayedTempo, displayedTempo);
98 &GetProjectPanel(mProject), XO("Music Import"), message);
99 const auto yes = m.ShowDialog();
100 if (m.IsChecked())
102 yes ? wxString("Yes") : wxString("No"));
103 if (yes)
105 return yes;
106 }
107 const auto yes = policy == wxString("Yes");
108 if (yes)
110 return yes;
111}
AUDACITY_DLL_API wxWindow & GetProjectPanel(AudacityProject &project)
Get the main sub-window of the project frame that displays track data.
bool Write(const wxString &value)
Definition: Prefs.cpp:424
wxString Read() const
Definition: Prefs.cpp:388
static EnumSetting< bool > MusicFileImportSetting

References Automatic, anonymous_namespace{AudacityMirProject.cpp}::FormatTempo(), GetProjectPanel(), AudacityDontAskAgainMessageDialog::IsChecked(), Manual, mMostSignificantModification, mProject, ImportExportPrefs::MusicFileImportSetting, ChoiceSetting::Read(), AudacityDontAskAgainMessageDialog::ShowDialog(), ChoiceSetting::Write(), and XO().

Here is the call graph for this function:

◆ ViewIsBeatsAndMeasures()

bool AudacityMirProject::ViewIsBeatsAndMeasures ( ) const
overridevirtual

Implements MIR::ProjectInterface.

Definition at line 56 of file AudacityMirProject.cpp.

References BeatsAndMeasures, AdornedRulerPanel::Get(), AdornedRulerPanel::GetTimeDisplayMode(), and mProject.

Here is the call graph for this function:

Member Data Documentation

◆ mImportedOnEmptyProject

const bool AudacityMirProject::mImportedOnEmptyProject
private

Definition at line 44 of file AudacityMirProject.h.

◆ mMostSignificantModification

std::optional<ModificationType> AudacityMirProject::mMostSignificantModification
private

◆ mProject

AudacityProject& AudacityMirProject::mProject
private

◆ mProjectTempo

const double AudacityMirProject::mProjectTempo
private

Definition at line 43 of file AudacityMirProject.h.

Referenced by GetTempo().

◆ mProjectWasModified

bool AudacityMirProject::mProjectWasModified = false
private

The documentation for this class was generated from the following files: