Audacity 3.2.0
ImportExport.cpp
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 ImportExport.cpp
7
8 Vitaly Sverchinsky
9
10**********************************************************************/
11
12#include "ImportExport.h"
13
14#include "Project.h"
15#include "XMLWriter.h"
17
20 []( AudacityProject &){
21 auto result = std::make_shared< ImportExport >();
22 return result;
23 }
24};
25
27{
28 return project.AttachedObjects::Get<ImportExport>(sKey);
29}
30
32{
33 return Get(const_cast<AudacityProject&>(project));
34}
35
37
39{
40 return mExportRate;
41}
42
44{
45 assert(rate > 0 || rate == InvalidRate);
46 if(rate > 0 || rate == InvalidRate)
47 mExportRate = rate;
48}
49
51[](const AudacityProject &project, XMLWriter &xmlFile){
52 xmlFile.WriteAttr(wxT("preferred_export_rate"), ImportExport::Get(project).GetPreferredExportRate());
53}
54};
55
57// Just a pointer to function, but needing overload resolution as non-const:
59 { "preferred_export_rate", [](auto &settings, auto value){
60 const double rate = value.Get(settings.GetPreferredExportRate());
61 settings.SetPreferredExportRate( rate );
62 } }
63} };
64
wxT("CloseDown"))
static const AudacityProject::AttachedObjects::RegisteredFactory sKey
static ProjectFileIORegistry::AttributeWriterEntry entry
static ProjectFileIORegistry::AttributeReaderEntries entries
const auto project
static Settings & settings()
Definition: TrackInfo.cpp:51
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
Definition: ClientData.h:275
static ImportExport & Get(AudacityProject &project)
void SetPreferredExportRate(double rate)
double GetPreferredExportRate() const
double mExportRate
Definition: ImportExport.h:34
static constexpr double InvalidRate
Definition: ImportExport.h:21
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:25
Typically statically constructed.