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 BoundedEnvelope;
26class SampleTrack;
27class TrackList;
28
29namespace MixerOptions {
30
32class SAMPLE_TRACK_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);
42 ~Downmix();
43
44 bool SetNumChannels(unsigned numChannels);
45 unsigned GetNumChannels() { return mNumChannels; }
46
47 unsigned GetMaxNumChannels() { return mMaxNumChannels; }
48 unsigned GetNumTracks() { return mNumTracks; }
49
50 Downmix& operator=(const Downmix &mixerSpec);
51};
52
54struct SAMPLE_TRACK_API Warp final {
56 struct SAMPLE_TRACK_API DefaultWarp : GlobalHook<DefaultWarp,
57 const BoundedEnvelope*(const TrackList&)
58 >{};
59
61 explicit Warp(const TrackList &list);
62
64 explicit Warp(const BoundedEnvelope *e);
65
67
72 Warp(double min, double max, double initial = 1.0);
73
74 const BoundedEnvelope *const envelope = nullptr;
75 const double minSpeed, maxSpeed;
76 const double initialSpeed{ 1.0 };
77};
78
79// Information derived from Warp and other data
80struct ResampleParameters final {
81 ResampleParameters(bool highQuality,
82 const SampleTrack &leader, double rate, const Warp &options);
84 bool mVariableRates{ false };
85 std::vector<double> mMinFactor, mMaxFactor;
86};
87
90struct TimesAndSpeed final {
91 // Bounds for fetch position in the sample source
92 double mT0; // Start time
93 double mT1; // Stop time (none if mT0==mT1)
94 // Varying scrub speed is one cause for resampling
95 double mSpeed;
96
97 // For output purposes only (like progress indicator update)
98 double mTime; // Current time (renamed from mT to mTime for
99 // consistency with AudioIO - mT represented warped time there)
100};
101
102struct StageSpecification final {
103 using Factory = std::function<std::shared_ptr<EffectInstanceEx>()>;
104
107
108 mutable std::shared_ptr<EffectInstanceEx> mpFirstInstance;
109};
110
111}
112#endif
int min(int a, int b)
Performs effect computation.
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 GetNumChannels()
Definition: MixerOptions.h:45
ArraysOf< bool > mMap
Definition: MixerOptions.h:38
unsigned GetNumTracks()
Definition: MixerOptions.h:48
unsigned GetMaxNumChannels()
Definition: MixerOptions.h:47
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1338
Externalized state of a plug-in.
std::vector< double > mMaxFactor
Definition: MixerOptions.h:85
ResampleParameters(bool highQuality, const SampleTrack &leader, double rate, const Warp &options)
std::vector< double > mMinFactor
Definition: MixerOptions.h:85
std::function< std::shared_ptr< EffectInstanceEx >()> Factory
Definition: MixerOptions.h:103
std::shared_ptr< EffectInstanceEx > mpFirstInstance
Definition: MixerOptions.h:108
Hook function for default time warp.
Definition: MixerOptions.h:58
Immutable structure is an argument to Mixer's constructor.
Definition: MixerOptions.h:54
const double maxSpeed
Definition: MixerOptions.h:75