Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
SequenceDownmixSource Class Referencefinal

#include <DownmixSource.h>

Inheritance diagram for SequenceDownmixSource:
[legend]
Collaboration diagram for SequenceDownmixSource:
[legend]

Public Member Functions

 SequenceDownmixSource (AudioGraph::Source &downstream, const WideSampleSequence &sequence, const ArrayOf< bool > *channelMap)
 
AudioGraph::SourceGetDownstream () const override
 Returns underlying AudioGraph::Source processed by Mixer. More...
 
size_t NChannels () const override
 Number of output channels of the underlying Source. More...
 
float GetChannelGain (size_t channel) const override
 Gain multiplier that should be applied to the channel. More...
 
void FindChannelFlags (unsigned char *channelFlags, size_t numChannels, size_t iChannel) override
 
bool CanMakeMono () const override
 Returns true if source channels could be combined into mono if needed. More...
 
- Public Member Functions inherited from DownmixSource
 DownmixSource ()=default
 
virtual ~DownmixSource ()=default
 
virtual AudioGraph::SourceGetDownstream () const =0
 Returns underlying AudioGraph::Source processed by Mixer. More...
 
virtual size_t NChannels () const =0
 Number of output channels of the underlying Source. More...
 
virtual float GetChannelGain (size_t channel) const =0
 Gain multiplier that should be applied to the channel. More...
 
virtual void FindChannelFlags (unsigned char *channelFlags, size_t numChannels, size_t iChannel)=0
 
virtual bool CanMakeMono () const =0
 Returns true if source channels could be combined into mono if needed. More...
 

Private Attributes

AudioGraph::SourcemDownstream
 
const WideSampleSequencemSequence
 
const ArrayOf< bool > * mpMap {}
 

Detailed Description

Downmix source that uses Sequence as a source for channel operations.

Definition at line 45 of file DownmixSource.h.

Constructor & Destructor Documentation

◆ SequenceDownmixSource()

SequenceDownmixSource::SequenceDownmixSource ( AudioGraph::Source downstream,
const WideSampleSequence sequence,
const ArrayOf< bool > *  channelMap 
)
Parameters
channelMapNull or else must have a lifetime enclosing this objects's

Definition at line 19 of file DownmixSource.cpp.

22 : mDownstream(downstream)
23 , mSequence(sequence)
24 , mpMap(channelMap)
25{
26}
const WideSampleSequence & mSequence
Definition: DownmixSource.h:48
AudioGraph::Source & mDownstream
Definition: DownmixSource.h:47
const ArrayOf< bool > * mpMap
Definition: DownmixSource.h:51

Member Function Documentation

◆ CanMakeMono()

bool SequenceDownmixSource::CanMakeMono ( ) const
overridevirtual

Returns true if source channels could be combined into mono if needed.

Implements DownmixSource.

Definition at line 62 of file DownmixSource.cpp.

63{
64 return mpMap == nullptr;
65}

References mpMap.

◆ FindChannelFlags()

void SequenceDownmixSource::FindChannelFlags ( unsigned char *  channelFlags,
size_t  numChannels,
size_t  iChannel 
)
overridevirtual

For the given iChannel fills the channelFlags array, that describes to which output it should go.

Implements DownmixSource.

Definition at line 43 of file DownmixSource.cpp.

44{
45 const bool* map = mpMap ? mpMap[iChannel].get() : nullptr;
46 const auto end = channelFlags + numChannels;
47 std::fill(channelFlags, end, 0);
48 if (map)
49 // ignore left and right when downmixing is customized
50 std::copy(map, map + numChannels, channelFlags);
52 std::fill(channelFlags, end, 1);
53 else if (iChannel == 0)
54 channelFlags[0] = 1;
55 else if (iChannel == 1) {
56 if (numChannels >= 2)
57 channelFlags[1] = 1;
58 else
59 channelFlags[0] = 1;
60 }
61}
bool IsMono(const Channel &channel)
Whether the channel is mono.
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
void copy(const T *src, T *dst, int32_t n)
Definition: VectorOps.h:40

References staffpad::vo::copy(), details::end(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, AudioGraph::IsMono(), mpMap, and mSequence.

Here is the call graph for this function:

◆ GetChannelGain()

float SequenceDownmixSource::GetChannelGain ( size_t  channel) const
overridevirtual

Gain multiplier that should be applied to the channel.

Implements DownmixSource.

Definition at line 38 of file DownmixSource.cpp.

39{
40 return mSequence.GetChannelVolume(channel);
41}
virtual float GetChannelVolume(int channel) const =0

References WideSampleSequence::GetChannelVolume(), and mSequence.

Here is the call graph for this function:

◆ GetDownstream()

AudioGraph::Source & SequenceDownmixSource::GetDownstream ( ) const
overridevirtual

Returns underlying AudioGraph::Source processed by Mixer.

Implements DownmixSource.

Definition at line 28 of file DownmixSource.cpp.

29{
30 return mDownstream;
31}

References mDownstream.

◆ NChannels()

size_t SequenceDownmixSource::NChannels ( ) const
overridevirtual

Number of output channels of the underlying Source.

Implements DownmixSource.

Definition at line 33 of file DownmixSource.cpp.

34{
35 return mSequence.NChannels();
36}
virtual size_t NChannels() const =0
A constant property.

References mSequence, and WideSampleSequence::NChannels().

Here is the call graph for this function:

Member Data Documentation

◆ mDownstream

AudioGraph::Source& SequenceDownmixSource::mDownstream
private

Definition at line 47 of file DownmixSource.h.

Referenced by GetDownstream().

◆ mpMap

const ArrayOf<bool>* SequenceDownmixSource::mpMap {}
private

many-to-one mixing of channels Pointer into array of arrays

Definition at line 51 of file DownmixSource.h.

Referenced by CanMakeMono(), and FindChannelFlags().

◆ mSequence

const WideSampleSequence& SequenceDownmixSource::mSequence
private

Definition at line 48 of file DownmixSource.h.

Referenced by FindChannelFlags(), GetChannelGain(), and NChannels().


The documentation for this class was generated from the following files: