Audacity 3.2.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
MixerOptions::Downmix Class Referencefinal

A matrix of booleans, one row per input channel, column per output. More...

#include <MixerOptions.h>

Collaboration diagram for MixerOptions::Downmix:
[legend]

Public Member Functions

 Downmix (unsigned numTracks, unsigned maxNumChannels)
 
 Downmix (const Downmix &mixerSpec)
 
 Downmix (const Downmix &mixerSpec, const std::vector< bool > &tracksMask)
 brief Copies channel map for mixerSpec for tracks specified in tracksMask More...
 
 ~Downmix ()
 
bool SetNumChannels (unsigned numChannels)
 
unsigned GetNumChannels () const
 
unsigned GetMaxNumChannels () const
 
unsigned GetNumTracks () const
 
Downmixoperator= (const Downmix &mixerSpec)
 

Public Attributes

ArraysOf< bool > mMap
 

Private Member Functions

void Alloc ()
 

Private Attributes

unsigned mNumTracks
 
unsigned mNumChannels
 
unsigned mMaxNumChannels
 

Detailed Description

A matrix of booleans, one row per input channel, column per output.

Definition at line 32 of file MixerOptions.h.

Constructor & Destructor Documentation

◆ Downmix() [1/3]

MixerOptions::Downmix::Downmix ( unsigned  numTracks,
unsigned  maxNumChannels 
)

Definition at line 62 of file MixerOptions.cpp.

63{
64 mNumTracks = mNumChannels = numTracks;
65 mMaxNumChannels = maxNumChannels;
66
69
70 Alloc();
71
72 for( unsigned int i = 0; i < mNumTracks; i++ )
73 for( unsigned int j = 0; j < mNumChannels; j++ )
74 mMap[ i ][ j ] = ( i == j );
75}
ArraysOf< bool > mMap
Definition: MixerOptions.h:38

◆ Downmix() [2/3]

MixerOptions::Downmix::Downmix ( const Downmix mixerSpec)

Definition at line 77 of file MixerOptions.cpp.

78{
79 mNumTracks = mixerSpec.mNumTracks;
80 mMaxNumChannels = mixerSpec.mMaxNumChannels;
81 mNumChannels = mixerSpec.mNumChannels;
82
83 Alloc();
84
85 for( unsigned int i = 0; i < mNumTracks; i++ )
86 for( unsigned int j = 0; j < mNumChannels; j++ )
87 mMap[ i ][ j ] = mixerSpec.mMap[ i ][ j ];
88}

References mMap, mMaxNumChannels, mNumChannels, and mNumTracks.

◆ Downmix() [3/3]

MixerOptions::Downmix::Downmix ( const Downmix mixerSpec,
const std::vector< bool > &  tracksMask 
)

brief Copies channel map for mixerSpec for tracks specified in tracksMask

Definition at line 90 of file MixerOptions.cpp.

91 : mMaxNumChannels(mixerSpec.mMaxNumChannels)
92 , mNumChannels(mixerSpec.mNumChannels)
93{
94 mNumTracks = static_cast<unsigned>(std::count(tracksMask.begin(), tracksMask.end(), true));
95 Alloc();
96 unsigned int dstTrackIndex = 0;
97 for( unsigned int srcTrackIndex = 0; srcTrackIndex < tracksMask.size(); srcTrackIndex++ )
98 {
99 if(!tracksMask[srcTrackIndex])
100 continue;
101
102 for( unsigned int j = 0; j < mNumChannels; j++ )
103 mMap[ dstTrackIndex ][ j ] = mixerSpec.mMap[ srcTrackIndex ][ j ] ;
104
105 ++dstTrackIndex;
106 }
107}

References Alloc(), mMap, mNumChannels, and mNumTracks.

Here is the call graph for this function:

◆ ~Downmix()

MixerOptions::Downmix::~Downmix ( )

Definition at line 114 of file MixerOptions.cpp.

115{
116}

Member Function Documentation

◆ Alloc()

void MixerOptions::Downmix::Alloc ( )
private

Definition at line 109 of file MixerOptions.cpp.

110{
112}
void reinit(Integral count)
Definition: MemoryX.h:110

Referenced by Downmix().

Here is the caller graph for this function:

◆ GetMaxNumChannels()

unsigned MixerOptions::Downmix::GetMaxNumChannels ( ) const
inline

Definition at line 49 of file MixerOptions.h.

49{ return mMaxNumChannels; }

◆ GetNumChannels()

unsigned MixerOptions::Downmix::GetNumChannels ( ) const
inline

Definition at line 47 of file MixerOptions.h.

47{ return mNumChannels; }

Referenced by ExportTaskBuilder::Build(), ExportMixerPanel::OnMouseEvent(), ExportMixerPanel::OnPaint(), and ExportMixerDialog::OnSlider().

Here is the caller graph for this function:

◆ GetNumTracks()

unsigned MixerOptions::Downmix::GetNumTracks ( ) const
inline

Definition at line 50 of file MixerOptions.h.

50{ return mNumTracks; }

Referenced by ExportMixerPanel::OnMouseEvent(), and ExportMixerPanel::OnPaint().

Here is the caller graph for this function:

◆ operator=()

auto MixerOptions::Downmix::operator= ( const Downmix mixerSpec)

Definition at line 139 of file MixerOptions.cpp.

140{
141 mNumTracks = mixerSpec.mNumTracks;
142 mNumChannels = mixerSpec.mNumChannels;
143 mMaxNumChannels = mixerSpec.mMaxNumChannels;
144
145 Alloc();
146
147 for( unsigned int i = 0; i < mNumTracks; i++ )
148 for( unsigned int j = 0; j < mNumChannels; j++ )
149 mMap[ i ][ j ] = mixerSpec.mMap[ i ][ j ];
150
151 return *this;
152}

References mNumTracks.

◆ SetNumChannels()

bool MixerOptions::Downmix::SetNumChannels ( unsigned  numChannels)

Definition at line 118 of file MixerOptions.cpp.

119{
120 if( mNumChannels == newNumChannels )
121 return true;
122
123 if( newNumChannels > mMaxNumChannels )
124 return false;
125
126 for( unsigned int i = 0; i < mNumTracks; i++ )
127 {
128 for( unsigned int j = newNumChannels; j < mNumChannels; j++ )
129 mMap[ i ][ j ] = false;
130
131 for( unsigned int j = mNumChannels; j < newNumChannels; j++ )
132 mMap[ i ][ j ] = false;
133 }
134
135 mNumChannels = newNumChannels;
136 return true;
137}

Referenced by ExportMixerDialog::OnSlider().

Here is the caller graph for this function:

Member Data Documentation

◆ mMap

ArraysOf<bool> MixerOptions::Downmix::mMap

◆ mMaxNumChannels

unsigned MixerOptions::Downmix::mMaxNumChannels
private

Definition at line 33 of file MixerOptions.h.

Referenced by Downmix().

◆ mNumChannels

unsigned MixerOptions::Downmix::mNumChannels
private

Definition at line 33 of file MixerOptions.h.

Referenced by Downmix().

◆ mNumTracks

unsigned MixerOptions::Downmix::mNumTracks
private

Definition at line 33 of file MixerOptions.h.

Referenced by Downmix(), and operator=().


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