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 77 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 80 of file SampleFormat.h.

84 : m_Effective{ std::min( effective, stored ) }
85 , m_Stored{ stored }
86 {}
int min(int a, int b)
sampleFormat m_Stored
Definition: SampleFormat.h:104
sampleFormat m_Effective
Definition: SampleFormat.h:103

Member Function Documentation

◆ Effective()

sampleFormat SampleFormats::Effective ( ) const
inline

Definition at line 88 of file SampleFormat.h.

88{ return m_Effective; }

References m_Effective.

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

Here is the caller graph for this function:

◆ Stored()

sampleFormat SampleFormats::Stored ( ) const
inline

Definition at line 89 of file SampleFormat.h.

89{ return m_Stored; }

References m_Stored.

Referenced by Sequence::Append(), Sequence::ConvertToSampleFormat(), Sequence::Copy(), Sequence::Delete(), Sequence::DoAppend(), Sequence::Flush(), Sequence::HandleXMLTag(), Sequence::InsertSilence(), Sequence::Paste(), Sequence::SetSamples(), and Sequence::SetSilence().

Here is the caller graph for this function:

◆ 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 96 of file SampleFormat.h.

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

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 103 of file SampleFormat.h.

Referenced by Effective(), and UpdateEffective().

◆ m_Stored

sampleFormat SampleFormats::m_Stored
private

Definition at line 104 of file SampleFormat.h.

Referenced by Stored(), and UpdateEffective().


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