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

Two sample formats, remembering format of original source and describing stored format. More...

#include <SampleFormat.h>

Public Member Functions

 SampleFormats (sampleFormat effective, sampleFormat stored)
 
sampleFormat Effective () const
 
sampleFormat Stored () const
 
void UpdateEffective (sampleFormat effective)
 Update the effective format, for insertion of more samples into the sequence. More...
 

Private Attributes

sampleFormat m_Effective
 
sampleFormat m_Stored
 

Detailed Description

Two sample formats, remembering format of original source and describing stored format.

Useful when imported data are stored temporarily in a wider format but should be exported bit-perfect without dither if to the original format again

Invariant
Effective() <= Stored()

Definition at line 79 of file SampleFormat.h.

Constructor & Destructor Documentation

◆ SampleFormats()

SampleFormats::SampleFormats ( sampleFormat  effective,
sampleFormat  stored 
)
inline

Construct sampleFormats, but may change effective to satisfy the invariant

Parameters
effectiveHow much real information in each sample
storedThe form used for storage

Definition at line 82 of file SampleFormat.h.

86 : m_Effective{ std::min( effective, stored ) }
87 , m_Stored{ stored }
88 {}
int min(int a, int b)
sampleFormat m_Stored
Definition: SampleFormat.h:106
sampleFormat m_Effective
Definition: SampleFormat.h:105

Member Function Documentation

◆ Effective()

sampleFormat SampleFormats::Effective ( ) const
inline

Definition at line 90 of file SampleFormat.h.

90{ return m_Effective; }

References m_Effective.

Referenced by Sequence::ConvertToSampleFormat(), Sequence::Copy(), Sequence::HandleXMLTag(), operator==(), and Sequence::Paste().

Here is the caller graph for this function:

◆ Stored()

sampleFormat SampleFormats::Stored ( ) const
inline

◆ UpdateEffective()

void SampleFormats::UpdateEffective ( sampleFormat  effective)
inline

Update the effective format, for insertion of more samples into the sequence.

GetEffective() will not necessarily equal the given value, because the invariant will be preserved, and also GetEffective() will never become narrower than before: if any material in the sequence had a wider format, assume that the whole sequence still requires dithering to lesser formats than that.

Definition at line 98 of file SampleFormat.h.

99 {
100 if (effective > m_Effective)
101 m_Effective = std::min(effective, m_Stored);
102 }

References m_Effective, m_Stored, and min().

Referenced by Sequence::Append(), Sequence::AppendNewBlock(), Sequence::Flush(), Sequence::Paste(), and Sequence::SetSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_Effective

sampleFormat SampleFormats::m_Effective
private

Definition at line 105 of file SampleFormat.h.

Referenced by Effective(), and UpdateEffective().

◆ m_Stored

sampleFormat SampleFormats::m_Stored
private

Definition at line 106 of file SampleFormat.h.

Referenced by Stored(), and UpdateEffective().


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