Audacity 3.2.0
NumericConverterFormatterContext.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 NumericConverterFormatterContext.h
7
8 Dmitry Vedenko
9
10 **********************************************************************/
11#pragma once
12
13#include <memory>
14#include <optional>
15
16class AudacityProject;
17
19
23class NUMERIC_FORMATS_API FormatterContext final
24{
26 explicit FormatterContext(double sampleRate);
27
28public:
29 static FormatterContext EmptyContext();
30 static FormatterContext ProjectContext(const AudacityProject& project);
31 static FormatterContext SampleRateContext(double sampleRate);
32
33 FormatterContext() = default;
38
40
42
47 bool HasProject() const;
49 std::shared_ptr<const AudacityProject> GetProject() const;
51 bool HasSampleRate() const;
53 double GetSampleRate(double defaultSampleRate = 44100.0) const;
54
55private:
56 std::weak_ptr<const AudacityProject> mProject;
57 std::optional<double> mProjectRate;
58};
const auto project
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 context in which formatter operates.
FormatterContext(const FormatterContext &)=default
FormatterContext()=default
std::optional< double > mProjectRate
FormatterContext(FormatterContext &&)=default
FormatterContext & operator=(FormatterContext &&)=default
std::weak_ptr< const AudacityProject > mProject
FormatterContext & operator=(const FormatterContext &)=default
const AudacityProject & GetProject(const Track &track)
Definition: TrackArt.cpp:479