Audacity 3.2.0
MixerOptions.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file MixerOptions.h
6 @brief supporting classes for Mixer
7
8 Dominic Mazzoni
9 Markus Meyer
10
11 Paul Licameli split from Mix.h
12
13***********************************************************************/
14
15#ifndef __AUDACITY_MIXER_OPTIONS__
16#define __AUDACITY_MIXER_OPTIONS__
17
18#include "EffectInterface.h" // for EffectSettings
19#include "GlobalVariable.h"
20#include "MemoryX.h"
21#include <functional>
22#include <vector>
23
24class AudacityProject;
25class BoundedEnvelope;
28
29namespace MixerOptions {
30
32class MIXER_API Downmix final {
33 unsigned mNumTracks, mNumChannels, mMaxNumChannels;
34
35 void Alloc();
36
37public:
39
40 Downmix(unsigned numTracks, unsigned maxNumChannels);
41 Downmix(const Downmix &mixerSpec);
43 Downmix(const Downmix &mixerSpec, const std::vector<bool>& tracksMask);
44 ~Downmix();
45
46 bool SetNumChannels(unsigned numChannels);
47 unsigned GetNumChannels() const { return mNumChannels; }
48
49 unsigned GetMaxNumChannels() const { return mMaxNumChannels; }
50 unsigned GetNumTracks() const { return mNumTracks; }
51
52 Downmix& operator=(const Downmix &mixerSpec);
53};
54
56struct MIXER_API Warp final {
58 struct MIXER_API DefaultWarp : GlobalHook<DefaultWarp,
59 const BoundedEnvelope*(const AudacityProject*)
60 >{};
61
63 explicit Warp(const AudacityProject *pProject);
64
66 explicit Warp(const BoundedEnvelope *e);
67
69
74 Warp(double min, double max, double initial = 1.0);
75
76 const BoundedEnvelope *const envelope = nullptr;
77 const double minSpeed, maxSpeed;
78 const double initialSpeed{ 1.0 };
79};
80
81// Information derived from Warp and other data
82struct ResampleParameters final {
83 ResampleParameters(bool highQuality,
84 double inRate, double outRate, const Warp &options);
86 bool mVariableRates{ false };
88};
89
92struct TimesAndSpeed final {
93 // Bounds for fetch position in the sample source
94 double mT0; // Start time
95 double mT1; // Stop time (none if mT0==mT1)
96 // Varying scrub speed is one cause for resampling
97 double mSpeed;
98
99 // For output purposes only (like progress indicator update)
100 double mTime; // Current time (renamed from mT to mTime for
101 // consistency with AudioIO - mT represented warped time there)
102};
103
104struct StageSpecification final {
105 using Factory = std::function<std::shared_ptr<EffectInstance>()>;
106
109
110 mutable std::shared_ptr<EffectInstance> mpFirstInstance;
111};
112
113}
114#endif
int min(int a, int b)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Performs effect computation.
Definition: EffectPlugin.h:96
Global function-valued variable, adding a convenient Call()
A matrix of booleans, one row per input channel, column per output.
Definition: MixerOptions.h:32
unsigned GetMaxNumChannels() const
Definition: MixerOptions.h:49
ArraysOf< bool > mMap
Definition: MixerOptions.h:38
unsigned GetNumTracks() const
Definition: MixerOptions.h:50
unsigned GetNumChannels() const
Definition: MixerOptions.h:47
Externalized state of a plug-in.
ResampleParameters(bool highQuality, double inRate, double outRate, const Warp &options)
std::shared_ptr< EffectInstance > mpFirstInstance
Definition: MixerOptions.h:110
std::function< std::shared_ptr< EffectInstance >()> Factory
Definition: MixerOptions.h:105
Hook function for default time warp.
Definition: MixerOptions.h:60
Immutable structure is an argument to Mixer's constructor.
Definition: MixerOptions.h:56
const double maxSpeed
Definition: MixerOptions.h:77