Audacity 3.2.0
DownmixStage.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 DownmixStage.h
6
7*******************************************************************/
8
9#pragma once
10
11#include <vector>
12#include <memory>
13
14#include "AudioGraphBuffers.h"
15#include "AudioGraphSource.h"
16
17class DownmixSource;
18
20class DownmixStage final : public AudioGraph::Source
21{
22public:
23 enum class ApplyVolume
24 {
25 Discard,//< No source volume is applied
26 MapChannels, //< Apply volume per source's channel
27 Mixdown, //< Average volume from all channels in the source, numOutChannels should be 1
28 };
29
30private:
31 std::vector<std::unique_ptr<DownmixSource>> mDownmixSources;
32 // Resample into these buffers, or produce directly when not resampling
36
37public:
38
39 DownmixStage(std::vector<std::unique_ptr<DownmixSource>> downmixSources,
40 size_t numChannels,
41 size_t bufferSize,
42 ApplyVolume applyGain);
43
44 ~DownmixStage() override;
45
46 bool AcceptsBuffers(const Buffers& buffers) const override;
47
48 bool AcceptsBlockSize(size_t blockSize) const override;
49
50 std::optional<size_t> Acquire(Buffers& data, size_t maxToProcess) override;
51 sampleCount Remaining() const override;
52
53 bool Release() override;
54};
Accumulates (non-interleaved) data during effect processing.
Upstream producer of sample streams, taking Buffers as external context.
Describes an input source for DownmixStage Decorates an AudioGraph::Source with operations that are n...
Definition: DownmixSource.h:25
Combines multiple audio graph sources into a single source.
Definition: DownmixStage.h:21
sampleCount Remaining() const override
Result includes any amount Acquired and not yet Released.
AudioGraph::Buffers mFloatBuffers
Definition: DownmixStage.h:33
std::vector< std::unique_ptr< DownmixSource > > mDownmixSources
Definition: DownmixStage.h:31
std::optional< size_t > Acquire(Buffers &data, size_t maxToProcess) override
Occupy vacant space in Buffers with some data.
bool AcceptsBuffers(const Buffers &buffers) const override
DownmixStage(std::vector< std::unique_ptr< DownmixSource > > downmixSources, size_t numChannels, size_t bufferSize, ApplyVolume applyGain)
bool Release() override
Caller is done examining last Acquire()d positions.
~DownmixStage() override
bool AcceptsBlockSize(size_t blockSize) const override
size_t mNumChannels
Definition: DownmixStage.h:34
ApplyVolume mApplyVolume
Definition: DownmixStage.h:35
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19